public void FadeOut(float tweenDelay, Action completeCallBack) { if ((!backGround) && (!guiPanel)) { completeCallBack?.Invoke(); return; } if (!initialised) { Initialize(); } if (winOptions == null) { winOptions = new WindowOpions(); } switch (winOptions.outAnim) { case WinAnimType.AlphaFade: AlphaFadeOut(tweenDelay, winOptions.outFadeAnim.time, winOptions.outEase, completeCallBack); break; case WinAnimType.Move: MoveOut(tweenDelay, winOptions.outMoveAnim.time, winOptions.outEase, completeCallBack); break; case WinAnimType.Scale: ScaleOut(tweenDelay, winOptions.outScaleAnim.time, winOptions.outEase, completeCallBack); break; } }
public void FadeIn(float tweenDelay, Action completeCallBack) { if ((!backGround) && (!guiPanel)) { if (completeCallBack != null) { completeCallBack(); } return; } if (!initialised) { Initialize(); } if (winOptions == null) { winOptions = new WindowOpions(); } if (guiMask) { guiMask.gameObject.SetActive(true); } if (guiPanel) { guiPanel.gameObject.SetActive(true); } if (backGround) { backGround.gameObject.SetActive(true); } switch (winOptions.inAnim) { case WinAnimType.AlphaFade: AlphaFadeIn(tweenDelay, winOptions.inFadeAnim.time, completeCallBack); break; case WinAnimType.Move: MoveIn(tweenDelay, winOptions.inMoveAnim.time, completeCallBack); break; case WinAnimType.Scale: ScaleIn(tweenDelay, winOptions.inScaleAnim.time, completeCallBack); break; } }
public override void OnInspectorGUI() { gF = (GuiFader_v2)target; wo = gF.winOptions; if (wo != null) { ShowPropertiesBox(new string[] { "backGround", "guiPanel", "guiMask" }, true); woSP = serializedObject.FindProperty("winOptions"); if (woSP != null) { BeginBox(); ShowProperties(new SerializedProperty[] { woSP.FindPropertyRelative("instantiatePosition") }, true); if (wo.instantiatePosition == Position.CustomPosition) { EditorGUI.indentLevel += 1; ShowProperties(new SerializedProperty[] { woSP.FindPropertyRelative("position"), // woSP.FindPropertyRelative("rectPosition") }, true); EditorGUI.indentLevel -= 1; } EditorGUILayout.Space(); EditorGUILayout.Space(); ShowProperties(new SerializedProperty[] { woSP.FindPropertyRelative("inAnim"), woSP.FindPropertyRelative("inEase") }, true); switch (wo.inAnim) { case WinAnimType.AlphaFade: ShowProperties(new SerializedProperty[] { woSP.FindPropertyRelative("inFadeAnim") }, true); break; case WinAnimType.Move: if (wo.inMoveAnim.toPosition == Position.CustomPosition) { ShowProperties(new SerializedProperty[] { woSP.FindPropertyRelative("inMoveAnim") }, true); } else { SerializedProperty inAnSP = woSP.FindPropertyRelative("inMoveAnim"); ShowProperties(new SerializedProperty[] { inAnSP.FindPropertyRelative("toPosition"), inAnSP.FindPropertyRelative("time"), }, true); } break; case WinAnimType.Scale: ShowProperties(new SerializedProperty[] { woSP.FindPropertyRelative("inScaleAnim") }, true); break; } EndBox(); EditorGUILayout.Space(); BeginBox(); ShowProperties(new SerializedProperty[] { woSP.FindPropertyRelative("outAnim"), woSP.FindPropertyRelative("outEase") }, true); switch (wo.outAnim) { case WinAnimType.AlphaFade: ShowProperties(new SerializedProperty[] { woSP.FindPropertyRelative("outFadeAnim") }, true); break; case WinAnimType.Move: if (wo.outMoveAnim.toPosition == Position.CustomPosition) { ShowProperties(new SerializedProperty[] { woSP.FindPropertyRelative("outMoveAnim") }, true); } else { SerializedProperty outAnSP = woSP.FindPropertyRelative("outMoveAnim"); ShowProperties(new SerializedProperty[] { outAnSP.FindPropertyRelative("toPosition"), outAnSP.FindPropertyRelative("time"), }, true); } break; case WinAnimType.Scale: ShowProperties(new SerializedProperty[] { woSP.FindPropertyRelative("outScaleAnim") }, true); break; } EndBox(); } } // DrawDefaultInspector(); serializedObject.ApplyModifiedProperties(); }
private PopUpsController CreateWindow(PopUpsController prefab, Transform parent, Vector3 position) { GameObject gP = (GameObject)Instantiate(prefab.gameObject, parent); RectTransform mainRT = gP.GetComponent <RectTransform>(); mainRT.SetParent(parent); WindowOpions winOptions = gP.GetComponent <GuiFader_v2>().winOptions; Vector3[] vC = new Vector3[4]; mainRT.GetWorldCorners(vC); RectTransform rt = gP.GetComponent <GuiFader_v2>().guiPanel; Vector3[] vC1 = new Vector3[4]; rt.GetWorldCorners(vC1); float height = (vC1[2] - vC1[0]).y; float width = (vC1[2] - vC1[0]).x; if (winOptions == null) { winOptions = new WindowOpions(); } winOptions.position = position; switch (winOptions.instantiatePosition) { case Position.LeftMiddleOut: rt.position = new Vector3(vC[0].x - width / 2f, (vC[0].y + vC[2].y) / 2f, rt.position.z); break; case Position.RightMiddleOut: rt.position = new Vector3(vC[2].x + width / 2f, (vC[0].y + vC[2].y) / 2f, rt.position.z); break; case Position.MiddleBottomOut: rt.position = new Vector3((vC[0].x + vC[2].x) / 2f, vC[0].y - height / 2f, rt.position.z); break; case Position.MiddleTopOut: rt.position = new Vector3((vC[0].x + vC[2].x) / 2f, vC[2].y + height / 2f, rt.position.z); break; case Position.LeftMiddleIn: rt.position = new Vector3(vC[0].x + width / 2f, (vC[0].y + vC[2].y) / 2f, rt.position.z); break; case Position.RightMiddleIn: rt.position = new Vector3(vC[2].x - width / 2f, (vC[0].y + vC[2].y) / 2f, rt.position.z); break; case Position.MiddleBottomIn: rt.position = new Vector3((vC[0].x + vC[2].x) / 2f, vC[0].y + height / 2f, rt.position.z); break; case Position.MiddleTopIn: rt.position = new Vector3((vC[0].x + vC[2].x) / 2f, vC[2].y - height / 2f, rt.position.z); break; case Position.CustomPosition: rt.position = winOptions.position; break; case Position.AsIs: break; case Position.Center: rt.position = new Vector3((vC[0].x + vC[2].x) / 2f, (vC[0].y + vC[2].y) / 2f, rt.position.z); break; } PopUpsController pUp = gP.GetComponent <PopUpsController>(); if (pUp) { pUp.SetControlActivity(false); } return(pUp); }