Пример #1
0
    /// <summary>
    /// 点击背景
    /// </summary>
    public override async UniTask ClickBtn()
    {
        base.ClickBtn();

        if (_isPrinTing)
        {
            if (!_cancellationTokenSource.Token.IsCancellationRequested)
            {
                _cancellationTokenSource.Cancel();
            }

            _showText.text = ChapterTool.GetDialogueString(_dialogueData._Data);
            ShowEnd();
        }
        else
        {
            if (_isEnd)
            {
                _endAction?.Invoke();
            }
            else
            {
                SetDialogType(_dialogueData._Data);

                string dialogueNameData = ChapterTool.GetChapterFunctionString(_dialogueData._Data.NameID);
                await ShowStr(ChapterTool.GetDialogueString(_dialogueData._Data), dialogueNameData);
            }
        }
    }
Пример #2
0
    //显示选项按钮
    void ShowOption()
    {
        Option.gameObject.SetActive(true);
        option1.transform.Find("Text").GetComponent <Text>().text = ChapterTool.GetDialogueString(12000026);
        option2.transform.Find("Text").GetComponent <Text>().text = ChapterTool.GetDialogueString(12000027);
        option1.onClick.AddListener(() =>
        {
            //增加好感
            ImpulseHelper.OptionAddFavorable(12000026);
            Option.gameObject.SetActive(false);


            _dialogueFive.SetStartDialogueId(12000026);
            _dialogueFive.Initial(() =>
            {
                _dialogueFive.Close();
                NextStep();
            }, SpeakAeforeAction_Five);
            _dialogueFive.Show();
        });
        option2.onClick.AddListener(() =>
        {
            Option.gameObject.SetActive(false);
            _dialogueFive.SetStartDialogueId(12000027);
            _dialogueFive.Initial(() =>
            {
                _dialogueFive.Close();
                NextStep();
            }, SpeakAeforeAction_Five);
            _dialogueFive.Show();
        });
    }
Пример #3
0
    /// <summary>
    /// 展示对话
    /// </summary>
    /// <param name="data"></param>
    public override async UniTask Show(ChapterDialogueTextDefine data)
    {
        await base.Show(data);

        _roleSpeakAeforeAction?.Invoke(data);
        await UniTask.WaitUntil(() => !_roleSpeakAeforeAwait);

        _showText.text = ChapterTool.GetDialogueString(_dialogueData._Data);

        _boxBgRect.gameObject.SetActive(true);
        RefreshGroup();
        await ChapterTool.ChangeUiScale(_boxBgRect, Vector3.one, 0.1f, 10);

        _roleSpeakRearAction?.Invoke(_dialogueData._Data);
    }
Пример #4
0
    //显示路人讲话
    async void ShowPasserby_Image()
    {
        var    data     = ChapterTool.GetChapterData(10000005);
        string dialogue = ChapterTool.GetDialogueString(data);

        particle.Clear();
        particle.Pause();//暂停特效
        ChapterHelper.SetActive(passerby_image.gameObject, true, () =>
        {
            ChapterHelper.SetActive(lecture_image.gameObject, false);
            passerbyDialgoue.Play(dialogue);
        });
        await UniTask.Delay(800);

        OpenClickBtn(true);
    }
Пример #5
0
    //车内回答
    async void ShowCarMoveBGAnswer()
    {//男主回答
        ChapterHelper.SetActive(nanDialogue.gameObject, true);
        //带头像男主说话
        name_nan.text = ChapterTool.GetChapterFunctionString(10000002);
        var data = ChapterTool.GetChapterData(10000029);

        dialogueText_nan.word = ChapterTool.GetDialogueString(data);
        dialogueText_nan.Play();
        dialogueText_nan.Speed6Play();

        await UniTask.Delay(2700);

        ChapterHelper.SetActive(nanDialogue.gameObject, false);

        WallLoop wallLoop = carMoveBG.transform.Find("MoveBg").GetComponent <WallLoop>();

        wallLoop.callback = () =>
        {
            ClickBtn();
        };
    }
Пример #6
0
    //显示车外live2D动画
    async UniTask ShowCarMoveBG(CancellationTokenSource cancellationTokenSource)
    {
        ChapterHelper.SetActive(carMoveBG.gameObject, true);

        await UniTask.Delay(500);

        //带头像女主说话
        var data = ChapterTool.GetChapterData(10000028);

        ChapterHelper.SetActive(nvDialogue.gameObject, true);
        name_nv.text         = StaticData.playerInfoData.userInfo.Name;
        dialogueText_nv.word = ChapterTool.GetDialogueString(data);
        dialogueText_nv.Play();
        dialogueText_nv.Speed6Play();
        dialogueText_nv.onAnimationEnd.AddListener(() => { OpenClickBtn(true); });
        await UniTask.Delay(TimeSpan.FromMilliseconds(2700), cancellationToken : cancellationTokenSource.Token);

        OpenClickBtn(false);//玩家如果没点击先关闭按钮
        ChapterHelper.SetActive(nvDialogue.gameObject, false);
        _clickIndex++;
        ShowCarMoveBGAnswer();
    }
Пример #7
0
    public override void Initial()
    {
        _nextStepBtn = transform.GetComponent <Button>();
        _nextStepBtn.onClick.RemoveAllListeners();
        _nextStepBtn.onClick.AddListener(ClickBtn);

        _oneScene             = transform.Find("One") as RectTransform;
        dialogueBoxBubble_one = transform.Find("DialogueBox_Bubble_One").GetComponent <DialogueBoxBubbleComponent>();

        _twoScene               = transform.Find("Two") as RectTransform;
        dialogueBoxBubble_two   = transform.Find("DialogueBox_Bubble_Two").GetComponent <DialogueBoxBubbleComponent>();
        dialogueBoxBubble_three = transform.Find("DialogueBox_Bubble_Three").GetComponent <DialogueBoxBubbleComponent>();

        nan_face1 = _twoScene.Find("nanzhu/nanzhu_1").GetComponent <Image>();
        nan_face2 = _twoScene.Find("nanzhu/nanzhu_2").GetComponent <Image>();
        nan_face3 = _twoScene.Find("nanzhu/nanzhu_3").GetComponent <Image>();
        nv_face1  = _twoScene.Find("nvzhu/nvzhu_1").GetComponent <Image>();
        nv_face2  = _twoScene.Find("nvzhu/nvzhu_2").GetComponent <Image>();
        nv_face3  = _twoScene.Find("nvzhu/nvzhu_3").GetComponent <Image>();
        nv_face   = _twoScene.Find("nvzhu/nvzhu_face").GetComponent <Image>();

        option1 = transform.Find("btns/option1").GetComponent <Button>();
        option2 = transform.Find("btns/option2").GetComponent <Button>();
        var data1 = ChapterTool.GetChapterData(15000038);
        var data2 = ChapterTool.GetChapterData(15000039);

        option1.transform.Find("Text").GetComponent <Text>().text = ChapterTool.GetDialogueString(data1);
        option2.transform.Find("Text").GetComponent <Text>().text = ChapterTool.GetDialogueString(data2);


        option1.onClick.AddListener(() =>
        {
            option1.gameObject.SetActive(false);
            option2.gameObject.SetActive(false);
            ImpulseHelper.OptionAddFavorable(15000038);
            SetNextIndex(2);
            dialogueBoxBubble_three.SetStartDialogueId(15000038);
            dialogueBoxBubble_three.Initial(() =>
            {
                dialogueBoxBubble_three.Close();
                NextStep();
            }, AfterThreeDialogue);
            dialogueBoxBubble_three.Show();
        });
        option2.onClick.AddListener(() =>
        {
            option1.gameObject.SetActive(false);
            option2.gameObject.SetActive(false);

            ImpulseHelper.OptionAddFavorable(15000039);
            SetNextIndex(3);
            dialogueBoxBubble_three.SetStartDialogueId(15000039);
            dialogueBoxBubble_three.Initial(() =>
            {
                dialogueBoxBubble_three.Close();
                NextStep();
            }, AfterThreeDialogue);
            dialogueBoxBubble_three.Show();
        });

        ClickBtn();
        base.Initial();
    }
Пример #8
0
    /// <summary>
    /// 初始化组件
    /// </summary>
    public override void Initial()
    {
        _oneIamgeRect        = transform.Find("One").GetComponent <RectTransform>();
        _oneIamgeCanvasGroup = _oneIamgeRect.GetComponent <CanvasGroup>();
        _oneIamgeRect.gameObject.SetActive(true);
        _twoImageRect                    = transform.Find("Two").GetComponent <RectTransform>();
        _twoImagCanvasGroup              = _twoImageRect.GetComponent <CanvasGroup>();
        _therrBoxRect                    = transform.Find("TherBox").GetComponent <RectTransform>();
        _fourRect                        = transform.Find("Four").GetComponent <RectTransform>();
        _fourCanvasGroup                 = _fourRect.GetComponent <CanvasGroup>();
        _cupRect                         = _fourRect.Find("Cup").GetComponent <RectTransform>();
        _cupCanvasGroup                  = _cupRect.GetComponent <CanvasGroup>();
        _bgtOneCanvasGroup               = _fourRect.Find("BgOne").GetComponent <CanvasGroup>();
        _cupRectDrag                     = _cupRect.GetComponent <UIPanelDrag>();
        _cupRectDrag.m_DragPlane         = _fourRect;
        _cupRectDrag.actionOnPointerUp   = PointerUp;
        _cupRectDrag.actionOnPointerDown = PointerDown;

        _answerThePhoneRect        = transform.Find("AnswerThePhone").GetComponent <RectTransform>();
        _answerThePhoneCanvasGroup = _answerThePhoneRect.GetComponent <CanvasGroup>();

        _phoneRect        = _fourRect.Find("Phone").GetComponent <RectTransform>();
        _phoneCanvasGroup = _phoneRect.GetComponent <CanvasGroup>();
        _bgTwoRect        = _fourRect.Find("BgTwo").GetComponent <RectTransform>();
        _bgTwoCanvasGroup = _bgTwoRect.GetComponent <CanvasGroup>();
        _clickBtn         = GetComponent <Button>();
        _clickBtn.onClick.RemoveListener(ClickBtn);
        _clickBtn.onClick.AddListener(ClickBtn);

        _phoneBtn = _bgTwoRect.Find("PhoneBtn").GetComponent <Button>();
        _oneBtn   = _phoneRect.Find("BtnOne").GetComponent <Button>();
        _twoBtn   = _phoneRect.Find("BtnTwo").GetComponent <Button>();

        _fiveRect         = transform.Find("Five").GetComponent <RectTransform>();
        _fiveBtnBoxRect   = transform.Find("FiveBtnBox").GetComponent <RectTransform>();
        _fiveBtnOne       = _fiveBtnBoxRect.Find("One").GetComponent <Button>();
        _fiveBtnOneText   = _fiveBtnOne.transform.Find("Text").GetComponent <Text>();
        _fiveBtnTwo       = _fiveBtnBoxRect.Find("Two").GetComponent <Button>();
        _fiveBtnTwoText   = _fiveBtnTwo.transform.Find("Text").GetComponent <Text>();
        _fiveBtnTherr     = _fiveBtnBoxRect.Find("Therr").GetComponent <Button>();
        _fiveBtnTherrText = _fiveBtnTherr.transform.Find("Text").GetComponent <Text>();
        _oneBtn.onClick.RemoveAllListeners();
        _oneBtn.onClick.AddListener(ClickOneBtn);
        _twoBtn.onClick.RemoveAllListeners();
        _twoBtn.onClick.AddListener(ClickTwoBtn);


        _fiveBtnOneText.text   = ChapterTool.GetDialogueString(12000063);
        _fiveBtnTwoText.text   = ChapterTool.GetDialogueString(12000064);
        _fiveBtnTherrText.text = ChapterTool.GetChapterFunctionString(10000000);
        _fiveBtnOne.onClick.RemoveAllListeners();
        _fiveBtnOne.onClick.AddListener(ClickFiveBtnOne);
        _fiveBtnTwo.onClick.RemoveAllListeners();
        _fiveBtnTwo.onClick.AddListener(ClickFiveBtnTwo);
        _phoneBtn.onClick.RemoveAllListeners();
        _phoneBtn.onClick.AddListener(ClickBtn);
        ChapterModuleManager._Instance.ClickEndChapterBtn(_fiveBtnTherr, NextStep);
        //_fiveBtnTherr.onClick.RemoveAllListeners();
        //_fiveBtnTherr.onClick.AddListener(ClickFiveBtnTherr);

        _dialogueBase = transform.Find("DialogueBox_Bubble").GetComponent <DialogueBoxBubbleComponent>();
        _dialogueBoxTetragonumComponent = transform.Find("DialogueBox_Tetragonum").GetComponent <DialogueBoxTetragonumComponent>();
        _dialogueBaseTwo   = transform.Find("DialogueBox_BubbleTwo").GetComponent <DialogueBoxBubbleComponent>();
        _dialogueBaseTherr = transform.Find("DialogueBox_BubbleTherr").GetComponent <DialogueBoxBubbleComponent>();
        _dialogueBaseFour  = transform.Find("DialogueBox_BubbleFour").GetComponent <DialogueBoxBubbleComponent>();
        _dialogueBaseFive  = transform.Find("DialogueBox_BubbleFive").GetComponent <DialogueBoxBubbleComponent>();
        _chapterGuidance   = _fourRect.Find("ChapterGuidance").GetComponent <ChapterGuidance>();

        //表情
        nanface1_image = transform.Find("Two/nanface1_image").GetComponent <Image>();
        nanface2_image = transform.Find("Two/nanface2_image").GetComponent <Image>();
        nvface1_image  = transform.Find("Two/nvface1_image").GetComponent <Image>();
        nvface2_image  = transform.Find("Two/nvface2_image").GetComponent <Image>();
        nvface3_image  = transform.Find("Two/nvface3_image").GetComponent <Image>();
        nvface4_image  = transform.Find("Two/nvface4_image").GetComponent <Image>();

        //phone表情
        nv2_Rect       = _answerThePhoneRect.Find("nv2") as RectTransform;
        nv1Face1_phone = _answerThePhoneRect.Find("nv1/nv1Face1").GetComponent <Image>();
        nv1Face2_phone = _answerThePhoneRect.Find("nv1/nv1Face2").GetComponent <Image>();
        nv1Face3_phone = _answerThePhoneRect.Find("nv1/nv1Face3").GetComponent <Image>();
        nv2Face1_phone = nv2_Rect.Find("nv2Face1").GetComponent <Image>();
        nv2Face2_phone = nv2_Rect.Find("nv2Face2").GetComponent <Image>();
        nv2Face3_phone = nv2_Rect.Find("nv2Face3").GetComponent <Image>();

        //endScene表情
        nanface1_image_endScene = _fiveRect.Find("nanface1_image").GetComponent <Image>();
        nanface2_image_endScene = _fiveRect.Find("nanface2_image").GetComponent <Image>();
        nvface1_image_endScene  = _fiveRect.Find("nvface1_image").GetComponent <Image>();
        nvface2_image_endScene  = _fiveRect.Find("nvface2_image").GetComponent <Image>();

        ClickBtn();
        base.Initial();
    }