protected override U9Transition CreateHideTransition(bool force) { U9Transition t = U9T.T(iTween.ValueTo, gameObject, iTween.Hash("time", transitionDuration, "from", 1f, "to", 0f, "easetype", transitionEaseType, "onupdate", "SetAlphas", "ignoretimescale", ignoreTimeScale)); t.Began += HandleTransitionBegan; return(t); }
/// <summary> /// Raises the transition paused event. /// </summary> protected void OnPaused(U9Transition t) { if (Paused != null) { Paused(t); } }
private void MoveIntro(Edge edge) { Vector3 MoveTo = new Vector3(0, 0, 0); switch (edge) { case Edge.Bottom: MoveTo = new Vector3(0, 800, 0); break; case Edge.Left: MoveTo = new Vector3(800, _IntroLogo.transform.position.y, 0); break; case Edge.Right: MoveTo = new Vector3(-800, _IntroLogo.transform.position.y, 0); break; case Edge.Top: MoveTo = new Vector3(0, -800, 0); break; } //U9Transition transitions = U9T.HOT(HOTween.To, _IntroLogo.transform, 0.2f, new TweenParms().Prop("localPosition", MoveTo, false).Ease(EaseType.EaseOutQuad)); U9Transition transitions = U9T.LT(LeanTween.moveLocal, _IntroLogo, MoveTo, 0.2f, iTween.Hash("ease", LeanTweenType.easeOutQuad)); transitions.Ended += (transition) => { Destroy(_IntroLogo); }; U9T.S(U9T.W(0.2f), transitions).Begin(); }
void HandleTransitionInterrupted(U9Transition transition) { WasInterrupted = true; transition.Interrupted -= HandleTransitionInterrupted; transition.Ended -= OnTransitionEnded; TransitionCompletedReceiver(); }
/// <summary> /// Creates the game over transition /// </summary> /// <returns>The game over transition.</returns> U9Transition CreateGameOverTransition() { int previousBestScore = HighScore; U9Transition gameOverViewTransition = null; SubmitScore(); if (Score > HighScore) { HighScore = score; highScoreView.Setup(HighScore); ECurrentView = View.Highscore; } else { newScoreView.Setup(score); ECurrentView = View.Newscore; } // Set the game over flag gameIsOver = true; score = 0; currentScoreLabel.text = "0"; // Return a transition which clears the board and displays the appropriate game over view return(U9T.S(/*CreateClearBoardTransition()*/)); }
/// <summary> /// Raises the transition stopped event. /// </summary> protected void OnStopped(U9Transition t) { if (Stopped != null) { Stopped(t); } }
/// <summary> /// Raises the transition resumed event. /// </summary> protected void OnResumed(U9Transition t) { if (Resumed != null) { Resumed(t); } }
public static U9SerialTransition PrioritySequence( U9Transition[] transitions, float staggerTime = 0f ) { //Debug.Log ("START PRIORITY SEQUENCE -------------"); List<U9Transition> transList = new List<U9Transition>( transitions ); //transList.Sort( CompareTransitionPriority ); IEnumerable enumerator = transList.OrderBy (t => t.Priority); int? currentPriority = null; U9SerialTransition serial = new U9SerialTransition (); List<U9Transition> parallelGroup = new List<U9Transition> (); foreach (U9Transition t in enumerator) { if (t != null) { if (t.Priority != currentPriority) { if (parallelGroup.Count > 0) { //Debug.Log ("Priority group: " + currentPriority + " = " + parallelGroup.Count ); serial.AddTransition (U9T.Stagger (staggerTime, parallelGroup.ToArray ())); parallelGroup.Clear (); } currentPriority = t.Priority; } parallelGroup.Add (t); } } if (parallelGroup.Count > 0) { //Debug.Log ("Priority group: " + currentPriority + " = " + parallelGroup.Count ); serial.AddTransition( U9T.Stagger( staggerTime, parallelGroup.ToArray() ) ); parallelGroup.Clear (); } return serial; }
protected virtual void HandleDisplayTransitionEnded(U9Transition transition) { if (!transition.WasInterrupted) { EndDisplay(); } }
protected virtual void HandleHideTransitionEnded(U9Transition transition) { if (!transition.WasInterrupted) { EndHide(); } }
void HandleTransitionInterrupted (U9Transition transition) { WasInterrupted = true; transition.Interrupted -= HandleTransitionInterrupted; transition.Ended -= OnTransitionEnded; TransitionCompletedReceiver(); }
public U9Transition GetPushViewTransition(U9View newView, bool hideOldView = true, bool force = false, bool hideAfter = false) { U9View oldView = null; if (viewStack.Count > 0) { oldView = viewStack.Peek(); } viewStack.Push(newView); U9Transition hideOldViewTransition = null, displayNewViewTransition = null; if (oldView) { oldView.DisableInteraction(); if (hideOldView) { hideOldViewTransition = oldView.GetHideTransition(force); } } displayNewViewTransition = newView.GetDisplayTransition(force); if (hideAfter) { return(U9T.S(displayNewViewTransition, hideOldViewTransition)); } else { return(U9T.S(hideOldViewTransition, displayNewViewTransition)); } }
/// <summary> /// Raises the transition started event. /// </summary> protected void OnBegan(U9Transition t) { if (Began != null) { Began(t); } }
public U9Transition CreateOnScoreTransition(List <Block> blocks, int layer, int tScore) { int layerMask = 1 << layer; layerMask = ~layerMask; Proj.ignoreLayers = layerMask; U9Transition onScoreTransition = null; transform.parent = blocks[blocks.Count / 2].transform; transform.localScale = Vector3.one; //onScoreTransition = U9T.T (iTween.MoveTo, this.gameObject, iTween.Hash("position", new Vector3(0, 0, -1000), "time", 0.4f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); //onScoreTransition.Ended += (transition) => //{ float staggerTime = 0f; //0.45f; List <U9Transition> transitions = new List <U9Transition> (); foreach (Block m in blocks) { transitions.Add(m.CreateDisappearTransition(tScore)); } staggerTime = staggerTime / transitions.Count; U9Transition t = U9T.Stagger(staggerTime, transitions.ToArray()); t.Begin(); Destroy(this.gameObject); //}; return(new InstantTransition(onScoreTransition)); }
public IEnumerator StartGameIE() { colorPalette = colorManager.getBlockColors(); foreach (Transform t in transform) { GameObject.Destroy(t.gameObject); } BackgroundBlocks = new List <Blocks>(); // Initialise space for the blocks in the grid blocks = new Block[gridSize, gridSize]; // Calculate the bottom left position of the grid gridBaseline = -0.5f * new Vector3(((blockPaddingSize + blockSize) * (gridSize - 1)), (blockPaddingSize + blockSize) * (gridSize - 1), 0f); gridBaseline.y += 60.0f; // Initialise Game Services GooglePlayGames.PlayGamesPlatform.Activate(); // Spawn the static background blocks for (int j = gridSize - 2, nj = 0; j > nj; j--) { for (int i = 1, ni = gridSize - 1; i < ni; i++) { Block backgroundBlockInstance = (Block)Instantiate(blockPrefab); backgroundBlockInstance.SquareSize = blockSize; backgroundBlockInstance.Color = HexColor.ColorFromHex("D2D2D2" /*"E9ECEE"*/); backgroundBlockInstance.transform.parent = transform; backgroundBlockInstance.transform.localPosition = GridPosTo3DPos(i, j, -10); backgroundBlockInstance.transform.localScale = Vector3.one; // * 0.001f; backgroundBlockInstance.IsBackground = true; backgroundBlockInstance.gameObject.layer = 8; Blocks sBlock = new Blocks(); sBlock.block = backgroundBlockInstance; BackgroundBlocks.Add(sBlock); //U9Transition transitions = U9T.HOT (HOTween.To, backgroundBlockInstance.gameObject.transform, 0.3f, new TweenParms().Prop("localScale", Vector3.one,false).Ease(EaseType.EaseOutExpo)); U9Transition transitions = U9T.LT(LeanTween.scale, backgroundBlockInstance.gameObject, Vector3.one, 0.3f, iTween.Hash("ease", LeanTweenType.easeOutExpo)); //U9Transition transitions = U9T.T (iTween.ScaleTo, backgroundBlockInstance.gameObject, iTween.Hash ("scale", new Vector3(1,1,1), "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo )); transitions.Begin(); yield return(new WaitForSeconds(0.05f)); } } GameObject intro = (GameObject)Instantiate(_IntroEffect); StartNewGame(); GameCreated = true; }
void OnTransitionEnded(U9Transition t) { WasInterrupted = WasInterrupted | t.WasInterrupted; t.Interrupted -= HandleTransitionInterrupted; t.Ended -= OnTransitionEnded; TransitionCompletedReceiver(); }
public void AddTransition(U9Transition t) { queue.Enqueue(t); if (queue.Count == 1) { BeginNextTransition(); } }
void HandleTransitionBegan(U9Transition transition) { if (lastTransition != null) { lastTransition.Stop(); } lastTransition = transition; }
/// <summary> /// Raises the transition completed event. /// </summary> protected void OnEnded(U9Transition t) { hasEnded = true; if (Ended != null) { Ended(t); } }
void OnTransitionInterrupted(U9Transition t) { WasInterrupted = true; t.Interrupted -= OnTransitionInterrupted; t.Ended -= OnTransitionEnded; TransitionInterruptedReceiver(); }
/// <summary> /// Raises the transition interrupted event. /// </summary> protected void OnInterrupted(U9Transition t) { hasEnded = true; wasInterrupted = true; if (Interrupted != null) { Interrupted(t); } //End(); }
U9Transition CreateCompositeTransition( U9Transition[] ts ) { switch( compositionType ) { case CompositionType.Parallel: return U9T.P ( ts ); case CompositionType.Serial: return U9T.S ( ts ); case CompositionType.Stagger: return U9T.Stagger ( 0.1f, ts ); default: return null; } }
public virtual U9Transition GetDisplayTransition(bool force = false) { if ((!force && IsDisplaying)) { // Debug.LogWarning( name + " already " + State ); return(U9T.Null()); } else { state = ViewState.Displaying; U9Transition t = CreateDisplayTransition(force); AddDisplayTransitionListeners(t); return(t); } }
/// <summary> /// Takes the player move and then waits until animations have completed before accepting any more input. /// </summary> /// <param name="edge">Edge.</param> void TakePlayerMove(GameController.Edge edge) { switch (GameController.Inst.ECurrentView) { case GameController.View.Intro: GameController.Inst.SwitchToView(GameController.View.Game); GameController.Inst.StartGame(); break; case GameController.View.Info: GameController.Inst.SwitchToView(GameController.View.Game); break; case GameController.View.Highscore: GameController.Inst.SwitchToView(GameController.View.Game); if (GameController.Inst.Platform != Platform.Web) { GameController.Inst.StartGame(); } break; case GameController.View.Newscore: GameController.Inst.SwitchToView(GameController.View.Game); if (GameController.Inst.Platform != Platform.Web) { GameController.Inst.StartGame(); } break; case GameController.View.Game: { if (GameController.Inst.GameCreated) { if (waitingForInput) { waitingForInput = false; U9Transition t = GameController.Inst.CreatePlayerMoveTransition(edge); t.Ended += (transition) => { waitingForInput = true; }; t.Begin(); } } break; } } }
public U9Transition FireEvent(string eventID, object source, params object[] args) { //Debug.Log ("FIRE EVENT: " + eventID); U9Event e; U9Transition transition = U9T.Null(); if (events.TryGetValue(eventID, out e)) { U9EventArgs eventArgs = e.OnFired(source, args); if (eventArgs != null && eventArgs.Transitions.Count > 0) { transition = U9T.P(eventArgs.Transitions.ToArray()); } } return(transition); }
void BeginNextTransition() { if (queue.Count > 0) { U9Transition t = queue.Peek(); t.Ended += HandleCurrentTransitionEnded; //Debug.Log ("BEGINNING QUEUED TRANS!"); t.Begin(); } else { if (QueueEmptied != null) { QueueEmptied(); } } }
public U9Transition GetPopViewTransition(int popCount = 1, bool force = false, bool displayFirst = false) { //PrintStack(); List <U9Transition> popTransitions = new List <U9Transition>(); while (viewStack.Count > 0 && popCount > 0) { popTransitions.Add(viewStack.Pop().GetHideTransition(force)); popCount--; } U9View newView = null; if (viewStack.Count > 0) { newView = viewStack.Peek(); } U9Transition displayNewView = null; if (newView) { if (!newView.IsDisplaying) { displayNewView = newView.GetDisplayTransition(force); } else { newView.EnableInteraction(); } } //PrintStack(); if (displayFirst) { return(U9T.S(displayNewView, U9T.S(popTransitions.ToArray()))); } else { return(U9T.S(U9T.S(popTransitions.ToArray()), displayNewView)); } }
void StartNextTransition() { if(completedTransitions < transitions.Count) { if(!current || current.IsCompleted) { current = transitions[completedTransitions]; current.Interrupted += OnTransitionInterrupted; current.Ended += OnTransitionEnded; current.IsCompleted = false; current.Begin(); } } else { End(); } }
public virtual U9Transition GetHideTransition(bool force = false) { // if ( !force && !gameObject.activeInHierarchy) { // Hide (); // return U9T.Null (); // } if ((!force && !IsDisplaying)) { //Debug.LogWarning( name + " already " + State ); return(U9T.Null()); } else { state = ViewState.Hiding; U9Transition t = CreateHideTransition(force); AddHideTransitionListeners(t); return(t); } }
void StartNextTransition() { if (completedTransitions < transitions.Count) { if (!current || current.IsCompleted) { current = transitions[completedTransitions]; current.Interrupted += OnTransitionInterrupted; current.Ended += OnTransitionEnded; current.IsCompleted = false; current.Begin(); } } else { End(); } }
static int CompareTransitionPriority( U9Transition a, U9Transition b ) { return a.Priority.CompareTo (b.Priority); }
void HandleDisplayTransitionBegan(U9Transition transition) { BeginDisplay(); }
/// <summary> /// Raises the transition completed event. /// </summary> protected void OnEnded(U9Transition t) { hasEnded = true; if(Ended != null) Ended(t); }
void HandleHideTransitionBegan (U9Transition transition) { BeginHide(); }
public void AddTransition(U9Transition transition) { this.transitions.Add(transition); }
void HandleHideTransitionBegan(U9Transition transition) { BeginHide(); }
/// <summary> /// Raises the transition paused event. /// </summary> protected void OnPaused(U9Transition t) { if(Paused != null) Paused(t); }
/// <summary> /// Raises the transition started event. /// </summary> protected void OnBegan(U9Transition t) { if(Began != null) Began(t); }
public InstantTransition( U9Transition childTransition ) { this.childTransition = childTransition; }
protected void AddDisplayTransitionListeners( U9Transition displayTransition ) { displayTransition.Began += HandleDisplayTransitionBegan; displayTransition.Ended += HandleDisplayTransitionEnded; }
void HandleCurrentTransitionEnded (U9Transition transition) { queue.Dequeue (); BeginNextTransition(); }
/// <summary> /// Raises the transition resumed event. /// </summary> protected void OnResumed(U9Transition t) { if(Resumed != null) Resumed(t); }
protected void AddHideTransitionListeners(U9Transition hideTransition) { hideTransition.Began += HandleHideTransitionBegan; hideTransition.Ended += HandleHideTransitionEnded; }
/// <summary> /// Raises the transition stopped event. /// </summary> protected void OnStopped(U9Transition t) { if(Stopped != null) Stopped(t); }
public static void ValidateTransitionArray( U9Transition[] transitions ) { for( int i = 0, ni = transitions.Length ; i < ni ; i++ ) { if( transitions[i] == null ) { transitions[i] = U9T.Null(); } } }
/// <summary> /// Raises the transition interrupted event. /// </summary> protected void OnInterrupted(U9Transition t) { hasEnded = true; wasInterrupted = true; if(Interrupted != null) Interrupted(t); //End(); }
void HandleDisplayTransitionBegan (U9Transition transition) { BeginDisplay(); }
protected virtual void HandleHideTransitionEnded(U9Transition transition) { if (!transition.WasInterrupted) { EndHide (); } }
public void AddTransition( U9Transition t ) { queue.Enqueue( t ); if( queue.Count == 1 ) { BeginNextTransition(); } }
protected virtual void HandleDisplayTransitionEnded(U9Transition transition) { if (!transition.WasInterrupted) { EndDisplay (); } }
public InstantTransition(U9Transition childTransition) { this.childTransition = childTransition; }
protected void AddHideTransitionListeners( U9Transition hideTransition ) { hideTransition.Began += HandleHideTransitionBegan; hideTransition.Ended += HandleHideTransitionEnded; }