示例#1
0
        protected void CreateDialogChoices()
        {
            if (Conv.Continues)
            {
                float           offset    = 0.0f;
                float           fadeDelay = 0.05f;
                List <Exchange> RunningOutgoingChoices = Conv.RunningOutgoingChoices;
                List <GUIConversationBubble> choices   = new List <GUIConversationBubble> ();
                foreach (Exchange outgoingChoice in RunningOutgoingChoices)
                {
                    GameObject            newPlayerDialogChoiceGameObject = NGUITools.AddChild(PlayerDialogChoicesParent, PlayerDialogChoicePrototype);
                    GUIPlayerDialogChoice playerDialogChoice = newPlayerDialogChoiceGameObject.GetComponent <GUIPlayerDialogChoice> ();

                    playerDialogChoice.Choice = outgoingChoice;
                    playerDialogChoice.ChoiceButtonMessage.target       = gameObject;
                    playerDialogChoice.ChoiceButtonMessage.functionName = "MakeDialogChoice";
                    playerDialogChoice.gameObject.name = "Choice_" + outgoingChoice.Name;

                    GUIConversationBubble bubble = playerDialogChoice.GetComponent <GUIConversationBubble> ();
                    bubble.FadedColor          = (outgoingChoice.NumTimesChosen > 0);
                    bubble.FadeDelay           = fadeDelay;
                    bubble.EnableAutomatically = false;
                    playerDialogChoice.Offset  = offset;
                    bubble.SetProps(outgoingChoice.CleanPlayerDialog, Colors.Get.ConversationPlayerBackground, Colors.Get.ConversationPlayerOption);
                    offset    -= bubble.Height;
                    fadeDelay += 0.05f;
                    choices.Add(bubble);
                }
                PlayerDialogChoicesScrollbar.scrollValue = 0.0f;
                PlayerDialogChoicesScrollbar.ForceUpdate();
                StartCoroutine(WaitForDialogChoicesToBeReady(choices));
            }
        }
示例#2
0
        public void MakeDialogChoice(GameObject sender)
        {
            if (!mDialogChoicesReady)
            {
                Debug.Log("Dialog choices aren't ready yet");
                return;
            }

            GUIPlayerDialogChoice playerDialogChoice = sender.gameObject.GetComponent <GUIPlayerDialogChoice> ();
            Exchange choice = playerDialogChoice.Choice;

            if (choice == null)              //null means '(more)'
            {
                ShowNextPage();
                if (Conv.Continues)
                {
                    LeaveButton.gameObject.SetActive(false);
                }
                return;
            }

            string dtsOnFailure;

            Conv.MakeOutgoingChoice(choice, out dtsOnFailure);
            LoadNextExchange();
        }
示例#3
0
        protected void CreateNextPageChoice()
        {
            GameObject            newPlayerDialogChoiceGameObject = NGUITools.AddChild(PlayerDialogChoicesParent, PlayerDialogChoicePrototype);
            GUIPlayerDialogChoice playerDialogChoice = newPlayerDialogChoiceGameObject.GetComponent <GUIPlayerDialogChoice> ();

            playerDialogChoice.Choice = null;
            playerDialogChoice.ChoiceButtonMessage.target       = gameObject;
            playerDialogChoice.ChoiceButtonMessage.functionName = "MakeDialogChoice";
            playerDialogChoice.gameObject.name         = "Choice_" + (-1).ToString();
            playerDialogChoice.transform.localPosition = new Vector3(0f, -250f, 0f);

            GUIConversationBubble bubble = playerDialogChoice.GetComponent <GUIConversationBubble> ();

            bubble.EnableAutomatically = true;
            bubble.FadedColor          = false;
            bubble.FadeDelay           = 0.05f;
            bubble.SetProps("(More)", Colors.Get.ConversationPlayerBackground, Colors.Get.ConversationPlayerOption);
            playerDialogChoice.Offset = 0.0f;
        }