public void Open(Action on_finished) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit(root)) { state = STATE.OPENED; } else { if (closeTween.get_enabled()) { closeTween.SetOnFinished((EventDelegate)null); closeTween.SetStartToCurrentValue(); closeTween.ResetToBeginning(); closeTween.set_enabled(false); } if (!openTween.get_gameObject().get_activeSelf()) { openTween.get_gameObject().SetActive(true); } state = STATE.OPENING; openTween.set_enabled(true); openTween.SetStartToCurrentValue(); openTween.ResetToBeginning(); openTween.SetOnFinished(delegate { state = STATE.OPENED; OnPostOpen(); on_finished(); }); openTween.PlayForward(); } }
static int SetOnFinished(IntPtr L) { int count = LuaDLL.lua_gettop(L); Type[] types0 = { typeof(UITweener), typeof(EventDelegate) }; Type[] types1 = { typeof(UITweener), typeof(EventDelegate.Callback) }; if (count == 2 && LuaScriptMgr.CheckTypes(L, types0, 1)) { UITweener obj = LuaScriptMgr.GetNetObject <UITweener>(L, 1); EventDelegate arg0 = LuaScriptMgr.GetNetObject <EventDelegate>(L, 2); obj.SetOnFinished(arg0); return(0); } else if (count == 2 && LuaScriptMgr.CheckTypes(L, types1, 1)) { UITweener obj = LuaScriptMgr.GetNetObject <UITweener>(L, 1); EventDelegate.Callback arg0 = LuaScriptMgr.GetNetObject <EventDelegate.Callback>(L, 2); obj.SetOnFinished(arg0); return(0); } else { LuaDLL.luaL_error(L, "invalid arguments to method: UITweener.SetOnFinished"); } return(0); }
public void Switch(bool to2D, System.Action callback) { if (bIsChanging || !viewSwitcher.CanChange || to2D == CurrentIs2D) { return; } bIsChanging = true; viewSwitcher.ChangeProjection = true; Vector3 vec = to2D ? tsf2DPos.position : tsf3DPos.position; vec.y = to2D ? f2DPos_Y : f3DPos_Y; UITweener tween = TweenPosition.Begin(gameObject, viewSwitcher.ProjectionChangeTime - 0.25f, vec, true); tween.animationCurve = to2D ? curveTo2D : curveTo3D; tween.SetOnFinished(() => { bIsTweenRotation = true; Vector3 vec2 = to2D ? tsf2DPos.position : tsf3DPos.position; vec.y = to2D ? f2DPos_Y : f3DPos_Y; TweenPosition.Begin(gameObject, 0.3f, vec, true); TweenRotation.Begin(gameObject, 0.3f, to2D ? tsf2DPos.rotation : tsf3DPos.rotation, true).SetOnFinished(() => { bIsTweenRotation = bIsChanging = false; if (callback != null) { callback(); } }); }); }
private static int SetOnFinished(IntPtr L) { int num = LuaDLL.lua_gettop(L); if (num == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(UITweener), typeof(EventDelegate))) { UITweener uITweener = (UITweener)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UITweener"); EventDelegate onFinished = (EventDelegate)LuaScriptMgr.GetLuaObject(L, 2); uITweener.SetOnFinished(onFinished); return(0); } if (num == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(UITweener), typeof(EventDelegate.Callback))) { UITweener uITweener2 = (UITweener)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UITweener"); LuaTypes luaTypes = LuaDLL.lua_type(L, 2); EventDelegate.Callback onFinished2; if (luaTypes != LuaTypes.LUA_TFUNCTION) { onFinished2 = (EventDelegate.Callback)LuaScriptMgr.GetLuaObject(L, 2); } else { LuaFunction func = LuaScriptMgr.GetLuaFunction(L, 2); onFinished2 = delegate { func.Call(); }; } uITweener2.SetOnFinished(onFinished2); return(0); } LuaDLL.luaL_error(L, "invalid arguments to method: UITweener.SetOnFinished"); return(0); }
static int SetOnFinished(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes <EventDelegate>(L, 2)) { UITweener obj = (UITweener)ToLua.CheckObject <UITweener>(L, 1); EventDelegate arg0 = (EventDelegate)ToLua.ToObject(L, 2); obj.SetOnFinished(arg0); return(0); } else if (count == 2 && TypeChecker.CheckTypes <EventDelegate.Callback>(L, 2)) { UITweener obj = (UITweener)ToLua.CheckObject <UITweener>(L, 1); EventDelegate.Callback arg0 = (EventDelegate.Callback)ToLua.ToObject(L, 2); obj.SetOnFinished(arg0); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UITweener.SetOnFinished")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int SetOnFinished(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (matchType(l, argc, 2, typeof(EventDelegate))) { UITweener self = (UITweener)checkSelf(l); EventDelegate a1; checkType(l, 2, out a1); self.SetOnFinished(a1); pushValue(l, true); return(1); } else if (matchType(l, argc, 2, typeof(EventDelegate.Callback))) { UITweener self = (UITweener)checkSelf(l); EventDelegate.Callback a1; LuaDelegation.checkDelegate(l, 2, out a1); self.SetOnFinished(a1); 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)); } }
private bool PlayTweener(bool forward) { if (Target != null) { GlobalUtils.ChangeParent(Target.transform, transform); } var tweeners = GetComponents <UITweener>(); UITweener lastTweener = null; float lastUseTime = 0; foreach (var tweener in tweeners) { tweener.ResetToBeginning(); tweener.Play(forward); var curUseTime = tweener.duration + tweener.delay; if (curUseTime > lastUseTime) { lastTweener = tweener; lastUseTime = curUseTime; } } if (lastTweener != null && FinishCallBack != null) { lastTweener.SetOnFinished(CallBack); return(false); } return(true); }
private void Awake() { _positionTweener = _label.GetComponentInChildren <TweenPosition>(); _alphaTweener = _label.GetComponentInChildren <TweenAlpha>(); _positionTweener.SetOnFinished(new EventDelegate(this, "OnFinished_Position")); _alphaTweener.SetOnFinished(new EventDelegate(this, "OnFinished_Alpha")); }
public void SetDestination(Vector3 destination) { if (SuperGameManager.Instance.autoLocate) { //如果出于自动定位模式 //TargetSpawnController.instance.SpawnTarget(m_transform, UICamera.lastWorldPosition);//最新的关注点!!!!!!!!!!!!!!!!!!!!!!! UITweener tween1 = TweenPosition.Begin(gameObject, 0.7f, destination); tween1.method = UITweener.Method.EaseOut; tween1.SetOnFinished(SuperGameManager.Instance.ControlRegionTwo); SuperGameManager.Instance.ControlRegion(); //这个就是关键 } }
public PlayerInfoVisualizer(Player owner) { m_owner = owner; m_bWithBall = owner.m_bWithBall; m_timerHideName = new GameUtils.Timer4View(4f, OnTimerHideName, 1); if (m_resPlayerInfo == null) { m_resPlayerInfo = ResourceLoadManager.Instance.LoadPrefab("prefab/indicator/playerInfo"); } m_goPlayerInfo = GameObject.Instantiate(m_resPlayerInfo) as GameObject; m_uiName = GameUtils.FindChildRecursive(m_goPlayerInfo.transform, "Name").GetComponentInChildren <UILabel>(); m_nameFadeAway = m_uiName.GetComponent <UITweener>(); m_nameFadeAway.SetOnFinished(OnNameFadeAwayFinished); m_uiName.fontSize = 25; m_uiName.text = owner.m_name; //if( owner.m_team != null ) // m_uiName.color = owner.m_team.m_side == Team.Side.eHome ? Color.red : Color.green; m_uiPosition = GameUtils.FindChildRecursive(m_goPlayerInfo.transform, "Position").GetComponentInChildren <UISprite>(); m_oriPositionPos = m_uiPosition.transform.localPosition; m_uiPosition.spriteName = owner.m_position.ToString(); OnNameFadeAwayFinished(); GameUtils.SetLayerRecursive(m_goPlayerInfo.transform, LayerMask.NameToLayer("GUI")); m_goState = new GameObject(owner.m_id + "_state"); m_goState.layer = LayerMask.NameToLayer("GUI"); GameObject state = new GameObject("sprite"); state.layer = LayerMask.NameToLayer("GUI"); state.transform.parent = m_goState.transform; state.transform.localPosition = Vector3.zero; state.transform.localScale = Vector3.one; m_uiState = NGUITools.AddSprite(state, m_uiPosition.atlas, "none"); m_uiState.MakePixelPerfect(); m_uiState.gameObject.transform.localScale = Vector3.one * 0.3f; m_uiStaminaBar = GameUtils.FindChildRecursive(m_goPlayerInfo.transform, "StaminaBar").GetComponent <UIStaminaBar>(); if (m_uiStaminaBar != null) { m_uiStaminaBar.m_attachedPlayer = m_owner; m_uiStaminaBar.gameObject.SetActive(false); } CreateStrengthBar(); ShowStrengthBar(false); }
public static IEnumerator tweenRun(UITweener tp) { bool fin = false; tp.SetOnFinished(delegate() { fin = true; }); tp.ResetToBeginning(); tp.enabled = true; while (!fin) { yield return(null); } }
static int _m_SetOnFinished(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UITweener __cl_gen_to_be_invoked = (UITweener)translator.FastGetCSObj(L, 1); int __gen_param_count = LuaAPI.lua_gettop(L); try { if (__gen_param_count == 2 && translator.Assignable <EventDelegate.Callback>(L, 2)) { EventDelegate.Callback del = translator.GetDelegate <EventDelegate.Callback>(L, 2); __cl_gen_to_be_invoked.SetOnFinished(del); return(0); } if (__gen_param_count == 2 && translator.Assignable <EventDelegate>(L, 2)) { EventDelegate del = (EventDelegate)translator.GetObject(L, 2, typeof(EventDelegate)); __cl_gen_to_be_invoked.SetOnFinished(del); return(0); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UITweener.SetOnFinished!")); }
public static void PlayTween(GameObject go, bool isForward, LuaFunction luafunc, bool isRestart) { if (go == null) { return; } UIPlayTween component = go.GetComponent <UIPlayTween>(); if (component != null) { component.SetOnFinished(delegate { if (luafunc != null) { luafunc.Call(); luafunc.Dispose(); luafunc = null; } }); component.Play(isForward); } else { UITweener component2 = go.GetComponent <UITweener>(); if (component2 != null) { component2.SetOnFinished(delegate { if (luafunc != null) { luafunc.Call(); luafunc.Dispose(); luafunc = null; } }); if (isRestart) { component2.ResetToBeginning(); } component2.Play(isForward); } else if (luafunc != null) { luafunc.Call(); luafunc.Dispose(); luafunc = null; } } }
IEnumerator PlayBrokenSprite(bool isFire) { if (isFire) { yield return(new WaitForSeconds(BrokenSpriteDelayShowTime)); } BrokenGO.SetActive(true); yield return(new WaitForSeconds(BrokenStayTime)); UITweener uit = BrokenGO.GetComponent <UITweener>(); uit.ResetToBeginning(); uit.PlayForward(); uit.SetOnFinished(delegate() { Object.Destroy(mDMono.gameObject); }); }
void Awake() { widget = transform.FindChild("Widget").GetComponent <UIWidget>(); background = widget.transform.FindChild("Background").GetComponent <UISprite>(); iconTransform = widget.transform.FindChild("Icon"); name = widget.transform.FindChild("NameBar/Name").GetComponent <UILabel>(); title = widget.transform.FindChild("Title").GetComponent <UILabel>(); intro = widget.transform.FindChild("Intro").GetComponent <UILabel>(); glow = widget.transform.FindChild("Glow").gameObject; tail = widget.transform.FindChild("Tail").GetComponent <UITweener>(); UITweener[] tweens = widget.GetComponents <UITweener>(); slideIn = tweens[0]; moveUp = tweens[1]; fadeAway = tweens[2]; slideIn.SetOnFinished(() => { fadeAway.enabled = true; }); moveUp.SetOnFinished(() => { fadeAway.enabled = true; }); fadeAway.SetOnFinished(() => { NGUITools.Destroy(gameObject); }); icon = CommonFunction.InstantiateObject("Prefab/GUI/CareerRoleIcon", iconTransform); }
private static int SetOnFinished(IntPtr L) { int result; try { int num = LuaDLL.lua_gettop(L); if (num == 2 && TypeChecker.CheckTypes(L, 1, typeof(UITweener), typeof(EventDelegate))) { UITweener uITweener = (UITweener)ToLua.ToObject(L, 1); EventDelegate onFinished = (EventDelegate)ToLua.ToObject(L, 2); uITweener.SetOnFinished(onFinished); result = 0; } else if (num == 2 && TypeChecker.CheckTypes(L, 1, typeof(UITweener), typeof(EventDelegate.Callback))) { UITweener uITweener2 = (UITweener)ToLua.ToObject(L, 1); LuaTypes luaTypes = LuaDLL.lua_type(L, 2); EventDelegate.Callback onFinished2; if (luaTypes != LuaTypes.LUA_TFUNCTION) { onFinished2 = (EventDelegate.Callback)ToLua.ToObject(L, 2); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); onFinished2 = (DelegateFactory.CreateDelegate(typeof(EventDelegate.Callback), func) as EventDelegate.Callback); } uITweener2.SetOnFinished(onFinished2); result = 0; } else { result = LuaDLL.luaL_throw(L, "invalid arguments to method: UITweener.SetOnFinished"); } } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
static int SetOnFinished(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UITweener), typeof(EventDelegate))) { UITweener obj = (UITweener)ToLua.ToObject(L, 1); EventDelegate arg0 = (EventDelegate)ToLua.ToObject(L, 2); obj.SetOnFinished(arg0); return(0); } else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UITweener), typeof(EventDelegate.Callback))) { UITweener obj = (UITweener)ToLua.ToObject(L, 1); EventDelegate.Callback arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (EventDelegate.Callback)ToLua.ToObject(L, 2); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); arg0 = DelegateFactory.CreateDelegate(typeof(EventDelegate.Callback), func) as EventDelegate.Callback; } obj.SetOnFinished(arg0); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UITweener.SetOnFinished")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int SetOnFinished(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(UITweener), typeof(EventDelegate))) { UITweener obj = (UITweener)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UITweener"); EventDelegate arg0 = (EventDelegate)LuaScriptMgr.GetLuaObject(L, 2); obj.SetOnFinished(arg0); return(0); } else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(UITweener), typeof(EventDelegate.Callback))) { UITweener obj = (UITweener)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UITweener"); EventDelegate.Callback arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (EventDelegate.Callback)LuaScriptMgr.GetLuaObject(L, 2); } else { LuaFunction func = LuaScriptMgr.GetLuaFunction(L, 2); arg0 = () => { func.Call(); }; } obj.SetOnFinished(arg0); return(0); } else { LuaDLL.luaL_error(L, "invalid arguments to method: UITweener.SetOnFinished"); } return(0); }
public static int SetOnFinished(IntPtr l) { int result; try { int total = LuaDLL.pua_gettop(l); if (LuaObject.matchType(l, total, 2, typeof(EventDelegate))) { UITweener uITweener = (UITweener)LuaObject.checkSelf(l); EventDelegate onFinished; LuaObject.checkType <EventDelegate>(l, 2, out onFinished); uITweener.SetOnFinished(onFinished); LuaObject.pushValue(l, true); result = 1; } else if (LuaObject.matchType(l, total, 2, typeof(EventDelegate.Callback))) { UITweener uITweener2 = (UITweener)LuaObject.checkSelf(l); EventDelegate.Callback onFinished2; LuaDelegation.checkDelegate(l, 2, out onFinished2); uITweener2.SetOnFinished(onFinished2); LuaObject.pushValue(l, true); result = 1; } else { LuaObject.pushValue(l, false); LuaDLL.pua_pushstring(l, "No matched override function to call"); result = 2; } } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
IEnumerator PlayAnim(float delay, UIAnimData animData, System.Action onPlayEnd) { if (delay > 0) { yield return(new WaitForSeconds(delay)); } for (int i = 0; i < animData.m_frames.Count; i++) { UIAnimFrame curFrame = animData.m_frames[i]; switch (curFrame.m_type) { case E_UIAnimType.Empty: { yield return(new WaitForSeconds(animData.m_frames[i].m_duration)); } break; case E_UIAnimType.Set: { GameObject[] targets = animData.GetTargets(); for (int t = 0; t < targets.Length; t++) { if (curFrame.HasTween(E_TweenType.Position)) { SetPosition(targets[t], curFrame.m_position); } if (curFrame.HasTween(E_TweenType.Rotation)) { SetRotation(targets[t], Quaternion.Euler(curFrame.m_rotation)); } if (curFrame.HasTween(E_TweenType.Scale)) { SetScale(targets[t], curFrame.m_scale); } if (curFrame.HasTween(E_TweenType.Color)) { SetColor(targets[t], curFrame.m_color); } if (curFrame.HasTween(E_TweenType.Alpha)) { SetAlpha(targets[t], curFrame.m_alpha); } } } break; case E_UIAnimType.PlaySFX: { //AudioSource audioSrc = AudioManager.ins.PlaySFX(curFrame.m_audioName, Random.Range(curFrame.m_duration, curFrame.m_alpha), curFrame.m_particleParent); //if (audioSrc != null) //{ // float pitch = Random.Range(curFrame.m_scale.x, curFrame.m_scale.y); // audioSrc.pitch = pitch; //} // if (curFrame.m_audioName != null) // SoundMgr.GetSingle().play_se(curFrame.m_audioName); } break; case E_UIAnimType.PlayBGM: //if (string.IsNullOrEmpty(curFrame.m_audioName)) //{ // AudioManager.ins.StopBGM(); //} //else //{ // AudioManager.ins.PlayBGM(curFrame.m_audioName); //} break; case E_UIAnimType.PlayVOX: { //AudioManager.ins.StopAllVOX(); //AudioManager.ins.PlayVOX(curFrame.m_audioName); } break; case E_UIAnimType.AddParticle: { GameObject prefab = Resources.Load(curFrame.m_particlePath) as GameObject; Transform particleTrans = MonoUtil.CreatePrefab(prefab, "particle", curFrame.m_particleParent, curFrame.m_position); if (curFrame.m_particleDestroyAfterPlay) { particleTrans.gameObject.AddComponent <OneShotParticle>(); } } break; case E_UIAnimType.Tween: { bool isTweening = true; bool assignedOnTweenEnd = false; EventDelegate.Callback onTweenEnd = () => { isTweening = false; }; UITweener tw = null; GameObject[] targets = animData.GetTargets(); for (int t = 0; t < targets.Length; t++) { if (curFrame.HasTween(E_TweenType.Position)) { tw = TweenPosition.Begin(targets[t], curFrame.m_duration, curFrame.m_position); tw.method = curFrame.m_method; if (!assignedOnTweenEnd) { assignedOnTweenEnd = true; tw.SetOnFinished(onTweenEnd); } } if (curFrame.HasTween(E_TweenType.Rotation)) { tw = TweenRotation.Begin(targets[t], curFrame.m_duration, Quaternion.Euler(curFrame.m_rotation)); tw.method = curFrame.m_method; if (!assignedOnTweenEnd) { assignedOnTweenEnd = true; tw.SetOnFinished(onTweenEnd); } } if (curFrame.HasTween(E_TweenType.Scale)) { tw = TweenScale.Begin(targets[t], curFrame.m_duration, curFrame.m_scale); tw.method = curFrame.m_method; if (!assignedOnTweenEnd) { assignedOnTweenEnd = true; tw.SetOnFinished(onTweenEnd); } } if (curFrame.HasTween(E_TweenType.Color)) { tw = TweenColor.Begin(targets[t], curFrame.m_duration, curFrame.m_color); tw.method = curFrame.m_method; if (!assignedOnTweenEnd) { assignedOnTweenEnd = true; tw.SetOnFinished(onTweenEnd); } } if (curFrame.HasTween(E_TweenType.Alpha)) { tw = TweenAlpha.Begin(targets[t], curFrame.m_duration, curFrame.m_alpha); tw.method = curFrame.m_method; if (!assignedOnTweenEnd) { assignedOnTweenEnd = true; tw.SetOnFinished(onTweenEnd); } } } while (assignedOnTweenEnd && isTweening) { yield return(null); } } break; case E_UIAnimType.SubAnim: if (curFrame.m_animPlayer != null) { bool isPlaying = true; curFrame.m_animPlayer.Play(() => isPlaying = false, 0f); while (curFrame.m_particleDestroyAfterPlay && isPlaying) { yield return(null); } } break; case E_UIAnimType.SubAnimGroup: { if (curFrame.m_animPlayerGroup != null) { BaseAnimPlayer[] players = curFrame.m_animPlayerGroup.GetComponentsInImmediateChildren <BaseAnimPlayer>(false, Mathf.FloorToInt(curFrame.m_alpha)); if (players != null && players.Length > 0) { if (curFrame.m_duration >= 0f) { float duration = curFrame.m_duration; bool isPlaying = true; float maxLength = 0f; int maxLengthIdx = -1; for (int j = 0; j < players.Length; j++) { if (!players[j].gameObject.activeInHierarchy) { continue; } float curLength = players[j].Length + duration * j; if (curLength > maxLength) { maxLength = curLength; maxLengthIdx = j; } } if (maxLengthIdx == -1) { isPlaying = false; } for (int j = 0; j < players.Length; j++) { if (j == maxLengthIdx) { players[j].Play(() => isPlaying = false, duration * j); } else { players[j].Play(null, duration * j); } } while (curFrame.m_particleDestroyAfterPlay && isPlaying) { yield return(null); } } else { for (int j = 0; j < players.Length; j++) { bool isPlaying = true; players[j].Play(() => isPlaying = false, 0f); while (isPlaying) { yield return(null); } } } } } } break; case E_UIAnimType.EnableBehaviour: if (curFrame.m_behaviour != null) { curFrame.m_behaviour.enabled = curFrame.m_particleDestroyAfterPlay; } else { GameObject[] targets = animData.GetTargets(); for (int t = 0; t < targets.Length; t++) { targets[t].SetActive(curFrame.m_particleDestroyAfterPlay); } } break; case E_UIAnimType.PlayAnimation: if (!string.IsNullOrEmpty(curFrame.m_audioName)) { var animation = animData.m_target.GetComponent <Animation>(); var animator = animData.m_target.GetComponent <Animator>(); if (animation != null) { var clip = animation[curFrame.m_audioName]; clip.speed = 1; if (clip != null && curFrame.m_duration > 0) { clip.speed = clip.length / curFrame.m_duration; } animation.Stop(); animation.Play(curFrame.m_audioName); yield return(new WaitForSeconds(curFrame.m_duration)); } if (animator != null) { animator.Play(curFrame.m_audioName); } } break; case E_UIAnimType.SendEvent: if (!string.IsNullOrEmpty(curFrame.m_audioName)) { EventManager.Instance.SendEvent(curFrame.m_audioName); } break; default: break; } } if (onPlayEnd != null) { onPlayEnd(); } }
public void CreateUIPrefab(string name, string parentName, string nameInScene, string layerName, LuaFunction func) { base.ResManager.LoadPrefab(name, delegate(UnityEngine.Object[] objs) { if (objs.Length == 0) { return; } GameObject gameObject = objs[0] as GameObject; gameObject = UnityEngine.Object.Instantiate <GameObject>(gameObject); if (!string.IsNullOrEmpty(parentName)) { string text = "MainCanvas/GuiCamera"; if (parentName.Equals(text)) { gameObject.transform.SetParent(this.Parent); } else if (parentName.StartsWith(text)) { gameObject.transform.SetParent(this.Parent.FindChild(parentName.Substring(text.Length + 1))); } } if (!string.IsNullOrEmpty(layerName)) { Util.SetLayer(gameObject, layerName); } string text2 = gameObject.name; if (string.IsNullOrEmpty(nameInScene)) { text2 = text2.Replace("(Clone)", string.Empty); } else { text2 = nameInScene; } gameObject.name = this.checkNameInPeers(gameObject.transform.parent, text2); gameObject.transform.localScale = Vector3.one; gameObject.transform.localPosition = Vector3.zero; if (gameObject.transform as RectTransform) { ((RectTransform)gameObject.transform).offsetMin = Vector2.zero; ((RectTransform)gameObject.transform).offsetMax = Vector2.zero; } if (name.StartsWith("Effects/")) { gameObject.AddComponent <LuaBehaviour>().assetbundleName = Util.GetAssetBundleName("Effects/allEffects"); } else { gameObject.AddComponent <LuaBehaviour>().assetbundleName = Util.GetAssetBundleName(name); } UITweener component = gameObject.GetComponent <TweenScale>(); if (component != null && component.enabled) { this.isPlayAnimation = true; component.SetOnFinished(delegate { this.isPlayAnimation = false; }); } if (func != null) { func.Call(new object[] { gameObject }); func.Dispose(); func = null; } string assetBundleName = Util.GetAssetBundleName(name); if (name.StartsWith("Effects/")) { assetBundleName = Util.GetAssetBundleName("Effects/allEffects"); } this.ResManager.UnloadAssetBundleWithoutDependencies(assetBundleName); }); }
private void Start() { FindChild(); Tween.SetOnFinished(OnHideFinished); }
public void CompletePattern() { GameObject tweenContainer = NGUITools.AddChild(grid.transform.parent.gameObject, flourishPrefab); foreach(ShapeColorizer sc in shapes) { sc.transform.parent = tweenContainer.transform; TweenPosition.Begin(sc.gameObject, 0.5f, Vector3.zero); } flourishTween = TweenPosition.Begin(tweenContainer, 1f, tweenContainer.transform.parent.InverseTransformPoint(ComboLabel.transform.position)); EventDelegate del = new EventDelegate(FlourishComplete); flourishTween.SetOnFinished(del); SetPattern(m_patternShapes); shapeIndex = 0; }
public void Close() { uiTweener.PlayReverse(); uiTweener.SetOnFinished(new EventDelegate(this, "OnFinished")); }