Exemple #1
0
 public static void GenerateGenericPBNColorCellRow(int numCells, PaintByNumbers pbn, Vector2 startPos)
 {
     if (numCells > 0)
     {
         for (int i = 0; i < numCells; i++)
         {
             PBNColorCell newCell = InstantiatePBNColorCell(i, pbn);
             newCell.SetColor(Color.white);
             newCell.transform.SetParent(pbn.transform);
             newCell.rectTransform.position = new Vector2(startPos.x + 100 * i, startPos.y);
         }
     }
 }
    void GenerateCanvasColorCells(bool paintableUI)
    {
        if (pbnColors.CollectionIsNotNullOrEmpty())
        {
            int startX = -400;
            for (int i = 0; i < pbnColors.Length; i++)
            {
                PBNColorCell newCell = PBNColorCell.InstantiatePBNColorCell(i, this);

                Color set = pbnColors[i];
                newCell.SetColor(new Color(set.r, set.g, set.b, 1));

                newCell.transform.SetParent(transform);
                newCell.GetComponent <RectTransform>().localPosition = new Vector3(startX + 200 * i, 400);
            }
        }
        if (paintableUI)
        {
            PBNColorCell.GenerateGenericPBNColorCellRow(10, this, Vector2.up * 300);
        }
    }