Exemplo n.º 1
0
    /// <summary>
    /// Get the shape stars.
    /// </summary>
    /// <returns>The shape stars.</returns>
    /// <param name="ID">The ID of the shape.</param>
    public static TableShape.StarsNumber GetShapeStars(int ID)
    {
        TableShape.StarsNumber stars = TableShape.StarsNumber.ZERO;
        string key = "Shape-" + ID + "-Stars";

        if (PlayerPrefs.HasKey(key))
        {
            stars = CommonUtil.IntNumberToShapeStarsNumberEnum(PlayerPrefs.GetInt(key));
        }
        return(stars);
    }
Exemplo n.º 2
0
    /// <summary>
    /// Get the number of stars of the given shape
    /// </summary>
    /// <returns>The shape stars.</returns>
    /// <param name="ID">Shape ID.</param>
    /// <param name="shapesManager">Shapes manager.</param>
    public static TableShape.StarsNumber GetShapeStars(int ID, ShapesManager shapesManager)
    {
        TableShape.StarsNumber stars = TableShape.StarsNumber.ZERO;
        string key = GetStarsStrKey(ID, shapesManager);

        if (PlayerPrefs.HasKey(key))
        {
            stars = CommonUtil.IntNumberToShapeStarsNumberEnum(PlayerPrefs.GetInt(key));
        }
        return(stars);
    }
Exemplo n.º 3
0
        /// <summary>
        /// Converts from enum StarsNumber to int number value.
        /// </summary>
        /// <returns>The stars number as int.</returns>
        /// <param name="starsNumber">Stars number enum.</param>
        public static int ShapeStarsNumberEnumToIntNumber(TableShape.StarsNumber starsNumber)
        {
            if (starsNumber == TableShape.StarsNumber.ZERO)
            {
                return(0);
            }
            else if (starsNumber == TableShape.StarsNumber.ONE)
            {
                return(1);
            }
            else if (starsNumber == TableShape.StarsNumber.TWO)
            {
                return(2);
            }
            else if (starsNumber == TableShape.StarsNumber.THREE)
            {
                return(3);
            }

            return(-1);           //undefined
        }
Exemplo n.º 4
0
    /// <summary>
    /// Get the collected stars for the shapes in the given shapes manager.
    /// </summary>
    /// <returns>The collected stars.</returns>
    /// <param name="shapesManager">Shapes manager.</param>
    public static int GetCollectedStars(ShapesManager shapesManager)
    {
        int ID = 0;
        int cs = 0;

        for (int i = 0; i < shapesManager.shapes.Count; i++)
        {
            ID = (i + 1);
            TableShape.StarsNumber sn = GetShapeStars(ID, shapesManager);
            if (sn == TableShape.StarsNumber.ONE)
            {
                cs += 1;
            }
            else if (sn == TableShape.StarsNumber.TWO)
            {
                cs += 2;
            }
            else if (sn == TableShape.StarsNumber.THREE)
            {
                cs += 3;
            }
        }
        return(cs);
    }
Exemplo n.º 5
0
 /// <summary>
 /// Save the shape stars.
 /// </summary>
 /// <param name="ID">The ID of the shape.</param>
 /// <param name="stars">Stars.</param>
 public static void SaveShapeStars(int ID, TableShape.StarsNumber stars)
 {
     PlayerPrefs.SetInt("Shape-" + ID + "-Stars", CommonUtil.ShapeStarsNumberEnumToIntNumber(stars));
     PlayerPrefs.Save();
 }
Exemplo n.º 6
0
 /// <summary>
 /// Save the number of stars of the given shape
 /// </summary>
 /// <param name="ID">Shape ID.</param>
 /// <param name="stars">Stars.</param>
 /// <param name="shapesManager">Shapes manager.</param>
 public static void SaveShapeStars(int ID, TableShape.StarsNumber stars, ShapesManager shapesManager)
 {
     PlayerPrefs.SetInt(GetStarsStrKey(ID, shapesManager), CommonUtil.ShapeStarsNumberEnumToIntNumber(stars));
     PlayerPrefs.Save();
 }