예제 #1
0
    private void InitItemsThings(int count)
    {
        listItemThings = new List <ItemThings>();

        for (int i = 0; i < count; i++)
        {
            ItemThings itemThings = Instantiate(prefabItem, transform);
            itemThings.SetImage(IconManager.GetRandomSprite1x1());
            listItemThings.Add(itemThings);
        }

        listPool = new List <ItemThings>(listItemThings);
    }
예제 #2
0
 private void SetFillCase(bool[] arrayleft, bool[] arrayRight)
 {
     for (int i = 0; i < arrayleft.Length; i++)
     {
         if (arrayleft[i])
         {
             listItemCasesLeft[i].SetBusy(true);
             listItemCasesLeft[i].SetModeItemCase(ModeItemCase.Located);
             listItemCasesLeft[i].SetImage(IconManager.GetRandomSprite1x1());
         }
         if (arrayRight[i])
         {
             listItemCasesRight[i].SetBusy(true);
             listItemCasesRight[i].SetModeItemCase(ModeItemCase.Located);
             listItemCasesRight[i].SetImage(IconManager.GetRandomSprite1x1());
         }
     }
 }
예제 #3
0
    public void GenerateCase(ConfigureCase configureCase)
    {
        currentConfigure = configureCase;
        ItemDataStrategy itemDataStrategy = new ItemDataStrategy();

        switch (configureCase.ModeSizeCase)
        {
        case ModeSizeCase.Mode2x2W2H2:
            Case2x2 case2X2 = new Case2x2();

            itemDataStrategy = case2X2.Generate(configureCase.CountItems);
            arrayLeft        = itemDataStrategy.list[0];
            arrayRight       = itemDataStrategy.list[1];

            break;

        case ModeSizeCase.Mode2x2W2H3:
            Case2x3 case2X3 = new Case2x3();

            itemDataStrategy = case2X3.Generate(configureCase.CountItems);
            arrayLeft        = itemDataStrategy.list[0];
            arrayRight       = itemDataStrategy.list[1];
            break;

        case ModeSizeCase.Mode2x2W2H4:
            Case2x4 case2X4 = new Case2x4();

            itemDataStrategy = case2X4.Generate(configureCase.CountItems);
            arrayLeft        = itemDataStrategy.list[0];
            arrayRight       = itemDataStrategy.list[1];
            break;

        case ModeSizeCase.Mode2x2x2W2H2:
            Case2x2x2 case2X2X2 = new Case2x2x2();

            itemDataStrategy = case2X2X2.Generate(configureCase.CountItems);
            arrayLeft        = itemDataStrategy.list[0];
            arrayRight       = itemDataStrategy.list[1];
            arrayDown        = itemDataStrategy.list[2];

            //TODO

            //сдвиг по позиции

            //x = -205
            //y = -205
            //Pivot x = 0.5f y = 1

            rectTransformDownBlock.localPosition = new Vector3(-205f, -205f);

            break;

        default:
            break;
        }

        listItemCasesLeft  = new List <ItemCase>();
        listItemCasesRight = new List <ItemCase>();

        InitBlock(listItemCasesLeft, rectTransformLeftBlock);
        InitBlock(listItemCasesRight, rectTransformRightBlock);

        InitBlockCheck();

        //TODo
        if (itemDataStrategy.list.Count == 3)
        {
            listItemCasesDown = new List <ItemCase>();
            InitBlock(listItemCasesDown, rectTransformDownBlock);

            //TODO
            for (int i = 0; i < arrayDown.Length; i++)
            {
                if (arrayDown[i])
                {
                    listItemCasesDown[i].SetBusy(true);
                    listItemCasesDown[i].SetModeItemCase(ModeItemCase.Located);
                    listItemCasesDown[i].SetImage(IconManager.GetRandomSprite1x1());
                }
            }
        }

        SetFillCase(itemDataStrategy.list[0], itemDataStrategy.list[1]);

        UpdateArrays();

        // TODO items error?
        // TODO this TxT
        EventManager.OnInitThings(itemDataStrategy.list[0].Length - configureCase.CountItems);

        //TODO this TxTxT
        // ?
    }