Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Raises the transition paused event.
 /// </summary>
 protected void OnPaused(U9Transition t)
 {
     if (Paused != null)
     {
         Paused(t);
     }
 }
Ejemplo n.º 3
0
    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();
    }
Ejemplo n.º 4
0
 void HandleTransitionInterrupted(U9Transition transition)
 {
     WasInterrupted          = true;
     transition.Interrupted -= HandleTransitionInterrupted;
     transition.Ended       -= OnTransitionEnded;
     TransitionCompletedReceiver();
 }
Ejemplo n.º 5
0
    /// <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()*/));
    }
Ejemplo n.º 6
0
 /// <summary>
 /// Raises the transition stopped event.
 /// </summary>
 protected void OnStopped(U9Transition t)
 {
     if (Stopped != null)
     {
         Stopped(t);
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Raises the transition resumed event.
 /// </summary>
 protected void OnResumed(U9Transition t)
 {
     if (Resumed != null)
     {
         Resumed(t);
     }
 }
Ejemplo n.º 8
0
Archivo: U9T.cs Proyecto: unit9/swip3
	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;
	}
Ejemplo n.º 9
0
 protected virtual void HandleDisplayTransitionEnded(U9Transition transition)
 {
     if (!transition.WasInterrupted)
     {
         EndDisplay();
     }
 }
Ejemplo n.º 10
0
 protected virtual void HandleHideTransitionEnded(U9Transition transition)
 {
     if (!transition.WasInterrupted)
     {
         EndHide();
     }
 }
Ejemplo n.º 11
0
	void HandleTransitionInterrupted (U9Transition transition)
	{
		WasInterrupted = true;
		transition.Interrupted -= HandleTransitionInterrupted;
		transition.Ended -= OnTransitionEnded;		
		TransitionCompletedReceiver();
	}
Ejemplo n.º 12
0
    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));
        }
    }
Ejemplo n.º 13
0
 /// <summary>
 /// Raises the transition started event.
 /// </summary>
 protected void OnBegan(U9Transition t)
 {
     if (Began != null)
     {
         Began(t);
     }
 }
Ejemplo n.º 14
0
    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));
    }
Ejemplo n.º 15
0
    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;
    }
Ejemplo n.º 16
0
    void OnTransitionEnded(U9Transition t)
    {
        WasInterrupted = WasInterrupted | t.WasInterrupted;

        t.Interrupted -= HandleTransitionInterrupted;
        t.Ended       -= OnTransitionEnded;
        TransitionCompletedReceiver();
    }
Ejemplo n.º 17
0
 public void AddTransition(U9Transition t)
 {
     queue.Enqueue(t);
     if (queue.Count == 1)
     {
         BeginNextTransition();
     }
 }
Ejemplo n.º 18
0
 void HandleTransitionBegan(U9Transition transition)
 {
     if (lastTransition != null)
     {
         lastTransition.Stop();
     }
     lastTransition = transition;
 }
Ejemplo n.º 19
0
	void OnTransitionEnded(U9Transition t) {

		WasInterrupted = WasInterrupted | t.WasInterrupted;

		t.Interrupted -= HandleTransitionInterrupted;
		t.Ended -= OnTransitionEnded;		
		TransitionCompletedReceiver();
	}
Ejemplo n.º 20
0
    /// <summary>
    /// Raises the transition completed event.
    /// </summary>
    protected void OnEnded(U9Transition t)
    {
        hasEnded = true;

        if (Ended != null)
        {
            Ended(t);
        }
    }
Ejemplo n.º 21
0
    void OnTransitionInterrupted(U9Transition t)
    {
        WasInterrupted = true;

        t.Interrupted -= OnTransitionInterrupted;
        t.Ended       -= OnTransitionEnded;

        TransitionInterruptedReceiver();
    }
Ejemplo n.º 22
0
    /// <summary>
    /// Raises the transition interrupted event.
    /// </summary>
    protected void OnInterrupted(U9Transition t)
    {
        hasEnded       = true;
        wasInterrupted = true;

        if (Interrupted != null)
        {
            Interrupted(t);
        }

        //End();
    }
Ejemplo n.º 23
0
	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;
		}
	}
Ejemplo n.º 24
0
 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);
     }
 }
Ejemplo n.º 25
0
    /// <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;
        }
        }
    }
Ejemplo n.º 26
0
    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);
    }
Ejemplo n.º 27
0
 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();
         }
     }
 }
Ejemplo n.º 28
0
    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));
        }
    }
Ejemplo n.º 29
0
	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();
		}
	}
Ejemplo n.º 30
0
    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);
        }
    }
Ejemplo n.º 31
0
    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();
        }
    }
Ejemplo n.º 32
0
Archivo: U9T.cs Proyecto: unit9/swip3
	static int CompareTransitionPriority( U9Transition a, U9Transition b ) {
		return a.Priority.CompareTo (b.Priority);
	}
Ejemplo n.º 33
0
 void HandleDisplayTransitionBegan(U9Transition transition)
 {
     BeginDisplay();
 }
Ejemplo n.º 34
0
	/// <summary>
	/// Raises the transition completed event.
	/// </summary>
	protected void OnEnded(U9Transition t) {
		hasEnded = true;
		
		if(Ended != null)
			Ended(t);
	}
Ejemplo n.º 35
0
	void HandleHideTransitionBegan (U9Transition transition)
	{
		BeginHide();
	}
Ejemplo n.º 36
0
	public void AddTransition(U9Transition transition) {
		this.transitions.Add(transition);
	}
Ejemplo n.º 37
0
 void HandleHideTransitionBegan(U9Transition transition)
 {
     BeginHide();
 }
Ejemplo n.º 38
0
	/// <summary>
	/// Raises the transition paused event.
	/// </summary>
	protected void OnPaused(U9Transition t) {
		if(Paused != null)
			Paused(t);
	}
Ejemplo n.º 39
0
	/// <summary>
	/// Raises the transition started event.
	/// </summary>
	protected void OnBegan(U9Transition t) {
		if(Began != null)
			Began(t);
	}
Ejemplo n.º 40
0
	public InstantTransition( U9Transition childTransition ) {
		this.childTransition = childTransition;
	}
Ejemplo n.º 41
0
	protected void AddDisplayTransitionListeners( U9Transition displayTransition ) {
		displayTransition.Began += HandleDisplayTransitionBegan;
		displayTransition.Ended += HandleDisplayTransitionEnded;
	}	
Ejemplo n.º 42
0
	void OnTransitionInterrupted(U9Transition t) {

		WasInterrupted = true;

		t.Interrupted -= OnTransitionInterrupted;
		t.Ended -= OnTransitionEnded;
		
		TransitionInterruptedReceiver();
	}
Ejemplo n.º 43
0
	void HandleCurrentTransitionEnded (U9Transition transition)
	{
		queue.Dequeue ();
		BeginNextTransition();
	}
Ejemplo n.º 44
0
	/// <summary>
	/// Raises the transition resumed event.
	/// </summary>
	protected void OnResumed(U9Transition t) {
		if(Resumed != null)
			Resumed(t);
	}
Ejemplo n.º 45
0
 protected void AddHideTransitionListeners(U9Transition hideTransition)
 {
     hideTransition.Began += HandleHideTransitionBegan;
     hideTransition.Ended += HandleHideTransitionEnded;
 }
Ejemplo n.º 46
0
	/// <summary>
	/// Raises the transition stopped event.
	/// </summary>
	protected void OnStopped(U9Transition t) {
		if(Stopped != null)
			Stopped(t);
	}
Ejemplo n.º 47
0
Archivo: U9T.cs Proyecto: unit9/swip3
	public static void ValidateTransitionArray( U9Transition[] transitions ) {
		for( int i = 0, ni = transitions.Length ; i < ni ; i++ ) {
			if( transitions[i] == null ) {
				transitions[i] = U9T.Null();
			}
		}
	}
Ejemplo n.º 48
0
	/// <summary>
	/// Raises the transition interrupted event.
	/// </summary>
	protected void OnInterrupted(U9Transition t) {
		hasEnded = true;
		wasInterrupted = true;
		
		if(Interrupted != null)
			Interrupted(t);
		
		//End();
	}
Ejemplo n.º 49
0
	void HandleDisplayTransitionBegan (U9Transition transition)
	{
		BeginDisplay();
	}
Ejemplo n.º 50
0
	protected virtual void HandleHideTransitionEnded(U9Transition transition) {
		if (!transition.WasInterrupted) {
			EndHide ();
		}
	}
Ejemplo n.º 51
0
	public void AddTransition( U9Transition t ) {
		queue.Enqueue( t );
		if( queue.Count == 1 ) {
			BeginNextTransition();
		}
	}
Ejemplo n.º 52
0
	protected virtual void HandleDisplayTransitionEnded(U9Transition transition) {
		if (!transition.WasInterrupted) {
			EndDisplay ();
		}
	}
Ejemplo n.º 53
0
 public InstantTransition(U9Transition childTransition)
 {
     this.childTransition = childTransition;
 }
Ejemplo n.º 54
0
	protected void AddHideTransitionListeners( U9Transition hideTransition ) {
		hideTransition.Began += HandleHideTransitionBegan;
		hideTransition.Ended += HandleHideTransitionEnded;
	}