/// <summary> /// 初始化 /// </summary> void Awake() { // 获取动画播放对象 playAnim = gameObject.AddComponent <UIPlayAnimation>(); // 设置动画 playAnim.target = GetComponent <Animation>(); // 开始按钮 Transform start = transform.Find("Button - Start"); // 获取开始控制 对象 startButton = start.GetComponent <UIButton>(); // 获取开始按钮 文本对象 startLabel = start.Find("Label").GetComponent <UILocalize>(); // 重新开始按钮 restartButton = transform.Find("Button - ReStart").gameObject; // 背景 列表 backgroundList = transform.Find("Pop Up List - Background").GetComponent <UIPopupList>(); // 是否 显示原始图像 imageToggle = transform.Find("Check Box - Show Original Image").GetComponent <UIToggle>(); // 是否 旋转拼图 rotateToggle = transform.Find("Check Box - Rotate Piece").GetComponent <UIToggle>(); // 拼图个数 列表 countList = transform.Find("Pop Up List - Piece Count").GetComponent <UIPopupList>(); // 拼图图像 列表 imageList = transform.Find("Pop Up List - Piece Image").GetComponent <UIPopupList>(); // 拼图形状 列表 shapeList = transform.Find("Pop Up List - Piece Shape").GetComponent <UIPopupList>(); // 拼图风格 列表 styleList = transform.Find("Pop Up List - Piece Style").GetComponent <UIPopupList>(); // 是否显示所有拼图 按钮 showAllToggle = transform.Find("Toggle Button - Show All").GetComponent <UIToggle>(); // 平铺拼图 按钮 tileButton = transform.Find("Button - Tile Piece").GetComponent <UIButton>(); }
IEnumerator MoveDownAni() { if (myTransform.localScale.x < 0.625f && myTransform.localScale.x > 0.375f) { UIPlayAnimation pa = AdapterHost.GetComponent <UIPlayAnimation>(); pa.clipName = "ChapterItemMoveDown"; pa.playDirection = AnimationOrTween.Direction.Forward; pa.Play(true, false); } else if (myTransform.localScale.x < 0.875f && myTransform.localScale.x > 0.625f) { //yield return new WaitForSeconds(0.2f); UIPlayAnimation pa = AdapterHost.GetComponent <UIPlayAnimation>(); pa.clipName = "ChapterItemMoveDown"; pa.playDirection = AnimationOrTween.Direction.Forward; pa.Play(true, false); } else if (myTransform.localScale.x < 1.125f && myTransform.localScale.x > 0.875f) { yield return(new WaitForSeconds(0.3f)); UIPlayAnimation pa = AdapterHost.GetComponent <UIPlayAnimation>(); pa.clipName = "ChapterItemExpand"; pa.playDirection = AnimationOrTween.Direction.Forward; pa.Play(true, false); } yield return(null); }
/// <summary> /// 显示和隐藏某个主界面 /// </summary> protected void ShowSingleMain(string wndPrefab, bool _show) { GUIBase wnd = GameCenter.uIMng.GetGui <GUIBase>(wndPrefab); if (wnd != null) { UIPlayAnimation playAnimation = wnd.GetComponent <UIPlayAnimation>(); if (playAnimation != null) { bool nowState = !stateDic.ContainsKey(wnd.name)?true:stateDic[wnd.name]; //当前显示状态 if (_show == false && nowState == true) { playAnimation.PlayForward(); //此方向都是隐藏UI stateDic[wnd.name] = false; } if (_show == true && nowState == false) { playAnimation.PlayReverse(); //此方向都是显示UI stateDic[wnd.name] = true; } if (_show == true && nowState == true && !stateDic.ContainsKey(wnd.name)) //初始情况 { playAnimation.PlayReverse(); stateDic[wnd.name] = true; } } } }
IEnumerator CloseMoveUpAni() { //等待隐藏小动画完成 yield return(new WaitForSeconds(0.5f)); if (myTransform.localScale.x <= 0.625f && myTransform.localScale.x >= 0.375f) { UIPlayAnimation pa = AdapterHost.GetComponent <UIPlayAnimation>(); pa.clipName = "ChapterItemInitMoveDown0"; pa.playDirection = AnimationOrTween.Direction.Reverse; pa.Play(true, false); } else if (myTransform.localScale.x <= 0.875f && myTransform.localScale.x >= 0.625f) { UIPlayAnimation pa = AdapterHost.GetComponent <UIPlayAnimation>(); pa.clipName = "ChapterItemInitMoveDown0"; pa.playDirection = AnimationOrTween.Direction.Reverse; pa.Play(true, false); } else if (myTransform.localScale.x <= 1.125f && myTransform.localScale.x >= 0.875f) { UIPlayAnimation pa = AdapterHost.GetComponent <UIPlayAnimation>(); pa.clipName = "ChapterItemInitMoveDown0"; pa.playDirection = AnimationOrTween.Direction.Reverse; pa.Play(true, false); } yield return(null); }
private void Awake() { uian = GetComponent <UIPlayAnimation>(); uian.PlayForward(); uian.Play(false); uian.animator.speed = 0; }
static public int Play(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 2) { UIPlayAnimation self = (UIPlayAnimation)checkSelf(l); System.Boolean a1; checkType(l, 2, out a1); self.Play(a1); pushValue(l, true); return(1); } else if (argc == 3) { UIPlayAnimation self = (UIPlayAnimation)checkSelf(l); System.Boolean a1; checkType(l, 2, out a1); System.Boolean a2; checkType(l, 3, out a2); self.Play(a1, a2); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
IEnumerator coroutineClickOther(UIPlayAnimation go) { yield return(new WaitForSeconds(0.5F)); go.Play(true); StartCoroutine(coroutineCloseBonusMenuAnim()); }
public override void OnInspectorGUI() { NGUIEditorTools.SetLabelWidth(120f); UIPlayAnimation pa = target as UIPlayAnimation; GUILayout.Space(6f); GUI.changed = false; EditorGUI.BeginDisabledGroup(pa.target); Animator animator = (Animator)EditorGUILayout.ObjectField("Animator", pa.animator, typeof(Animator), true); EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(pa.animator); Animation anim = (Animation)EditorGUILayout.ObjectField("Animation", pa.target, typeof(Animation), true); EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(anim == null && animator == null); string clipName = EditorGUILayout.TextField("State Name", pa.clipName); AnimationOrTween.Trigger trigger = (AnimationOrTween.Trigger)EditorGUILayout.EnumPopup("Trigger condition", pa.trigger); EditorGUI.BeginDisabledGroup(animator != null && !string.IsNullOrEmpty(clipName)); AnimationOrTween.Direction dir = (AnimationOrTween.Direction)EditorGUILayout.EnumPopup("Play direction", pa.playDirection); EditorGUI.EndDisabledGroup(); SelectedObject so = pa.clearSelection ? SelectedObject.SetToNothing : SelectedObject.KeepCurrent; bool clear = (SelectedObject)EditorGUILayout.EnumPopup("Selected object", so) == SelectedObject.SetToNothing; AnimationOrTween.EnableCondition enab = (AnimationOrTween.EnableCondition)EditorGUILayout.EnumPopup("If disabled on start", pa.ifDisabledOnPlay); ResetOnPlay rs = pa.resetOnPlay ? ResetOnPlay.RestartAnimation : ResetOnPlay.ContinueFromCurrent; bool reset = (ResetOnPlay)EditorGUILayout.EnumPopup("On activation", rs) == ResetOnPlay.RestartAnimation; AnimationOrTween.DisableCondition dis = (AnimationOrTween.DisableCondition)EditorGUILayout.EnumPopup("When finished", pa.disableWhenFinished); EditorGUI.EndDisabledGroup(); if (GUI.changed) { NGUIEditorTools.RegisterUndo("PlayAnimation Change", pa); pa.target = anim; pa.animator = animator; pa.clipName = clipName; pa.trigger = trigger; pa.playDirection = dir; pa.clearSelection = clear; pa.ifDisabledOnPlay = enab; pa.resetOnPlay = reset; pa.disableWhenFinished = dis; NGUITools.SetDirty(pa); } NGUIEditorTools.SetLabelWidth(80f); NGUIEditorTools.DrawEvents("On Finished", pa, pa.onFinished); }
public override void Awake() { base.Awake(); dele = new EventDelegate(OnFinished); aniTrans = transform.GetChild(0); _ani = aniTrans.GetComponent <Animation>(); _play = aniTrans.GetComponent <UIPlayAnimation>(); _play.resetOnPlay = true; _play.onFinished.Add(dele); }
void Start() { _exitAnimComplete = new KHEvent(LevelSelectModel.CHAPTER_ITEM_PLAY_EXIT_ANIM_COMPLETE); if (uiPlayAni == null) { uiPlayAni = AdapterHost.GetComponent <UIPlayAnimation>(); } uiAA = uiPlayAni.GetComponent <ActiveAnimation> (); uiPlayAni.onFinished.Add(new EventDelegate(OnPaComplete)); lblNeedDonwload.bitmapFont = KHUIManager.Instance.FZYHJWFont; }
static public int get_ifDisabledOnPlay(IntPtr l) { try { UIPlayAnimation self = (UIPlayAnimation)checkSelf(l); pushValue(l, true); pushEnum(l, (int)self.ifDisabledOnPlay); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_playDirection(IntPtr l) { try { UIPlayAnimation self = (UIPlayAnimation)checkSelf(l); pushValue(l, true); pushEnum(l, (int)self.playDirection); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_disableWhenFinished(IntPtr l) { try { UIPlayAnimation self = (UIPlayAnimation)checkSelf(l); pushValue(l, true); pushEnum(l, (int)self.disableWhenFinished); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_animator(IntPtr l) { try { UIPlayAnimation self = (UIPlayAnimation)checkSelf(l); pushValue(l, true); pushValue(l, self.animator); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int PlayReverse(IntPtr l) { try { UIPlayAnimation self = (UIPlayAnimation)checkSelf(l); self.PlayReverse(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_playDirection(IntPtr l) { try { UIPlayAnimation self = (UIPlayAnimation)checkSelf(l); AnimationOrTween.Direction v; checkEnum(l, 2, out v); self.playDirection = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_clipName(IntPtr l) { try { UIPlayAnimation self = (UIPlayAnimation)checkSelf(l); System.String v; checkType(l, 2, out v); self.clipName = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_ifDisabledOnPlay(IntPtr l) { try { UIPlayAnimation self = (UIPlayAnimation)checkSelf(l); AnimationOrTween.EnableCondition v; checkEnum(l, 2, out v); self.ifDisabledOnPlay = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_clearSelection(IntPtr l) { try { UIPlayAnimation self = (UIPlayAnimation)checkSelf(l); System.Boolean v; checkType(l, 2, out v); self.clearSelection = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
private void OnFinished() { if (UIPlayAnimation.current == null) { UIPlayAnimation.current = this; EventDelegate.Execute(this.onFinished); if (this.eventReceiver != null && !string.IsNullOrEmpty(this.callWhenFinished)) { this.eventReceiver.SendMessage(this.callWhenFinished, SendMessageOptions.DontRequireReceiver); } this.eventReceiver = null; UIPlayAnimation.current = null; } }
static public int set_target(IntPtr l) { try { UIPlayAnimation self = (UIPlayAnimation)checkSelf(l); UnityEngine.Animation v; checkType(l, 2, out v); self.target = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
private void OnFinished() { if (current == null) { current = this; EventDelegate.Execute(onFinished); if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished)) { eventReceiver.SendMessage(callWhenFinished, SendMessageOptions.DontRequireReceiver); } eventReceiver = null; current = null; } }
static public int set_onFinished(IntPtr l) { try { UIPlayAnimation self = (UIPlayAnimation)checkSelf(l); System.Collections.Generic.List <EventDelegate> v; checkType(l, 2, out v); self.onFinished = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_disableWhenFinished(IntPtr l) { try { UIPlayAnimation self = (UIPlayAnimation)checkSelf(l); AnimationOrTween.DisableCondition v; checkEnum(l, 2, out v); self.disableWhenFinished = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
private void HideAllJuanzhou() { if (NGUITools.GetActive(juanzhou)) { UIPlayAnimation pa = AdapterHost.GetComponent <UIPlayAnimation>(); pa.clipName = string.Format("ChapterItemOnCenterAni{0}Exit", _resourceChapterId); pa.playDirection = AnimationOrTween.Direction.Forward; pa.Play(true, false); if (_isShowScrollEx) { scrollExComp.PlayExitAnim(); } } }
public static int get_disableWhenFinished(IntPtr l) { int result; try { UIPlayAnimation uIPlayAnimation = (UIPlayAnimation)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushEnum(l, (int)uIPlayAnimation.disableWhenFinished); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public void ShowMenu(bool show) { MainFightWnd wnd = GameCenter.uIMng.GetGui <MainFightWnd>(); if (wnd != null) { UIPlayAnimation playAnimation = wnd.GetComponent <UIPlayAnimation>(); if (show) { playAnimation.PlayReverse(); } else { playAnimation.PlayForward(); } } }
public void ShowMap(bool _showMap) { LittleMapWnd wnd = GameCenter.uIMng.GetGui <LittleMapWnd>(); if (wnd != null) { UIPlayAnimation playAnimation = wnd.GetComponent <UIPlayAnimation>(); if (_showMap) { playAnimation.PlayReverse(); } else { playAnimation.PlayForward(); } } }
public static int get_target(IntPtr l) { int result; try { UIPlayAnimation uIPlayAnimation = (UIPlayAnimation)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, uIPlayAnimation.target); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static void AddBtnAnimation(UIButton btn) { if (btn) { Animation ani = btn.gameObject.AddComponent <Animation>(); if (ani) { AnimationClip clip = GameObjectLoader.LoadResouce("UIAnimations/", "CurveButton") as AnimationClip; if (clip != null) { ani.AddClip(clip, clip.name); ani.clip = clip; } } UIPlayAnimation uip = btn.gameObject.AddComponent <UIPlayAnimation>(); } }
/// <summary> /// Callback triggered when each tween executed by this script finishes. /// </summary> void OnFinished () { if (current == null) { current = this; EventDelegate.Execute(onFinished); // Legacy functionality if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished)) eventReceiver.SendMessage(callWhenFinished, SendMessageOptions.DontRequireReceiver); eventReceiver = null; current = null; } }