Esempio n. 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;
    }
Esempio n. 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);
    }
Esempio n. 3
0
 void VerticalCartoonOver(Vector2 vector2)
 {
     if (vector2.y < 0.988f)
     {
         playerIsControll = true;
     }
     if (playerIsControll && guidance != null)
     {
         GameObject.Destroy(guidance.gameObject);
         guidance = null;
     }
     if (VerticalCartoon.content.anchoredPosition.y > 2688f && !isStop)
     {
         isStop = true;
         VerticalCartoonSetLocalPosition(VerticalCartoon.content, 2688f);
         VerticalCartoon.vertical = false;
         VerticalCartoonClickGuidance(clickGuidancePos, tiaoman2.transform);//生成点击
         OpenClickBtn(true);
     }
 }
Esempio n. 4
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;
        }
    }
Esempio n. 5
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();
    }