public static Tweener ShowFromDir(Transform trans, UIAnimationType mUIShowStyle, TweenCallback callback) { if (mUIShowStyle == UIAnimationType.FromDown) { trans.localPosition = new Vector3(0, -1000, 0); trans.gameObject.SetActive(true); return(trans.DOLocalMove(Vector3.one, 1.5f).SetEase(Ease.InOutSine).SetAutoKill(false).OnComplete(callback)); } else if (mUIShowStyle == UIAnimationType.FromLeft) { trans.localPosition = new Vector3(-1000, 0, 0); trans.gameObject.SetActive(true); return(trans.DOLocalMove(Vector3.one, 1.5f).SetEase(Ease.InOutSine).SetAutoKill(false).OnComplete(callback)); } else if (mUIShowStyle == UIAnimationType.FromRight) { trans.localPosition = new Vector3(1000, 0, 0); trans.gameObject.SetActive(true); return(trans.DOLocalMove(Vector3.one, 1.5f).SetEase(Ease.InOutSine).SetAutoKill(false).OnComplete(callback)); } else { trans.localPosition = new Vector3(0, 1000, 0); trans.gameObject.SetActive(true); return(trans.DOLocalMove(Vector3.one, 1.5f).SetEase(Ease.InOutSine).SetAutoKill(false).OnComplete(callback)); } }
public string UIPath; //UI路径 public UIProperty(UIWindowStyle ws, UIWindowMode wm, UIColliderType wc, UIAnimationType ss, string path) { this.WindowStyle = ws; this.WindowMode = wm; this.ColliderType = wc; this.AnimationType = ss; this.UIPath = path; }
public AnimationOperation(GameObject target, UIAnimationType animationType, EaseType easeType, float startDelay, float animationDuration) { targetObject = target; type = animationType; easing = easeType; delay = startDelay; duration = animationDuration; }
/// <summary> /// 当座位胡牌时 /// </summary> private void OnSeatHu(TransferData data) { SeatEntity seat = data.GetValue <SeatEntity>("SeatEntity"); int subType = data.GetValue <int>("SubType"); UIAnimationType animationType = UIAnimationType.UIAnimation_ZiMo; if (subType == 1) { animationType = UIAnimationType.UIAnimation_Hu; } PlayUIAnimation(seat.Index, animationType); }
/// <summary> /// 播放UI动画 /// </summary> /// <param name="type"></param> public void PlayUIAnimation(UIAnimationType type) { string path = string.Format("download/{0}/prefab/uiprefab/uianimations/{1}.drb", ConstDefine.GAME_NAME, type.ToString().ToLower()); AssetBundleManager.Instance.LoadOrDownload(path, type.ToString().ToLower(), (GameObject go) => { if (go != null) { go = Instantiate(go); go.SetParent(m_EffectContainer); } }); }
void RestoreState(UIAnimationType _type) { switch (_type) { case UIAnimationType.Rotate: startRotate = false; targetImage.transform.eulerAngles = originVector; break; case UIAnimationType.Scale: targetImage.transform.localScale = originVector; break; case UIAnimationType.Color: targetImage.color = originColor; break; case UIAnimationType.Alpha: targetImage.color = originColor; break; } }
public static Tweener TryAddUITween(this Transform trans, UIAnimationType mUIShowStyle, TweenCallback callback = null) { if (mUIShowStyle == UIAnimationType.CenterToBig) { return(CUITweener.ShowCenterToBig(trans, callback)); } else if (mUIShowStyle == UIAnimationType.FromDown || mUIShowStyle == UIAnimationType.FromLeft || mUIShowStyle == UIAnimationType.FromRight || mUIShowStyle == UIAnimationType.FromTop) { return(CUITweener.ShowFromDir(trans, mUIShowStyle, callback)); } else { return(null); } }
public AnimationOperation(AnimationOperation animationOperation) { targetObject = animationOperation.targetObject; type = animationOperation.type; easing = animationOperation.easing; delay = animationOperation.delay; duration = animationOperation.duration; activate = animationOperation.activate; scaleSettings = animationOperation.scaleSettings; rotateSettings = animationOperation.rotateSettings; worldPositionSettings = animationOperation.worldPositionSettings; anchoredPositionSettings = animationOperation.anchoredPositionSettings; colourSettings = animationOperation.colourSettings; fadeSettings = animationOperation.fadeSettings; }
public void SetStatus(int _id) { UIAnimationType _type = buttonStates[buttonID].animType; if (_id == buttonID) { _type = UIAnimationType.None; } if (_id > -1 && _id < buttonStates.Length) { buttonID = _id; RestoreState(_type); targetImage.sprite = buttonStates[_id].sprite; if (buttonStates[_id].animType != UIAnimationType.Color) { targetImage.color = buttonStates[_id].color; } bgImage.color = buttonStates[_id].bgcolor; switch (buttonStates[_id].animType) { case UIAnimationType.Rotate: originVector = targetImage.transform.eulerAngles; _count = (int)((buttonStates[_id].animationTime / Time.fixedDeltaTime) / 36); _passFrame = 0; startRotate = true; //LeanTween.rotateZ(targetImage.gameObject, 180, buttonStates[_id].animationTime).setLoopType(LeanTweenType.punch); break; case UIAnimationType.Alpha: originColor = targetImage.color; LeanTween.alpha(targetImage.GetComponent <RectTransform>(), 0, buttonStates[_id].animationTime).setLoopPingPong(); break; case UIAnimationType.Color: originColor = targetImage.color; LeanTween.color(targetImage.GetComponent <RectTransform>(), buttonStates[_id].color, buttonStates[_id].animationTime).setLoopPingPong(); break; case UIAnimationType.Scale: originVector = targetImage.transform.localScale; LeanTween.scale(targetImage.gameObject, new Vector3(0.7f, 0.7f, 1), buttonStates[_id].animationTime).setLoopPingPong(); break; case UIAnimationType.None: LeanTween.cancel(targetImage.gameObject); break; } } }
public MenuSheet(GameObject menu, UIAnimationType AnimType) { switch (AnimType) { case UIAnimationType.Move: break; case UIAnimationType.Fade_in: break; case UIAnimationType.Pop: break; default: break; } }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { SerializedProperty typeProperty = property.FindPropertyRelative("type"); SerializedProperty easeProperty = property.FindPropertyRelative("easing"); UIAnimationType selectedAnimationType = (UIAnimationType)typeProperty.enumValueIndex; EaseType easeType = (EaseType)easeProperty.enumValueIndex; int typeLinesToAdd = selectedAnimationType switch { UIAnimationType.Activate => 0, UIAnimationType.Scale => 2, UIAnimationType.Rotate => 2, UIAnimationType.WorldPosition => 2, UIAnimationType.AnchoredPosition => 4, UIAnimationType.Colour => 2, UIAnimationType.Fade => 2, _ => 0 }; if (selectedAnimationType != UIAnimationType.Colour && selectedAnimationType != UIAnimationType.Fade && easeType != EaseType.None && EditorGUIUtility.currentViewWidth < 345f) { typeLinesToAdd *= 2; } if (easeType == EaseType.None && EditorGUIUtility.currentViewWidth >= 345f) { typeLinesToAdd /= 2; } if ((selectedAnimationType == UIAnimationType.Colour || selectedAnimationType == UIAnimationType.Fade) && easeType == EaseType.None && EditorGUIUtility.currentViewWidth < 345f) { typeLinesToAdd = 1; } return((EditorGUIUtility.singleLineHeight + LineSpacing) * (BaseLineCount + typeLinesToAdd)); } }
/// <summary> /// 播放UI动画 /// </summary> /// <param name="type"></param> public void PlayUIAnimation(UIAnimationType type) { PlayUIAnimation(type.ToString()); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { SerializedProperty typeProperty = property.FindPropertyRelative("type"); UIAnimationType selectedAnimationType = (UIAnimationType)typeProperty.enumValueIndex; SerializedProperty easingProperty = property.FindPropertyRelative("easing"); EaseType easingType = (EaseType)easingProperty.enumValueIndex; EditorGUI.BeginProperty(position, label, property); float defaultLabelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Utility.GetStringDimensions("Element ___", 5f).x; position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label, EditorStyles.boldLabel); float xOffset = Utility.GetStringDimensions("Element ___", 7f).x; position.x -= xOffset; position.width += xOffset; position.y += EditorGUIUtility.singleLineHeight + LineSpacing; EditorGUIUtility.labelWidth = Utility.GetStringDimensions("Target Object", 5f).x; Rect targetObjectsRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); EditorGUI.PropertyField(targetObjectsRect, property.FindPropertyRelative("targetObject")); position.y += EditorGUIUtility.singleLineHeight + LineSpacing; Rect typeRect; if (selectedAnimationType != UIAnimationType.Activate) { typeRect = new Rect(position.x, position.y, position.width / 2 - 4f, EditorGUIUtility.singleLineHeight); } else { typeRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); } Rect easingRect = new Rect(position.x + position.width / 2 + 4f, position.y, position.width / 2 - 4f, EditorGUIUtility.singleLineHeight); position.y += EditorGUIUtility.singleLineHeight + LineSpacing; Rect delayRect = new Rect(position.x, position.y, position.width / 2 - 4f, EditorGUIUtility.singleLineHeight); Rect durationRect = new Rect(position.x + position.width / 2 + 4f, position.y, position.width / 2 - 4f, EditorGUIUtility.singleLineHeight); EditorGUI.PropertyField(typeRect, property.FindPropertyRelative("type"), GUIContent.none); if (selectedAnimationType != UIAnimationType.Activate) { EditorGUI.PropertyField(easingRect, property.FindPropertyRelative("easing"), GUIContent.none); } EditorGUIUtility.labelWidth = Utility.GetStringDimensions("Delay", 5f).x; EditorGUI.PropertyField(delayRect, property.FindPropertyRelative("delay")); if (selectedAnimationType != UIAnimationType.Activate && easingType != EaseType.None) { EditorGUIUtility.labelWidth = Utility.GetStringDimensions("Duration", 5f).x; EditorGUI.PropertyField(durationRect, property.FindPropertyRelative("duration")); } position.y += EditorGUIUtility.singleLineHeight + LineSpacing; switch (selectedAnimationType) { case UIAnimationType.Activate: position.y -= EditorGUIUtility.singleLineHeight + LineSpacing; Rect activateRect = new Rect(position.x + position.width / 2 + 4f, position.y, position.width / 2, EditorGUIUtility.singleLineHeight); EditorGUIUtility.labelWidth = Utility.GetStringDimensions("Activate", 5f).x; EditorGUI.PropertyField(activateRect, property.FindPropertyRelative("activate")); break; case UIAnimationType.Scale: Rect startScaleRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); position.y += EditorGUIUtility.singleLineHeight + LineSpacing; if (EditorGUIUtility.currentViewWidth < 345f) { position.y += EditorGUIUtility.singleLineHeight + LineSpacing; } Rect targetScaleRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); EditorGUIUtility.labelWidth = Utility.GetStringDimensions("Target Scale", 5f).x; if (easingType != EaseType.None) { EditorGUI.PropertyField(startScaleRect, property.FindPropertyRelative("scaleSettings").FindPropertyRelative("startScale")); EditorGUI.PropertyField(targetScaleRect, property.FindPropertyRelative("scaleSettings").FindPropertyRelative("targetScale")); } else { EditorGUI.PropertyField(startScaleRect, property.FindPropertyRelative("scaleSettings").FindPropertyRelative("targetScale")); } break; case UIAnimationType.Rotate: Rect startRotationRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); position.y += EditorGUIUtility.singleLineHeight + LineSpacing; if (EditorGUIUtility.currentViewWidth < 345f) { position.y += EditorGUIUtility.singleLineHeight + LineSpacing; } Rect targetRotationRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); EditorGUIUtility.labelWidth = Utility.GetStringDimensions("Target Euler", 5f).x; if (easingType != EaseType.None) { EditorGUI.PropertyField(startRotationRect, property.FindPropertyRelative("rotateSettings").FindPropertyRelative("startEuler")); EditorGUI.PropertyField(targetRotationRect, property.FindPropertyRelative("rotateSettings").FindPropertyRelative("targetEuler")); } else { EditorGUI.PropertyField(startRotationRect, property.FindPropertyRelative("rotateSettings").FindPropertyRelative("targetEuler")); } break; case UIAnimationType.WorldPosition: Rect startPositionRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); position.y += EditorGUIUtility.singleLineHeight + LineSpacing; if (EditorGUIUtility.currentViewWidth < 345f) { position.y += EditorGUIUtility.singleLineHeight + LineSpacing; } Rect targetPositionRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); EditorGUIUtility.labelWidth = Utility.GetStringDimensions("Target Position", 5f).x; if (easingType != EaseType.None) { EditorGUI.PropertyField(startPositionRect, property.FindPropertyRelative("worldPositionSettings").FindPropertyRelative("startPosition")); EditorGUI.PropertyField(targetPositionRect, property.FindPropertyRelative("worldPositionSettings").FindPropertyRelative("targetPosition")); } else { EditorGUI.PropertyField(startPositionRect, property.FindPropertyRelative("worldPositionSettings").FindPropertyRelative("targetPosition")); } break; case UIAnimationType.AnchoredPosition: Rect startMinRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); position.y += EditorGUIUtility.singleLineHeight + LineSpacing; if (EditorGUIUtility.currentViewWidth < 345f) { position.y += EditorGUIUtility.singleLineHeight + LineSpacing; } Rect targetMinRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); position.y += EditorGUIUtility.singleLineHeight + LineSpacing; if (EditorGUIUtility.currentViewWidth < 345f) { position.y += EditorGUIUtility.singleLineHeight + LineSpacing; } Rect startMaxRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); position.y += EditorGUIUtility.singleLineHeight + LineSpacing; if (EditorGUIUtility.currentViewWidth < 345f) { position.y += EditorGUIUtility.singleLineHeight + LineSpacing; } Rect targetMaxRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); EditorGUIUtility.labelWidth = Utility.GetStringDimensions("Target Max", 5f).x; if (easingType != EaseType.None) { EditorGUI.PropertyField(startMinRect, property.FindPropertyRelative("anchoredPositionSettings").FindPropertyRelative("startMin")); EditorGUI.PropertyField(targetMinRect, property.FindPropertyRelative("anchoredPositionSettings").FindPropertyRelative("targetMin")); EditorGUI.PropertyField(startMaxRect, property.FindPropertyRelative("anchoredPositionSettings").FindPropertyRelative("startMax")); EditorGUI.PropertyField(targetMaxRect, property.FindPropertyRelative("anchoredPositionSettings").FindPropertyRelative("targetMax")); } else { EditorGUI.PropertyField(startMinRect, property.FindPropertyRelative("anchoredPositionSettings").FindPropertyRelative("targetMin")); EditorGUI.PropertyField(targetMinRect, property.FindPropertyRelative("anchoredPositionSettings").FindPropertyRelative("targetMax")); } break; case UIAnimationType.Colour: Rect startColourRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); position.y += EditorGUIUtility.singleLineHeight + LineSpacing; Rect targetColourRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); EditorGUIUtility.labelWidth = Utility.GetStringDimensions("Target Colour", 5f).x; if (easingType != EaseType.None) { EditorGUI.PropertyField(startColourRect, property.FindPropertyRelative("colourSettings").FindPropertyRelative("startColour")); EditorGUI.PropertyField(targetColourRect, property.FindPropertyRelative("colourSettings").FindPropertyRelative("targetColour")); } else { EditorGUI.PropertyField(startColourRect, property.FindPropertyRelative("colourSettings").FindPropertyRelative("targetColour")); } break; case UIAnimationType.Fade: Rect startFadeRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); position.y += EditorGUIUtility.singleLineHeight + LineSpacing; Rect targetFadeRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); EditorGUIUtility.labelWidth = Utility.GetStringDimensions("Target Fade", 5f).x; if (easingType != EaseType.None) { EditorGUI.PropertyField(startFadeRect, property.FindPropertyRelative("fadeSettings").FindPropertyRelative("startAlpha")); EditorGUI.PropertyField(targetFadeRect, property.FindPropertyRelative("fadeSettings").FindPropertyRelative("targetAlpha")); } else { EditorGUI.PropertyField(startFadeRect, property.FindPropertyRelative("fadeSettings").FindPropertyRelative("targetAlpha")); } break; } EditorGUIUtility.labelWidth = defaultLabelWidth; EditorGUI.EndProperty(); }
public void Play(UIAnimationType animationType, bool resetToSavedProperties = false, Action callback = null) { Play(GetAnimation(animationType), resetToSavedProperties, callback); }
/// <summary> /// 播放UI动画(座位) /// </summary> /// <param name="seatIndex"></param> /// <param name="type"></param> public void PlayUIAnimation(int seatIndex, UIAnimationType type) { m_Seats[seatIndex].PlayUIAnimation(type); }
public bool HasAnimation(UIAnimationType animationType) { return(_animations.Any(typedAnimation => typedAnimation.type == animationType)); }
/// <summary> /// 当座位碰牌时 /// </summary> /// <param name="data"></param> private void OnSeatOperate(TransferData data) { int seatIndex = data.GetValue <int>("SeatIndex"); OperatorType type = data.GetValue <OperatorType>("OperateType"); int subType = data.GetValue <int>("SubType"); UIAnimationType animationType = UIAnimationType.UIAnimation_Gang; switch (type) { case OperatorType.Chi: animationType = UIAnimationType.UIAnimation_Chi; break; case OperatorType.Peng: animationType = UIAnimationType.UIAnimation_Peng; break; case OperatorType.Gang: animationType = UIAnimationType.UIAnimation_Gang; break; case OperatorType.Hu: if (subType == 1) { animationType = UIAnimationType.UIAnimation_Hu; } else { animationType = UIAnimationType.UIAnimation_ZiMo; } break; case OperatorType.BuHua: animationType = UIAnimationType.UIAnimation_BuHua; break; case OperatorType.ChiTing: animationType = UIAnimationType.UIAnimation_ChiTing; break; case OperatorType.PengTing: animationType = UIAnimationType.UIAnimation_PengTing; break; case OperatorType.LiangXi: animationType = UIAnimationType.UIAnimation_LiangXi; break; case OperatorType.DingZhang: animationType = UIAnimationType.UIAnimation_DingZhang; break; case OperatorType.PiaoTing: animationType = UIAnimationType.UIAnimation_PiaoTing; break; case OperatorType.DingJiang: animationType = UIAnimationType.UIAnimation_DingJiang; break; case OperatorType.Kou: animationType = UIAnimationType.UIAnimation_Kou; break; case OperatorType.BuXi: animationType = UIAnimationType.UIAnimation_BuXi; break; case OperatorType.Jiao: animationType = UIAnimationType.UIAnimation_Jiao; break; } PlayUIAnimation(seatIndex, animationType); }
public void Init(UIAnimationType anim, bool resetDialogTransitionStatus, bool dequeueDialog) { type = anim; isResetDialogTransitionStatus = resetDialogTransitionStatus; isDequeueDialog = dequeueDialog; }
public UIAnimation GetAnimation(UIAnimationType type) { return(_animations.FirstOrDefault(typedAnimation => typedAnimation.type == type)?.animation); }