public void OnItemClick(QuestionItem item) { if (item.isTrue) { //回答正确 提示正确 面板关闭 继续 GameTools.FadeUI(rightPrompt, false, 0.2f, oneCallback: () => { GameTools.WaitDoSomeThing(this, 1f, () => { rightPrompt.gameObject.SetActive(false); }); }); SetPlaneState(false); // lanternRiddles.OnQuestionItemClick(true); OnQuestionItemClick.Invoke(true); } else { InitQusetion(); //回答错误 提示错误 面板关闭 重新开始 GameTools.FadeUI(errorPrompt, false, 0.2f, oneCallback: () => { GameTools.WaitDoSomeThing(this, 1f, () => { errorPrompt.gameObject.SetActive(false); }); }); SetPlaneState(false); //lanternRiddles.OnQuestionItemClick(false); OnQuestionItemClick.Invoke(false); } }
/// <summary> /// 拖动计算 数量 /// </summary> public void OnDragEndCountSum() { sum++; if (sum >= 12) { xiaoguoImg.transform.SetAsLastSibling(); GameTools.FadeUI(dragPlane, true, 1.5f); GameTools.FadeUI(xiaoguoImg.gameObject, false, 1.5f); GameTools.WaitDoSomeThing(this, 2f, () => { xiaoguoImg.transform.DOScale(Vector3.one * 5, 3f).SetEase(Ease.Linear); GameTools.WaitDoSomeThing(this, 2f, () => { dragPlane.transform.parent.GetChild(0).gameObject.SetActive(false); dragPlane.gameObject.SetActive(false); GameTools.FadeUI(this.gameObject, true, 1.5f); GameTools.FadeUI(xiaoguoImg.gameObject, true, 1.5f); GameTools.WaitDoSomeThing(this, 1f, () => { OnEnd.Invoke(); }); }); }); } }
/// <summary> /// 出现彩虹 女主 男主走上去 /// </summary> public void OpenCaiHongAndNvzhu() { GameTools.FadeUI(pingtuPlane, false, 1.5f); GameTools.FadeUI(nvzhu.gameObject, false, 3f); GameTools.FadeUI(caihong.gameObject, false, 3f); groundCollider.enabled = false; GameTools.WaitDoSomeThing(this, 3.2f, () => { Player.PlayerMove(posyun.position, () => { GameTools.FadeUI(Player.GetComponentInChildren <PlayerShadow>().gameObject, true); //隐藏倒影 GameTools.FadeUI(canvas, true); //画布隐藏 Player.SetPlayerDir(true); //设置向右 //女主提问 //GameTools.FadeUI(nvzhu.transform.GetChild(0).gameObject, false, 1f); // Text text = nvzhu.transform.GetChild(0).GetComponentInChildren<Text>(); // text.DOText("我的意中人会记得我们的过往吗", 2f).SetEase(Ease.Linear).OnComplete(() => // { // //出现答题面板 //}); NvzhuTing("我的意中人会记得我们的过往 ", () => answerPlane.Show(true)); //人物移动路径 //Vector3[] waypoints = new[] { new Vector3(4.35f, -1.032007f, 0f), new Vector3(5.164424f, -0.04210535f, 0f), new Vector3(5.829236f, 0.5752205f, 0f), new Vector3(6.763138f, 1.12923f, 0f), new Vector3(7.950302f, 1.335005f, 0f), new Vector3(9.171f, 1.413819f, 0f), new Vector3(10.31902f, 1.256247f, 0f), new Vector3(11.46704f, 0.6934913f, 0f), new Vector3(12.06689f, 0.2795507f, 0f), new Vector3(12.67462f, 0.2455046f, 0f), new Vector3(13.01521f, 0.2813561f, 0f) }; //Player.transform.DOPath(waypoints,10,PathType.CatmullRom).SetEase(Ease.Linear); //Player.transform.DOScale(Vector3.one * 0.312236f, 8.5f).SetEase(Ease.Linear).OnComplete(()=> //{ // Camera mainCamera = Camera.main; // mainCamera.GetComponent<CameraFollow>().enabled = false; // mainCamera.transform.DOMove(new Vector3(13.3f, 1.5f, -10), 4f).SetEase(Ease.OutQuad); // mainCamera.DOOrthoSize(2f, 4f).SetEase(Ease.OutQuad); //}); }); }); }
/// <summary> /// 女主第一次出场给颜色 /// </summary> private void QicaiYunMove() { qicaiYun.Move(pos1, 5f);//移动到指定地点 qicaiYun.OnMoveEnd.AddListener(() => { qicaiYun.NvzhuTalk("没有你的日子,整个世界失去了色彩", () => { ChangeColor(false); GameTools.WaitDoSomeThing(this, 3.5f, () => qicaiYun.NvzhuTalk("现在给你几种颜色,如果你真的是我的意中人,就请点亮我的世界吧 ", () => { qicaiYun.HideTalk(); GameTools.FadeUI(colorsGo, false, 1.5f, oneCallback: () => { qicaiYun.OnMoveEnd.RemoveAllListeners(); GameTools.WaitDoSomeThing(this, 1f, () => qicaiYun.Move(pos2, 3f)); GameTools.WaitDoSomeThing(this, 4f, () => { qicaiYun.gameObject.SetActive(false); OnNvzhuMoveEnd.Invoke(); }); }); })); }); }); }
void Start() { for (int i = 0; i < togs.Length; i++) { int index = i; togs[i].onValueChanged.AddListener((ison) => { GameTools.FadeUI(tips[index], !ison, 0.4f); }); // togs[i].gameObject.SetActive(false); } foreach (var item in GameManager.Instance.DicRember) { if (item.Value) { for (int i = 0; i < togs.Length; i++) { if (togs[i].name == item.Key) { togs[i].gameObject.SetActive(true); } } } } }
/// <summary> /// 当拖动诗 把手隐藏 /// </summary> public void OnDragShiHideHand() { if (hand.activeInHierarchy) { GameTools.FadeUI(hand, true); } }
/// <summary> /// 当灯谜过关 /// </summary> public void OnDengmiPass() { PlayerController.isLock = true; Player.transform.GetChild(1).gameObject.SetActive(false); GameTools.WaitDoSomeThing(this, 2f, () => { GameTools.FadeUI(duanqiao, true, 1.5f); GameTools.FadeUI(narmalqiao, false, 1.5f); }); GameTools.WaitDoSomeThing(this, 3.8f, () => { Player.SetPlayerDir(true); Player.transform.GetChild(1).gameObject.SetActive(false); Player._PlayerState = PlayerState.Walk; Player.transform.DOMove(endpos[0].position, 0.8f).SetEase(Ease.Linear).OnComplete(() => { Player.transform.DOMove(endpos[1].position, 4f).SetEase(Ease.Linear).OnComplete(() => { GameTools.WaitDoSomeThing(this, 1f, () => GameManager.Instance.LoadScene("3")); Player.transform.DOMove(endpos[2].position, 2f).SetEase(Ease.Linear); }); }); }); }
/// <summary> /// 引导结束 菜单按钮 /// </summary> public void GuideEndPose() { if (guideMask.guideEnd) { return; } if (!guideMask.gameObject.activeInHierarchy) { return; } guideMask.guideEnd = true; guideMask.GuideEnd(); //显示菜单下面的四个按钮以及mask GameTools.WaitDoSomeThing(this, 1f, () => { GameTools.FadeUI(butsFourBtnsMask, false, 1.2f); GameTools.FadeUI(butsFour, false, 1.2f); }); GameTools.WaitDoSomeThing(this, 4f, () => { GameTools.FadeUI(butsFourBtnsMask, true, 1f); GameTools.FadeUI(butsFour, true, 1f); GameTools.WaitDoSomeThing(this, 0.9f, () => { Scene01Manager.Instance.ShowOrHideUI(endGuidePlane); }); GameTools.WaitDoSomeThing(this, 4f, () => { Scene01Manager.Instance.ShowOrHideUI(endGuidePlane); }); }); }
/// <summary> /// 船里的花慢慢消失 /// </summary> public void ChuanHuaFade() { GameTools.WaitDoSomeThing(this, 1f, () => { GameTools.FadeUI(hongHua, true, 3f); piaoluoHua.gameObject.SetActive(true); }); }
/// <summary> /// 出现提示 /// </summary> private void ShowPrompt() { if (index >= 1) { GameTools.FadeUI(promptImgs[index - 1].gameObject, true); } GameTools.FadeUI(promptImgs[index].gameObject, false, 2f); }
public void InitLanternItem() { GameTools.FadeUI(imgChild.gameObject, false, 0.8f, oneCallback: () => { GameTools.FadeUI(imgChild.gameObject, true, 0.6f); }); isOpen = false; }
IEnumerator Start() { startVideoPlayer.loopPointReached += VideoCtrl_loopPointReached; yield return(new WaitForSeconds(40f)); GameTools.FadeUI(btnStart, false);//显示开始按钮 yield return(new WaitForSeconds(9.5f)); loopVideoPlayer.Play(); }
/// <summary> /// 检测诗句是否拖动完毕 /// </summary> public void OnDragEnd() { sumDrag++; if (sumDrag >= 4) //如果诗句都拖动完毕 { GameTools.FadeUI(tip, true); //隐藏提示 (voicePlane.transform.GetChild(1) as RectTransform).DOAnchorPos(new Vector2(-320, 30), 1.2f).SetDelay(0.7f); //扇子往中间移动 voicePlane.GetComponent <VoiceRecognition>().enabled = true; //开启录音 } }
private void BtnClick() { //如果点开图片状态为false 才能点击 if (!imgChild.gameObject.activeInHierarchy) { GameTools.FadeUI(imgChild.gameObject, false); lanternRiddles.OnDengItemClick(this); isOpen = true; } }
/// <summary> /// 水里的花开始展现 /// </summary> public void ShuilihuaShow() { GameTools.WaitDoSomeThing(this, 1f, () => { GameTools.FadeUI(shuiliHua, false, 5f, oneCallback: () => { ChuanMove(); }); for (int i = 0; i < piaoluoHua.transform.childCount; i++) { GameTools.FadeUI(piaoluoHua.transform.GetChild(i).gameObject, true, duartion: 6f, cleanCallback: () => { piaoluoHua.gameObject.SetActive(false); }); } }); }
/// <summary> /// 赋予颜色 统计 /// </summary> public void GetColorSum() { sum++; if (sum >= 3) { GameTools.WaitDoSomeThing(this, 1f, () => { ChangeColor(true); GameTools.FadeUI(clickQicaiYun, false, 1.5f); }); } }
public void ClickYun(PointerEventData eventData) { clickQicaiYun.GetComponent <BoxCollider2D>().enabled = false; Transform deng = eventData.pointerCurrentRaycast.gameObject.transform; print(Vector3.Distance(deng.position, Player.transform.position)); if (Vector3.Distance(deng.position, Player.transform.position) < 5f) { /// 出现拼图界面 GameTools.FadeUI(pingtuPlane, false, 1.5f); } }
public void Show(bool isOpen) { GameTools.FadeUI(this.gameObject, !isOpen, 0.5f); if (isOpen == false) { GameTools.FadeUI(this.gameObject.transform.parent.gameObject, true, 0.5f); } else { this.gameObject.transform.parent.gameObject.GetComponent <Image>().color = Color.white; this.gameObject.transform.parent.gameObject.SetActive(true); } }
/// <summary> /// 亭子女主说话 /// </summary> public void NvzhuTing(string str, System.Action callback = null) { GameTools.FadeUI(nvzhu.transform.GetChild(0).gameObject, false, 1f); Text text = nvzhu.transform.GetChild(0).GetComponentInChildren <Text>(); text.text = ""; text.DOText(str, 2.5f).SetEase(Ease.Linear).OnComplete(() => { //出现答题面板 if (callback != null) { callback.Invoke(); } }).SetDelay(0.5f); }
public void NvzhuTalk(string str, System.Action callBack = null) { if (talkTxt.transform.parent.gameObject.activeInHierarchy == false) { GameTools.FadeUI(talkTxt.transform.parent.gameObject, false, 1f); } talkTxt.text = ""; talkTxt.DOText(str, 4f).SetEase(Ease.Linear).OnComplete(() => { if (callBack != null) { callBack.Invoke(); } }).SetDelay(1f); }
private int sumDrag; //拖动诗的数量 /// <summary> /// 检查颜色是否赋予完毕 /// </summary> public void CheckColorEnd() { sumZhuanpan++; if (sumZhuanpan >= 3) { playerClick.enabled = false; zhuanpan.DOBlendableLocalRotateBy(Vector3.forward * 360, 3f, RotateMode.LocalAxisAdd).SetEase(Ease.InOutSine).OnComplete(() => { zhuanpan.GetChild(0).DOBlendableLocalMoveBy(Vector3.left * 0.3f, 1f); zhuanpan.GetChild(1).DOBlendableLocalMoveBy(Vector3.right * 0.3f, 1f); zhuanpan.GetChild(2).DOBlendableLocalMoveBy(Vector3.up * 0.3f, 1f); GameTools.FadeUI(voicePlane, false, 2f); }); } }
/// <summary> /// 显示面板 /// </summary> public void ShowPlane(GameObject showPlane) { this.gameObject.SetActive(true); GameTools.FadeUI(this.gameObject, false); GameTools.FadeUI(showPlane, false); int childCount = showPlane.transform.childCount; if (childCount > 0) { for (int i = 0; i < childCount; i++) { GameTools.FadeUI(showPlane.transform.GetChild(i).gameObject, false); } } }
/// <summary> /// 隐藏面板 /// </summary> public void HidePlane(GameObject hidePlane) { GameTools.FadeUI(hidePlane, true); GameTools.FadeUI(this.gameObject, true); int childCount = hidePlane.transform.childCount; if (childCount > 0) { for (int i = 0; i < childCount; i++) { GameTools.FadeUI(hidePlane.transform.GetChild(i).gameObject, true); } } }
/// <summary> /// 介绍玩法 /// </summary> private void StartIntroduce() { GameObject img1 = introducePlane.GetChild(0).gameObject; GameObject img2 = introducePlane.GetChild(1).gameObject; img1.gameObject.SetActive(true); img2.gameObject.SetActive(false); GameTools.WaitDoSomeThing(this, 3f, () => { GameTools.FadeUI(img1.gameObject, true, 0.8f, cleanCallback: () => { GameTools.FadeUI(img2.gameObject, false, 1f); GameTools.WaitDoSomeThing(this, 4f, () => GameTools.FadeUI(img2.gameObject, true, 1f)); }); }); }
/// <summary> /// 展示猜灯谜界面 /// </summary> public void SetPlaneState(bool isOpen) { if (isOpen) { this.enabled = true; if (isClick) { return; } GameTools.FadeUI(dengmiPlane.gameObject, false); isClick = true; } else { GameTools.FadeUI(dengmiPlane.gameObject, true, 1.5f); } }
public void ChuanMove() { PlayerController.isLock = true; player.SetPlayerDir(true); transform.DOLocalMoveX(-2.3f, 3f).SetEase(Ease.Linear).OnComplete(() => { player._PlayerState = PlayerState.Walk; player.transform.DOMoveX(-0.18f, 2f).SetEase(Ease.Linear).OnComplete(() => { OnChuanMove1.Invoke(); player._PlayerState = PlayerState.Idle; player.transform.SetParent(this.transform); transform.DOLocalMoveX(5.4f, 4f).SetEase(Ease.InOutSine).OnComplete(() => { GameTools.FadeUI(tipUI, false, 1.3f); }); }); }); }
/// <summary> /// 船移动到桥边 /// </summary> public void ChuanMove2() { GameTools.WaitDoSomeThing(this, 2.1f, () => { GameTools.FadeUI(tipUI, true, 1.3f); transform.DOLocalMoveX(17.5f, 4.5f).SetEase(Ease.InOutSine).OnComplete(() => { player.transform.SetParent(null); player._PlayerState = PlayerState.Walk; player.transform.DOBlendableLocalMoveBy(Vector3.right * 1.5f, 1f).SetEase(Ease.Linear).OnComplete(() => { player._PlayerState = PlayerState.Idle; PlayerController.isLock = false; }); }); }); if (OnChuanMove2 != null) { OnChuanMove2.Invoke(); } }
public void SetPlaneState(bool isOpen) { if (isOpen) { GameTools.FadeUI(this.gameObject, false, 1f); for (int i = 0; i < subjectList2.Count; i++) { subjectList2[i].SetActive(false); } int index = Random.Range(0, subjectList.Count); subjectList[index].SetActive(true); subjectList.RemoveAt(index); } else { GameTools.WaitDoSomeThing(this, 0.7f, () => { GameTools.FadeUI(this.gameObject, true, 0.8f); }); } }
/// <summary> /// 回答正确 /// </summary> public void AnswerOK() { GameTools.WaitDoSomeThing(this, 0.5f, () => { NvzhuTing("真的是你!!!! ", () => { GameTools.FadeUI(nvzhu.transform.GetChild(0).gameObject, true, 0.6f); GetComponent <AudioSource>().clip = changeBgm; GetComponent <AudioSource>().Play(); GameTools.WaitDoSomeThing(this, 2f, () => { Vector3[] waypoints = new[] { new Vector3(4.35f, -1.032007f, 0f), new Vector3(5.164424f, -0.04210535f, 0f), new Vector3(5.829236f, 0.5752205f, 0f), new Vector3(6.763138f, 1.12923f, 0f), new Vector3(7.950302f, 1.335005f, 0f), new Vector3(9.171f, 1.413819f, 0f), new Vector3(10.31902f, 1.256247f, 0f), new Vector3(11.46704f, 0.6934913f, 0f), new Vector3(12.06689f, 0.2795507f, 0f), new Vector3(12.67462f, 0.2455046f, 0f), new Vector3(13.01521f, 0.2813561f, 0f) }; Player.transform.DOPath(waypoints, 10, PathType.CatmullRom).SetEase(Ease.Linear); Player.transform.DOScale(Vector3.one * 0.312236f, 8.5f).SetEase(Ease.Linear).OnComplete(() => { Camera mainCamera = Camera.main; mainCamera.GetComponent <CameraFollow>().enabled = false; mainCamera.transform.DOMove(new Vector3(13.3f, 1.5f, -10), 4f).SetEase(Ease.OutQuad); mainCamera.DOOrthoSize(2f, 4f).SetEase(Ease.OutQuad); }); }); }); }); }
public void GuideEnd() { GameTools.FadeUI(this.gameObject, true, 1f); GameTools.FadeUI(promptImgs[index - 1].gameObject, true, 1f); }