Пример #1
0
    public void Initial(Action endAction, Action dragAction)
    {
        _bgRect             = transform.Find("Bg").GetComponent <RectTransform>();
        _wokRect            = _bgRect.Find("Wok").GetComponent <RectTransform>();
        _lifebarBoxRect     = _bgRect.Find("LifebarBox").GetComponent <RectTransform>();
        _lifebarItem        = _lifebarBoxRect.Find("Energy");
        _lifebarRect        = _lifebarBoxRect.Find("Lifebar").GetComponent <RectTransform>();
        _lifebarTitleText   = _lifebarBoxRect.Find("Title").GetComponent <Text>();
        _operationBoxRect   = _bgRect.Find("OperationBox").GetComponent <RectTransform>();
        _operationRect      = _operationBoxRect.Find("Operation").GetComponent <RectTransform>();
        _globuleRect        = _operationRect.Find("Globule").GetComponent <RectTransform>();
        _operationTageRect  = _operationRect.Find("TagePoint").GetComponent <RectTransform>();
        _explainBoxRect     = _operationBoxRect.Find("ExplainBox").GetComponent <RectTransform>();
        _operationTitleText = _operationBoxRect.Find("Title").GetComponent <Text>();
        _affirmBtn          = transform.Find("AffirmBtn").GetComponent <Button>();
        _affirmBtnText      = _affirmBtn.transform.Find("Text").GetComponent <Text>();
        _chapterGuidance    = _bgRect.Find("ChapterGuidance").GetComponent <ChapterGuidance>();
        _chapterGuidance.gameObject.SetActive(true);
        _chapterGuidance.PlayGuidanceAnima(_chapterGuidance.transform.localPosition, _wokRect.localPosition);
        _affirmBtn.onClick.RemoveAllListeners();
        _affirmBtn.onClick.AddListener(OnClickAffirmBtn);
        InitialLifebar();
        InitialOperation();
        InitialFood();
        OpenAffirmBtn(false);
        _endAction  = endAction;
        _dragAction = dragAction;

        _isInitial = true;
    }
Пример #2
0
    GameObject verticalCartoonClickGuidance; //条漫的点击引导
    //条漫1
    async void ShowVerticalCartoon()
    {
        ChapterHelper.Fade(VerticalCartoon.gameObject, 1, 0.8f, 0);
        VerticalCartoon.onValueChanged.AddListener(VerticalCartoonOver);
        //引导
        guidance = await SlideGuidance(VerticalCartoon.transform);

        guidance.PlayGuidanceAnima(VerticalCartoon_startPos, VerticalCartoon_endPos, () =>
        {
            VerticalCartoon.content.DOAnchorPosY(VerticalCartoon.content.anchoredPosition.y + 250f, 1).OnComplete(() =>
            {
                //引导移动完成后记录位置
                playerIsControll = false;
            });
        }, -1, 1);
    }
Пример #3
0
    /// <summary>
    /// 创建除草奖励
    /// </summary>
    /// <param name="tagePoin"></param>
    void CreationAwardItem(Vector3 tagePoin)
    {
        GameObject  obj  = GameObject.Instantiate(_awardItem.gameObject, transform);
        UIPanelDrag item = obj.GetComponent <UIPanelDrag>();

        item.localPos = tagePoin;
        item.transform.localPosition = tagePoin;
        int   index     = Random.Range(0, _awardItemSprites.Count);
        Image awardIcon = item.GetComponent <Image>();

        awardIcon.sprite = _awardItemSprites[index];
        awardIcon.SetNativeSize();
        Transform trashCanTage = _trashCan[index];

        item.actionOnPointerUp = DragUp;
        if (_showAwardItemDic.ContainsKey(trashCanTage))
        {
            _showAwardItemDic[trashCanTage].Add(item);
        }
        else
        {
            List <UIPanelDrag> uIPanelDrags = new List <UIPanelDrag>();
            uIPanelDrags.Add(item);
            _showAwardItemDic.Add(trashCanTage, uIPanelDrags);
        }
        _allAwards.Add(item);
        item.gameObject.SetActive(true);
        //item.enabled = false;
        if (onece)
        {//创建引导
            createGuidance = () =>
            {
                var        parfab   = ABManager.GetAsset <GameObject>("ChapterGuidance");
                GameObject guidance = GameObject.Instantiate(parfab, transform);
                chapterGuidance = guidance.GetComponent <ChapterGuidance>();
                chapterGuidance.PlayGuidanceAnima(item.transform.localPosition, trashCanTage.transform.localPosition);
            };
            onece = false;
        }
    }
Пример #4
0
    /// <summary>
    /// 步骤切换
    /// </summary>
    /// <param name="index"></param>
    public async void StepCut(int index)
    {
        switch (index)
        {
        case 0:
            await ChapterTool.MoveUi(_oneIamgeRect, new Vector2(-490f, 0), 0.1f, 0.1f);

            await ChapterTool.FadeInFadeOut(_oneIamgeCanvasGroup, 0, fadeOut, null, () => { _oneIamgeRect.gameObject.SetActive(false); ClickBtn(); });

            //OpenClickBtn(true);
            break;

        case 1:
            _dialogueBase.Initial(() =>
            {
                Debug.Log("对话1完毕");
                //OpenClickBtn(true);
                _dialogueBase.Close();
                //_clickIndex = 2;
                ClickBtn();
                Debug.Log("_clickIndex:" + _clickIndex);
            }, TwoSceneSpeakBeforeCallBack, TwoSceneSpeakAfterCallBack);
            _dialogueBase.Show();
            //OpenClickBtn(false);
            break;

        case 2:
            //await ChapterTool.FadeInFadeOut(_twoImagCanvasGroup, 0, 0.1f, null, () =>
            //{
            _twoImagCanvasGroup.alpha = 0;
            _dialogueBoxTetragonumComponent.Initial(async() =>
            {
                await ChapterTool.FadeInFadeOut(_twoImagCanvasGroup, 1, fadeOut, new CancellationTokenSource(), () =>
                {
                    _therrBoxRect.gameObject.SetActive(false);
                    _dialogueBase.SetStartDialogueId(12000036);
                    _dialogueBase.Initial(() =>
                    {
                        ClickBtn();     //心想完成后直接下个画面
                        //OpenClickBtn(true);
                        _dialogueBase.Close();
                    });
                    _dialogueBase.Show();
                });
                _dialogueBoxTetragonumComponent.Close();
            }, SpeakBeforeAction, SpeakRearAction);
            _dialogueBoxTetragonumComponent.Show();
            //OpenClickBtn(false);
            //_dialogueBoxTetragonumComponent.OpenClickBtn(false);
            //});
            break;

        case 3:
            await ChapterTool.FadeInFadeOut(_twoImagCanvasGroup, 0, fadeOut, null, () => { _twoImagCanvasGroup.gameObject.SetActive(false); });

            _dialogueBaseTwo.Initial(() =>
            {
                _dialogueBaseTwo.Close();
                Debug.Log("对话2完毕");
                ChapterTool.MoveUi(_bgTwoRect, new Vector3(-737, 0, 0), 0.8f, 0.2f);
                ChapterTool.ChangeUiSize(_bgTwoRect, new Vector3(2737, 5808, 1), 90, 10, null, () =>
                {
                    _phoneBtn.enabled = true;
                    _phoneBtn.transform.GetComponent <Image>().enabled = true;
                    _phoneBtn.transform.Find("ChapterClickGuidance").gameObject.SetActive(true);
                });
            }, SpeakAeforeActionTwo, SpeakRearActionTwo, SpeakBoxCloseActionTwo);
            _dialogueBaseTwo.Show();
            Debug.Log("对话2初始化完毕");
            break;

        case 4:
            Debug.Log("第四步");

            await _dialogueBaseTwo.CloseAllShowText();

            await UniTask.WaitUntil(() => _dialogueBaseTwo.IsAllClose(0));

            await UniTask.Delay(TimeSpan.FromSeconds(1));

            _dialogueBaseTwo.MomentCloseOrOpen(true);
            _dialogueBaseTwo.OpenClickBtn(false);
            _dialogueBaseTwo.gameObject.SetActive(false);
            ChapterTool.FadeInFadeOut(_fourCanvasGroup, 1, fadeOut, new CancellationTokenSource());
            await ChapterTool.FadeInFadeOut(_twoImagCanvasGroup, 0, fadeOut, null, () =>
            {
                _twoImageRect.gameObject.SetActive(false);
                _chapterGuidance.gameObject.SetActive(true);
                _chapterGuidance.PlayGuidanceAnima(_chapterGuidance.transform.localPosition, new Vector3(-40, 247));
            });

            break;

        case 5:
            ChapterTool.FadeInFadeOut(_cupCanvasGroup, 0, fadeOut, null, () => { _cupRect.gameObject.SetActive(false); });
            await ChapterTool.FadeInFadeOut(_bgtOneCanvasGroup, 0, fadeOut, new CancellationTokenSource(), () =>
            {
                _bgtOneCanvasGroup.gameObject.SetActive(false);
                _dialogueBaseTwo.gameObject.SetActive(true);
                _dialogueBaseTwo.MomentCloseOrOpen(false);
                _dialogueBaseTwo.OpenClickBtn(true);
                _dialogueBaseTwo.GetRoleData(10000001).SetRolePoint(new Vector3(24, 543));
                _dialogueBaseTwo.GetRoleData(10000002).SetRolePoint(new Vector3(0, -1550));
                _dialogueBaseTwo.ClickBtn();
            });

            break;

        case 6:
            _phoneBtn.enabled = false;
            await ChapterTool.FadeInFadeOut(_bgTwoCanvasGroup, 0, fadeOut, null, () => { _bgTwoRect.gameObject.SetActive(false); });

            break;

        case 7:
            OprnFour();
            break;

        case 8:
            _fiveBtnBoxRect.gameObject.SetActive(true);
            _fourRect.gameObject.SetActive(false);
            _answerThePhoneRect.gameObject.SetActive(false);
            break;
        }
    }