private static int DOFade(ILuaState lua) { GameObject go = lua.ToGameObject(1); var group = lua.ToEnumValue(2, typeof(FadeGroup)); var func = lua.ToLuaFunction(3); bool reset = lua.OptBoolean(4, false); if (go) { ZTween.Stop(go); var tw = group != null?FadeTool.DOFade(go, (FadeGroup)group, reset) : FadeTool.DOFade(go, reset); if (func != null) { if (tw != null) { tw.CompleteWith((o) => { func.Invoke(go); func.Dispose(); }); } else { LuaScriptMgr.Instance.StartCoroutine(LibUnity.LuaInvoke(func, null, go)); } } } return(0); }
public void navigateTo(NavigatorScene newScene, Dictionary <string, object> newBundle = null, bool immediate = false) { // Navigates to a gameobject with the camera //Debug.Log("navigating to " + gameObject + " @ " + gameObject.transform.position); if (!isNavigating && newScene != null && newScene.cameraTarget != null && newScene != currentScene) { //* .call(() => logDone("over")) // Initializations newScene.initialize(newBundle); if (immediate) { // Immediately show it if (currentScene != null) { currentScene.onStartedHiding(); } newScene.onStartedShowing(); Camera.main.gameObject.transform.position = newScene.cameraTarget.transform.position; if (currentScene != null) { currentScene.onFinishedHiding(); } newScene.onFinishedShowing(); } else { // Animate to it // Create tween var tween = ZTween.use(Camera.main.gameObject); // Call start functions if (currentScene != null) { tween.call(currentScene.onStartedHiding); } tween.call(newScene.onStartedShowing); // Animate tween.moveTo(newScene.cameraTarget.transform.position, 0.4f, Easing.backInOut); // Call ending functions if (currentScene != null) { tween.call(currentScene.onFinishedHiding); } tween.call(newScene.onFinishedShowing); // Play the tween tween.play(); //.wait(1).call(Func).set("visible", false).play(); } currentScene = newScene; } }
private static int CompleteTween(ILuaState lua) { var go = lua.ToGameObject(1); if (go) { var tweens = go.GetComponents(typeof(ITweenable)); for (int i = 0; i < tweens.Length; ++i) { ZTween.Stop(tweens[i], true); } } return(0); }
public ZTweener Tween(object from, object to, float duration) { ZTweener tw = null; if (to is float) { tw = ZTween.Tween(Getter, Setter, (float)to, duration); if (from != null) { value = (float)from; tw.StartFrom(value); } } if (tw != null) { tw.SetTag(this); } return(tw); }
public ZTweener Tween(object from, object to, float duration) { ZTweener tw = null; if (to is Color) { tw = ZTween.Tween(ColorGetter, ColorSetter, (Color)to, 0f); if (from is Color) { color = (Color)from; tw.StartFrom(color); } } if (tw != null) { tw.SetTag(this); } return(tw); }
public ZTweener Tween(object from, object to, float duration) { ZTweener tw = null; if (to is Color) { tw = this.TweenColor((Color)to, duration); if (from is Color) { tw.StartFrom((Color)from); } } else if (to is float) { tw = this.TweenAlpha((float)to, duration); if (from is float) { var fromColor = color; fromColor.a = (float)from; color = fromColor; tw.StartFrom(color); } } else if (to is Vector2) { tw = ZTween.Tween(GetUVOffset, SetUVOffset, (Vector2)to, duration); if (from is Vector2) { tw.StartFrom((Vector2)from); } } else if (to is Vector4) { } if (tw != null) { tw.SetTag(this); } return(tw); }
internal void remove(ZTween.ZTweenSequence tweenSequence) { // Nullify first, remove later - otherwise it gets remove while doing Update(), which can cause the list to trip on itself tweenSequences[tweenSequences.IndexOf(tweenSequence)] = null; }
internal void add(ZTween.ZTweenSequence tweenSequence) { tweenSequences.Add(tweenSequence); }
public void TweenColor(Color to) { ZTween.Stop(this); ZTween.Tween(GetColor, SetColor, to, 0.2f).SetTag(this); }