Пример #1
0
    public ItemDataStrategy Generate(int items)
    {
        ItemDataStrategy itemDataStrategy = new ItemDataStrategy();

        itemDataStrategy.list = new List <bool[]>();

        bool[] tmp1 = new bool[8];
        bool[] tmp2 = new bool[8];

        if (!CheckCountInItemCase(items, tmp1))
        {
            items = 1;
        }

        if (items == 1)
        {
            OneItemInCase(16, tmp1, tmp2);
        }

        if (items == 2)
        {
            TwoItemInCase(8, 8, tmp1, tmp2);
        }

        if (items == 3)
        {
            string str = GenerationStr("123", 4, "00000");
            FillArray(str, tmp1, tmp2);
        }

        if (items == 4)
        {
            string str = GenerationStr("1234", 5, "0000");
            FillArray(str, tmp1, tmp2);
        }

        if (items == 5)
        {
            string str = GenerationStr("12345", 6, "000");
            FillArray(str, tmp1, tmp2);
        }

        if (items == 6)
        {
            string str = GenerationStr("123456", 7, "00");
            FillArray(str, tmp1, tmp2);
        }

        if (items == 7)
        {
            string str = GenerationStr("1234567", 8, "0");
            FillArray(str, tmp1, tmp2);
        }

        itemDataStrategy.list.Add(tmp1);
        itemDataStrategy.list.Add(tmp2);

        return(itemDataStrategy);
    }
Пример #2
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
        // ?
    }
Пример #3
0
    public ItemDataStrategy Generate(int items)
    {
        ItemDataStrategy itemDataStrategy = new ItemDataStrategy();

        itemDataStrategy.list = new List <bool[]>();

        bool[] tmp1      = new bool[4];
        bool[] tmp2      = new bool[4];
        bool[] addedTmp3 = new bool[4];

        if (!CheckCountInItemCase(items, tmp1))
        {
            items = 1;
        }

        if (items == 1)
        {
            // 1 вариант
            // все addedTmp3 false
            OneItemInCase(16, tmp1, tmp2);

            // 2 вариант
            // все tmp1 false
            // OneItemInCase(16, addedTmp3, tmp2);

            // 3 вариант
            // все tmp2 false
            // OneItemInCase(16, tmp1, addedTmp3);
        }

        if (items == 2)
        {
            //1 вариант
            // все addedTmp3 false
            TwoItemInCase(8, 8, tmp1, tmp2);

            //2 вариант
            // все tmp1 false
            TwoItemInCase(8, 8, addedTmp3, tmp2);

            //3 вариант
            // все tmp2 false
            TwoItemInCase(8, 8, tmp1, addedTmp3);

            // 4-6 варианты смешивания не буду реализовывать
        }

        if (items == 3)
        {
            // 1 вариант
            // все addedTmp3 false
            string str = GenerationStr("123", 4, "00000");
            FillArray(str, tmp1, tmp2);

            // 2 вариант
            // все tmp1 false
            str = GenerationStr("123", 4, "00000");
            FillArray(str, addedTmp3, tmp2);


            // 3 вариант
            // все tmp2 false
            str = GenerationStr("123", 4, "00000");
            FillArray(str, tmp1, addedTmp3);

            // 4- .. варианты не будут реализованы
        }

        itemDataStrategy.list.Add(tmp1);
        itemDataStrategy.list.Add(tmp2);
        itemDataStrategy.list.Add(addedTmp3);


        return(itemDataStrategy);
    }