Пример #1
0
    void change(bool isCheck)
    {
        Vector3 vt = transform.localPosition;

        switch (_align)
        {
        case Align.None:
            break;

        case Align.Left:
            vt.x = transform.localPosition.x - rect1.rect.width / 2 - 10;
            break;

        case Align.Right:
            vt.x = transform.localPosition.x + rect1.rect.width / 2 + 10;
            break;

        case Align.Top:
            vt.y = transform.localPosition.y + rect1.rect.height / 2 + 10;
            break;

        case Align.Bot:
            vt.y = transform.localPosition.y - rect1.rect.height / 2 - 10;
            break;
        }
        if (OBJ != null)
        {
            OBJ.transform.localPosition = vt;
            OBJ.gameObject.SetActive(isCheck);
            if (user != null)
            {
                OBJ.name_player = user.getName();
            }
            OBJ.tg = this.tg;
        }
    }
Пример #2
0
    public void click()
    {
        if (player.getName().Equals(BaseInfo.gI().mainInfo.nick))
        {
            int len = 0;
            if (arrayCard == null)
            {
                return;
            }
            if (arrayCard.getArrCardChoose() != null)
            {
                len = arrayCard.getArrCardChoose().Length;
            }

            if (len != 0)
            {
                if (card.isChoose)
                {
                }
                else
                {
                    int value1 = TLMNChooseCard.getValue(card.getId());
                    int value2 = TLMNChooseCard.getValue(arrayCard.getArrCardChoose()[len - 1]);
                    if (!(value1 == value2) &&
                        !(value1 == value2 + 1) &&
                        !(RTL.getCardInfo(card.getId())[1] == RTL
                          .getCardInfo(arrayCard.getArrCardChoose()[len - 1])[1] - 1))
                    {
                        int valuve3 = RTL.getCardInfo(arrayCard.getArrCardChoose()[0])[1];
                        if (!(value1 == valuve3) && !(value1 == valuve3 + 1) && !(value1 == valuve3 - 1))
                        {
                            if (!TLMNChooseCard.issanh2(TLMNPlayer.sort(RTL.insertArray(arrayCard.getArrCardChoose(),
                                                                                        card.getId()))) &&
                                !TLMNChooseCard
                                .isdoi(RTL.insertArray(arrayCard.getArrCardChoose(), card.getId())) &&
                                !TLMNChooseCard
                                .issam(RTL.insertArray(arrayCard.getArrCardChoose(), card.getId())))
                            {
                                for (int i = 0; i < arrayCard.getSize(); i++)
                                {
                                    arrayCard.getCardbyPos(i).setChoose(false);
                                }
                                len = 0;
                            }
                        }
                    }

                    if (tlmnStage != null && tlmnStage.tableArrCard != null && arrayCard.getArrCardChoose() != null &&
                        arrayCard.getArrCardChoose().Length > 0)
                    {
                        if (!TLMNChooseCard.issanh2(TLMNPlayer.sort(RTL.insertArray(arrayCard.getArrCardChoose(),
                                                                                    card.getId()))) &&
                            !TLMNChooseCard.isdoi(RTL.insertArray(arrayCard.getArrCardChoose(), card.getId())) &&
                            !TLMNChooseCard.issam(RTL.insertArray(arrayCard.getArrCardChoose(), card.getId())))
                        {
                            for (int i = 0; i < arrayCard.getSize(); i++)
                            {
                                arrayCard.getCardbyPos(i).setChoose(false);
                            }
                            len = 0;
                        }
                    }
                }
            }

            card.setChoose(!card.isChoose);

            if (tlmnStage != null && tlmnStage.tableArrCard != null)
            {
                if (tlmnStage.tableArrCard.Length > 0 && len == 0)
                {
                    int indexCardChoose = -1;
                    if (arrayCard.getArrCardChoose() == null)
                    {
                        return;
                    }
                    if (arrayCard.getArrCardChoose().Length == 1)
                    {
                        for (int i = 0; i < arrayCard.getArrCardAll().Length; i++)
                        {
                            if (arrayCard.getArrCardAll()[i] == card.getId())
                            {
                                indexCardChoose = i;
                            }
                        }
                        if (indexCardChoose != -1)
                        {
                            int[] index = TLMNChooseCard.getArrIndexCardNhac(indexCardChoose,
                                                                             arrayCard.getArrCardAll(), tlmnStage.tableArrCard);
                            if (index != null)
                            {
                                for (int i = 0; i < index.Length; i++)
                                {
                                    Card cardNhac = arrayCard.getCardbyPos(index[i]);
                                    if (cardNhac != null)
                                    {
                                        cardNhac.setChoose(true);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                if (arrayCard.getArrCardChoose() == null)
                {
                    return;
                }
                if (arrayCard.getArrCardChoose().Length == 2 && card.isChoose)
                {
                    int[] index = TLMNChooseCard.getArrIndexCardNhac(arrayCard.getArrCardChoose(),
                                                                     arrayCard.getArrCardAll());
                    if (index != null)
                    {
                        for (int i = 0; i < index.Length; i++)
                        {
                            Card cardNhac = arrayCard.getCardbyPos(index[i]);
                            if (cardNhac != null)
                            {
                                cardNhac.setChoose(true);
                            }
                        }
                    }
                    if (index != null && index.Length < 2)
                    {
                        if (!TLMNChooseCard.issanh2(arrayCard.getArrCardChoose()))
                        {
                            for (int i = 0; i < arrayCard.getSize(); i++)
                            {
                                arrayCard.getCardbyPos(i).setChoose(false);
                            }
                            card.setChoose(!card.isChoose);
                        }
                    }
                }
                else if (arrayCard.getArrCardChoose().Length >= 2 && card.isChoose)
                {
                    if (!TLMNChooseCard.issanh2(arrayCard.getArrCardChoose()))
                    {
                        for (int i = 0; i < arrayCard.getSize(); i++)
                        {
                            arrayCard.getCardbyPos(i).setChoose(false);
                        }
                        card.setChoose(!card.isChoose);
                    }
                }
                else if (arrayCard.getArrCardChoose().Length >= 2 && !card.isChoose)
                {
                    // int indexCardChoose = -1;
                    // for (int i = 0; i < arrayCard.getArrCardAll().Length;
                    // i++) {
                    // if (arrayCard.getArrCardAll()[i] == card.getId()) {
                    // indexCardChoose = i;
                    // }
                    // }
                    // if (indexCardChoose != -1) {
                    // for (int i = indexCardChoose; i <
                    // arrayCard.getArrCardAll().Length; i++) {
                    // arrayCard.getCardbyPos(i).setChoose(false);
                    // }
                    // }
                }
            }
        }
    }