/// <summary> /// 屏幕的淡出 /// </summary> public void ScreenToBlack(Util.NoParmsCallBack successCallback = null) { if (isAnimanating) { Debug.Log("a1"); return; } isAnimanating = true; if (t != null) { Debug.Log("a2"); t.Pause(); t = null; } Debug.Log("a3"); rawImage.enabled = true; t = DOTween.To(() => rawImage.color, x => rawImage.color = x, Color.black, floatColorChangeSpeed); t.OnComplete(() => { Debug.Log("a4"); rawImage.color = Color.black; isBlack = true; isAnimanating = false; successCallback?.Invoke(); }); }
/// <summary> /// 屏幕的淡入 /// </summary> public void ScreenToClear(Util.NoParmsCallBack successCallback = null) { if (isAnimanating) { Debug.Log("b1"); return; } isAnimanating = true; if (t != null) { Debug.Log("b2"); t.Pause(); t = null; } Debug.Log("b3"); t = DOTween.To(() => rawImage.color, x => rawImage.color = x, Color.clear, floatColorChangeSpeed); t.OnComplete(() => { Debug.Log("b4"); //设置为完全透明 rawImage.color = Color.clear; //组件的开关设置为关闭的状态 rawImage.enabled = false; isBlack = false; isAnimanating = false; successCallback?.Invoke(); }); }
public void RegisterSelectionCallback(int dialogId, int nextIndex, Util.NoParmsCallBack callback) { if (!dialogInfoDict.ContainsKey(dialogId)) { Debug.LogError("Don't Exist id : " + dialogId); return; } if (nextIndex >= dialogInfoDict[dialogId].nextDialogList.Count || nextIndex < 0) { Debug.LogError("nextIndex is invalid"); return; } if (!selectionCallbackDict.ContainsKey(dialogId)) { selectionCallbackDict[dialogId] = new Dictionary <int, Util.NoParmsCallBack>(); } selectionCallbackDict[dialogId][nextIndex] = callback; }
public void LoadLevel(int level, Util.NoParmsCallBack changeLevel = null) { Debug.Log("-=--==--==-=-=-=-=-=-"); Debug.Log("LoadLevel......."); GameController.manager.disableInput = true; screenFader.ScreenToBlack(() => { if (level != SceneManager.GetActiveScene().buildIndex) { // set GameController Pos Debug.Log(level); if (changeLevel != null) { changeLevel(); } SceneManager.LoadScene(level); } screenFader.ScreenToClear(() => { GameController.manager.disableInput = false; }); }); }