Ejemplo n.º 1
0
        private void ShowDialogFromQueue()
        {
            SimpleUIDialogContent targetUIDContent = uiDialogContentQueue.Dequeue();

            activeDialog = true;
            dialogPanelBG.SetActive(true);
            dialogPanelAnimator.Animate_Scale(UIAnimator.Location.END);
            dialogTitle.text   = targetUIDContent.dialogTitleString;
            dialogContent.text = targetUIDContent.dialogContentString;


            foreach (Transform obj in actionBtnPanel.GetComponent <Transform>())
            {
                if (obj.gameObject == actionBtnPanel)
                {
                    continue;
                }

                Destroy(obj.gameObject);
            }

            if (targetUIDContent.uiDialogActions != null)
            {
                for (int i = 0; i < targetUIDContent.uiDialogActions.Count; i++)
                {
                    GameObject newBtn     = Instantiate(actionBtn_Prefab, actionBtnPanel);
                    Button     newBtn_Btn = newBtn.GetComponentInChildren <Button>();

                    newBtn_Btn.onClick.AddListener(delegate { CloseDialog(); });
                    newBtn_Btn.onClick.AddListener(targetUIDContent.uiDialogActions[i].action);

                    TextMeshProUGUI newBtn_Text = newBtn.GetComponentInChildren <TextMeshProUGUI>();
                    newBtn_Text.text = targetUIDContent.uiDialogActions[i].buttonText;

                    Image newBtn_Img = newBtn.GetComponentInChildren <Image>();
                    if (
                        targetUIDContent.highlightBtn != 0 &&
                        targetUIDContent.uiDialogActions.Count >=
                        targetUIDContent.highlightBtn && i + 1 ==
                        targetUIDContent.highlightBtn)
                    {
                        newBtn_Img.color  = accentColor;
                        newBtn_Text.color = Color.white;
                    }
                }
            }

            if (targetUIDContent.showCloseDialogBtn)
            {
                closeDialogBtn.gameObject.SetActive(true);
            }
            else
            {
                closeDialogBtn.gameObject.SetActive(false);
            }
        }
Ejemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            GUILayout.Space(10);
            if (Application.isPlaying)
            {
                if (editorTarget.AnimMode == UIAnimator.AnimateMode.POSITION)
                {
                    EditorGUILayout.LabelField("Position Anim Control", EditorStyles.boldLabel);
                    if (GUILayout.Button("Animate to Initial"))
                    {
                        editorTarget.Animate_Pos(UIAnimator.Location.INITIAL);
                    }
                    if (GUILayout.Button("Animate to End"))
                    {
                        editorTarget.Animate_Pos(UIAnimator.Location.END);
                    }
                    if (GUILayout.Button("Animate to Opposite"))
                    {
                        editorTarget.Animate_Pos_ToOpposite();
                    }
                }

                if (editorTarget.AnimMode == UIAnimator.AnimateMode.SCALE)
                {
                    EditorGUILayout.LabelField("Scale Anim Control", EditorStyles.boldLabel);
                    if (GUILayout.Button("Animate to Initial"))
                    {
                        editorTarget.Animate_Scale(UIAnimator.Location.INITIAL);
                    }
                    if (GUILayout.Button("Animate to End"))
                    {
                        editorTarget.Animate_Scale(UIAnimator.Location.END);
                    }
                    if (GUILayout.Button("Animate to Opposite"))
                    {
                        editorTarget.Animate_Scale_ToOpposite();
                    }
                }

                if (editorTarget.AnimMode == UIAnimator.AnimateMode.ROTATION)
                {
                    EditorGUILayout.LabelField("Rotation Anim Control", EditorStyles.boldLabel);
                    if (GUILayout.Button("Animate to Stop"))
                    {
                        editorTarget.CurrRotState = UIAnimator.RotationState.STOPPED;
                    }
                    if (GUILayout.Button("Animate to Running"))
                    {
                        editorTarget.CurrRotState = UIAnimator.RotationState.RUNNING;
                    }
                    if (GUILayout.Button("Animate to Opposite"))
                    {
                        editorTarget.CurrRotState = editorTarget.CurrRotState ==
                                                    UIAnimator.RotationState.RUNNING ? UIAnimator.RotationState.STOPPED : UIAnimator.RotationState.RUNNING;
                    }
                }
            }

            GUILayout.Space(10);
            base.OnInspectorGUI();
        }