コード例 #1
0
        IEnumerator WaitAndPrint()
        {
            while (_currentRealCharIndexIndex < _realCharIndexList.Count)
            {
                yield return(new WaitForSeconds(0.08f));

                dialogText.text = RichTextFormatUtil.GetRTFSubString(Localization.Get(_currentDialogData.message), _realCharIndexList[_currentRealCharIndexIndex]);
                _currentRealCharIndexIndex++;

                if (_currentRealCharIndexIndex >= _realCharIndexList.Count)
                {
                    StopCoroutine("WaitAndPrint");
                    isPrinting = false;
                    _currentRealCharIndexIndex = 0;
                    _currentDialogData         = DialogData.GetNextDialogData(_currentDialogData);
                    enterImage.gameObject.SetActive(true);

                    AutoDelayShowNextDialog();
                }
            }
        }
コード例 #2
0
        public void ShowCurrentDialog()
        {
            LeanTween.cancel(gameObject);
            if (_currentDialogData == null)
            {
                FinishDialog();
                return;
            }

            if (_currentDialogData.dialogNPCSide == Logic.Enums.DialogNPCSide.Left)
            {
                leftNPCRawImage.texture = ResMgr.instance.Load <Texture>(ResPath.GetNPCTexturePath(_currentDialogData.headIcon));
                //				leftNPCRawImage.SetNativeSize();
                string leftNPCName = string.Empty;
                if (_currentDialogData.heroName == "hero_name_my")
                {
                    leftNPCName = Logic.Game.Model.GameProxy.instance.AccountName;
                }
                else
                {
                    leftNPCName = Localization.Get(_currentDialogData.heroName);
                }
                leftNPCNameText.text = leftNPCName;

//                leftNPCRawImage.gameObject.SetActive(true);
//                rightNPCRawImage.gameObject.SetActive(false);

                leftNPCRoot.SetActive(true);
                rightNPCRoot.SetActive(false);

                leftNPCNameFrameGameObject.gameObject.SetActive(true);
                rightNPCNameFrameGameObject.gameObject.SetActive(false);

                enterImage.rectTransform.localScale       = new Vector3(1, 1, 1);
                enterImage.rectTransform.anchoredPosition = new Vector2(442, 72);
            }
            else
            {
                rightNPCRawImage.texture = ResMgr.instance.Load <Texture>(ResPath.GetNPCTexturePath(_currentDialogData.headIcon));
                //				rightNPCRawImage.SetNativeSize();
                string rightNPCName = string.Empty;
                if (_currentDialogData.heroName == "hero_name_my")
                {
                    rightNPCName = Logic.Game.Model.GameProxy.instance.AccountName;
                }
                else
                {
                    rightNPCName = Localization.Get(_currentDialogData.heroName);
                }
                rightNPCNameText.text = rightNPCName;

//                leftNPCRawImage.gameObject.SetActive(false);
//                rightNPCRawImage.gameObject.SetActive(true);

                leftNPCRoot.SetActive(false);
                rightNPCRoot.SetActive(true);

                leftNPCNameFrameGameObject.gameObject.SetActive(false);
                rightNPCNameFrameGameObject.gameObject.SetActive(true);

                enterImage.rectTransform.localScale       = new Vector3(-1, 1, 1);
                enterImage.rectTransform.anchoredPosition = new Vector2(-442, 72);
            }
            _realCharIndexList = RichTextFormatUtil.GetRTFStringRealCharIndexList(Localization.Get(_currentDialogData.message));
            isPrinting         = true;
            dialogText.text    = string.Empty;
            enterImage.gameObject.SetActive(false);
            StartCoroutine("WaitAndPrint");
        }