/// <summary> /// 刷新底部栏高度 /// </summary> /// <param name="type"></param> public async UniTask RefreshBottom(int type) { RectTransform tageRect = null; switch (type) { case 0: tageRect = _btnBoxRect; break; case 1: tageRect = _ImagBoxRect; break; case 2: Debug.Log("还原底部栏"); break; } float height = 0; if (tageRect != null) { LayoutRebuilder.ForceRebuildLayoutImmediate(tageRect); Debug.Log("底部按钮内容栏高:" + tageRect.sizeDelta); await UniTask.DelayFrame(1); height = _controlStripRect.sizeDelta.y + tageRect.sizeDelta.y; } else { height = _controlStripRect.sizeDelta.y; } RefreshContentRectSize(height); await ChapterTool.ChangeUiSize(_bottomRect, new Vector2(_bottomRect.sizeDelta.x, height), 50f, 0.01f, null, () => { Debug.Log("尺寸更改完毕"); }); }
/// <summary> /// 刷新内容栏尺寸 /// </summary> public async void RefreshContentRectSize(float bottomRectHeight) { float a = 1242f * Screen.height / Screen.width; //最大高度 float maxheight = a;// _thisRect.rect.height; float height = maxheight - _topRect.sizeDelta.y - bottomRectHeight; await ChapterTool.ChangeUiSize(_chatWindowRect, new Vector2(_chatWindowRect.sizeDelta.x, height), 100f, 0.01f, null, () => { _scrollRect.verticalScrollbar.value = 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; } }