Пример #1
0
 //-------------------------------------------------------------------------------------------------------------
 public override void Draw(Rect sRect)
 {
     //STSBenchmark.Start();
     if (Purcent > 0)
     {
         //Color tColorLerp = Color.Lerp(TintSecondary, TintPrimary, Purcent);
         int tIndex = (int)Mathf.Floor(Purcent * Matrix.TileCount);
         //Debug.Log("tIndex = " + tIndex + " on TileCount) = "+TileCount);
         // draw all fill tiles
         for (int i = 0; i < tIndex; i++)
         {
             STSTile tTile = Matrix.TilesList[i];
             //STSTransitionDrawing.DrawRect(tTile.Rectangle, TintPrimary);
             STSDrawCircle.DrawCircle(tTile.Rectangle.center, tTile.Rectangle.width, 32, TintPrimary);
         }
         // Draw Alpha tile
         if (tIndex < Matrix.TileCount)
         {
             STSTile tTileAlpha = Matrix.TilesList[tIndex];
             float   tAlpha     = (Purcent * Matrix.TileCount) - (float)tIndex;
             //Color tColorLerp = Color.Lerp(TintSecondary, TintPrimary, tAlpha);
             //Color tFadeColorAlpha = new Color(TintPrimary.r, TintPrimary.g, TintPrimary.b, tAlpha*TintPrimary.a);
             //STSTransitionDrawing.DrawRect(tTileAlpha.Rectangle, tFadeColorAlpha);
             STSDrawCircle.DrawCircle(tTileAlpha.Rectangle.center, tTileAlpha.Rectangle.width * tAlpha, 32, TintPrimary);
         }
     }
     //STSBenchmark.Finish();
 }
Пример #2
0
        //-------------------------------------------------------------------------------------------------------------
        public void CreateMatrix(int sLine, int sColumn, Rect sRect, float sStartDelayFactor)
        {
            //STSBenchmark.Start();
            float tX = sRect.width / sColumn;
            float tY = sRect.height / sLine;

            Matrix    = new STSTile[sLine, sColumn];
            TilesList = new List <STSTile>();
            TileCount = 0;
            Line      = sLine;
            Column    = sColumn;
            for (int i = 0; i < sLine; i++)
            {
                for (int j = 0; j < sColumn; j++)
                {
                    STSTile tTile = new STSTile();//GetTile(i, j);
                    tTile.Rectangle  = new Rect(i * tX, j * tY, tX, tY);
                    tTile.StartDelay = (i * sColumn + j) * sStartDelayFactor;
                    Matrix[i, j]     = tTile;
                    TilesList.Add(tTile);
                    TileCount++;
                }
            }
            //STSBenchmark.Finish();
        }
Пример #3
0
        //-------------------------------------------------------------------------------------------------------------
        public void ShuffleList()
        {
            //STSBenchmark.Start();
            int tCount = TilesList.Count;

            for (int i = 0; i < tCount; i++)
            {
                STSTile tTile = TilesList[i];
                TilesList.Remove(tTile);
                TilesList.Insert(Random.Range(0, tCount - 1), tTile);
            }
            //STSBenchmark.Finish();
        }
Пример #4
0
 //-------------------------------------------------------------------------------------------------------------
 public void CreateMatrix(int sLine, int sColumn)
 {
     //STSBenchmark.Start();
     Matrix    = new STSTile[sLine, sColumn];
     TilesList = new List <STSTile>();
     TileCount = 0;
     Line      = sLine;
     Column    = sColumn;
     for (int i = 0; i < sLine; i++)
     {
         for (int j = 0; j < sColumn; j++)
         {
             STSTile tTile = new STSTile();
             Matrix[i, j] = tTile;
             TilesList.Add(tTile);
             TileCount++;
         }
     }
     //STSBenchmark.Finish();
 }
Пример #5
0
        //-------------------------------------------------------------------------------------------------------------
        public override void Draw(Rect sRect)
        {
            //STSBenchmark.Start();
            if (Purcent > 0)
            {
                //Color tColorLerp = Color.Lerp(TintSecondary, TintPrimary, Purcent);
                int tIndex = (int)Mathf.Floor(Purcent * Matrix.TileCount);
                //Debug.Log("tIndex = " + tIndex + " on TileCount) = "+TileCount);
                // draw all fill tiles
                int tLine   = 0;
                int tColumn = 0;
                switch (FiveCross)
                {
                case STSFiveCross.Left:
                {
                    for (int i = 0; i < tIndex; i++)
                    {
                        tColumn = (int)Mathf.Floor((float)i / (float)ParameterOne);
                        tLine   = (int)((float)i % ((float)ParameterOne));
                        //Debug.Log("index = "+i+"/"+tIndex+"/ "+TileCount+" ---> loop tLine ="+tLine +" tColumn = " +tColumn);
                        STSTile tTile = Matrix.GetTile(tLine, tColumn);
                        STSDrawQuad.DrawRect(tTile.Rectangle, TintPrimary);
                    }
                    // Draw Alpha tile
                    if (tIndex < Matrix.TileCount)
                    {
                        tColumn = (int)Mathf.Floor((float)tIndex / (float)ParameterOne);
                        tLine   = (int)((float)tIndex % ((float)ParameterOne));
                        //Debug.Log("index = " + tIndex + "/" + tIndex + "/ " + TileCount + " ---> loop tLineAlpha =" + tLineAlpha + " tColumnAlpha = " + tColumnAlpha);
                        STSTile tTileAlpha = Matrix.GetTile(tLine, tColumn);
                        float   tAlpha     = (Purcent * Matrix.TileCount) - (float)tIndex;
                        //Color tColorLerp = Color.Lerp(TintSecondary, TintPrimary, tAlpha);
                        Color tFadeColorAlpha = new Color(TintPrimary.r, TintPrimary.g, TintPrimary.b, tAlpha);
                        STSDrawQuad.DrawRect(tTileAlpha.Rectangle, tFadeColorAlpha);
                    }
                }
                break;

                case STSFiveCross.Right:
                {
                    for (int i = 0; i < tIndex; i++)
                    {
                        tColumn = (int)Mathf.Ceil(ParameterTwo - (float)i / (float)ParameterOne) - 1;
                        tLine   = (int)((float)i % ((float)ParameterOne));
                        //Debug.Log("index = "+i+"/"+tIndex+"/ "+TileCount+" ---> loop tLine ="+tLine +" tColumn = " +tColumn);
                        STSTile tTile = Matrix.GetTile(tLine, tColumn);
                        STSDrawQuad.DrawRect(tTile.Rectangle, TintPrimary);
                    }
                    // Draw Alpha tile
                    if (tIndex < Matrix.TileCount)
                    {
                        tColumn = (int)Mathf.Ceil(ParameterTwo - (float)tIndex / (float)ParameterOne) - 1;
                        tLine   = (int)((float)tIndex % ((float)ParameterOne));
                        //Debug.Log("index = " + tIndex + "/" + tIndex + "/ " + TileCount + " ---> loop tLineAlpha =" + tLineAlpha + " tColumnAlpha = " + tColumnAlpha);
                        STSTile tTileAlpha = Matrix.GetTile(tLine, tColumn);
                        float   tAlpha     = (Purcent * Matrix.TileCount) - (float)tIndex;
                        //Color tColorLerp = Color.Lerp(TintSecondary, TintPrimary, tAlpha);
                        Color tFadeColorAlpha = new Color(TintPrimary.r, TintPrimary.g, TintPrimary.b, tAlpha);
                        STSDrawQuad.DrawRect(tTileAlpha.Rectangle, tFadeColorAlpha);
                    }
                }
                break;

                case STSFiveCross.Top:
                {
                    for (int i = 0; i < tIndex; i++)
                    {
                        tLine   = (int)Mathf.Floor((float)i / (float)ParameterTwo);
                        tColumn = (int)((float)i % ((float)ParameterTwo));
                        //Debug.Log("index = "+i+"/"+tIndex+"/ "+TileCount+" ---> loop tLine ="+tLine +" tColumn = " +tColumn);
                        STSTile tTile = Matrix.GetTile(tLine, tColumn);
                        STSDrawQuad.DrawRect(tTile.Rectangle, TintPrimary);
                    }
                    // Draw Alpha tile
                    if (tIndex < Matrix.TileCount)
                    {
                        tLine   = (int)Mathf.Floor((float)tIndex / (float)ParameterTwo);
                        tColumn = (int)((float)tIndex % ((float)ParameterTwo));
                        //Debug.Log("index = " + tIndex + "/" + tIndex + "/ " + TileCount + " ---> loop tLineAlpha =" + tLineAlpha + " tColumnAlpha = " + tColumnAlpha);
                        STSTile tTileAlpha = Matrix.GetTile(tLine, tColumn);
                        float   tAlpha     = (Purcent * Matrix.TileCount) - (float)tIndex;
                        //Color tColorLerp = Color.Lerp(TintSecondary, TintPrimary, tAlpha);
                        Color tFadeColorAlpha = new Color(TintPrimary.r, TintPrimary.g, TintPrimary.b, tAlpha);
                        STSDrawQuad.DrawRect(tTileAlpha.Rectangle, tFadeColorAlpha);
                    }
                }
                break;

                case STSFiveCross.Bottom:
                {
                    for (int i = 0; i < tIndex; i++)
                    {
                        tLine   = (int)Mathf.Ceil(ParameterOne - (float)i / (float)ParameterTwo) - 1;
                        tColumn = (int)((float)i % ((float)ParameterTwo));
                        //Debug.Log("index = "+i+"/"+tIndex+"/ "+TileCount+" ---> loop tLine ="+tLine +" tColumn = " +tColumn);
                        STSTile tTile = Matrix.GetTile(tLine, tColumn);
                        STSDrawQuad.DrawRect(tTile.Rectangle, TintPrimary);
                    }
                    // Draw Alpha tile
                    if (tIndex < Matrix.TileCount)
                    {
                        tLine   = (int)Mathf.Ceil(ParameterOne - (float)tIndex / (float)ParameterTwo) - 1;
                        tColumn = (int)((float)tIndex % ((float)ParameterTwo));
                        //Debug.Log("index = " + tIndex + "/" + tIndex + "/ " + TileCount + " ---> loop tLineAlpha =" + tLine + " tColumnAlpha = " + tColumn);
                        STSTile tTileAlpha      = Matrix.GetTile(tLine, tColumn);
                        float   tAlpha          = (Purcent * Matrix.TileCount) - (float)tIndex;
                        Color   tFadeColorAlpha = new Color(TintPrimary.r, TintPrimary.g, TintPrimary.b, tAlpha * TintPrimary.a);
                        STSDrawQuad.DrawRect(tTileAlpha.Rectangle, tFadeColorAlpha);
                    }
                }
                break;
                }
            }
            //STSBenchmark.Finish();
        }