예제 #1
0
    public void LoadData(List <SlotTrait> colorTraits)
    {
        layout = new ViewLayout2DR(8f, 1f, 8, 1);
        UnityExtension.DestroyAllChildren(cellRoot);
        for (int i = 0; i < traitColors.Length; i++)
        {
            var cell = GameObject.Instantiate(pfbCell);
            var sa   = new SlotAttribute(SlotAttribute.Category.TARGET);
            sa.trait = new SlotTraitColor((byte)(traitColors[i].r * 255),
                                          (byte)(traitColors[i].g * 255),
                                          (byte)(traitColors[i].b * 255),
                                          255);
            cell.Init(sa, layout.CellSize);
            cell.transform.SetParent(cellRoot.transform, layout.Logic2View(new Pos2D(i, 0)), cell.transform.localScale);
            cells[i] = cell;

            foreach (var ct in colorTraits)
            {
                if (sa.trait.AbsoluteEqual(ct))
                {
                    cell.SetSelected(true);
                }
            }
        }
    }