Ejemplo n.º 1
0
    public void OnDrawListChannel()
    {
        //money type=="" la giai dau
        List <ChannelChan> channelSelect = listChannel.FindAll(c => c.moneyType == GameManager.PlayGoldOrChip || string.IsNullOrEmpty(c.moneyType));

        //disable all button
        for (int i = 0; i < listButton.Count; i++)
        {
            DisableChannelButton(listButton[i].gameObject);
            NumberUserInChannel number = listButton[i].GetComponentInChildren <NumberUserInChannel>();
            if (number)
            {
                number.lblDecription.text = "";
                number.SetValue(0);
            }
        }

        if (channelSelect.Count == 0)
        {
            return;
        }

        for (int i = 0; i < channelSelect.Count; i++)
        {
            //GameObject button = listButton.Find(x => x.GetComponent<UIContainerAnonymous>().valueString == channelSelect[i].roomName).gameObject;
            GameObject button = listButton.Find(x => channelSelect[i].roomName.StartsWith(x.GetComponent <UIContainerAnonymous>().valueString)).gameObject;

            if (string.IsNullOrEmpty(channelSelect[i].moneyType) || channelSelect[i].minimumMoney <= (GameManager.PlayGoldOrChip == "gold" ? GameManager.Instance.mInfo.gold : GameManager.Instance.mInfo.chip))
            {
                if (button)
                {
                    EnableChannelButton(button);
                }
            }
            int index = checkNumberUser(channelSelect[i]);
            if (i == 4) // Làm mờ nút giải đấu
            {
                DisableChannelButton(button);
            }
            if (button)
            {
                NumberUserInChannel number = button.GetComponentInChildren <NumberUserInChannel>();
                if (number != null)
                {
                    number.SetValue(index);
                    string text = GameManager.PlayGoldOrChip == "chip" ? "Chip >" : "Gold >";
                    text += Utility.Convert.Chip(channelSelect[i].minimumMoney);
                    if (channelSelect[i].minimumMoney == 0)
                    {
                        text = "Phòng tự do";
                    }
                    number.lblDecription.text = text;
                }
            }
        }
    }
Ejemplo n.º 2
0
    void OnDrawListChannel()
    {
        //for (int i = 0; i < OpaticalObject.Count; i++)
        //    GameObject.Destroy(OpaticalObject[0]);
        //OpaticalObject.Clear();

        //int count = listChannel.Count - 1;
        //for (int i = 0; i < listButton.Count; i++)
        //{
        //    if ((listChannel.Count - 1 >= i && listChannel[listButton[i].GetComponent<UIContainerAnonymous>().valueInt - 1].minimumMoney >= GameManager.Instance.mInfo.chip)
        //        ||
        //        count < i
        //        )
        //    {
        //        if (listButton[i].gameObject.GetComponentInChildren<UILabel>() != null)
        //        {
        //            Color c = listButton[i].gameObject.GetComponentInChildren<UILabel>().color;
        //            c.a = 70 / 255f;
        //            listButton[i].gameObject.GetComponentInChildren<UILabel>().color = c;
        //        }
        //        Color gameObjectColor = new Color();
        //        gameObjectColor.r = 120f / 255f;
        //        gameObjectColor.g = 120f / 255f;
        //        gameObjectColor.b = 120f / 255f;
        //        gameObjectColor.a = 200f / 255f;

        //        Array.ForEach<UISprite>(listButton[i].GetComponentsInChildren<UISprite>(), s => { s.color = gameObjectColor; });
        //        listButton[i].collider.enabled = false;
        //    }
        //    else if ((listChannel.Count - 1 >= i && listChannel[listButton[i].GetComponent<UIContainerAnonymous>().valueInt - 1].minimumMoney <= GameManager.Instance.mInfo.chip) || count < i)
        //    {
        //        Color gameObjectColor = new Color();
        //        gameObjectColor.r = 255f / 255f;
        //        gameObjectColor.g = 255f / 255f;
        //        gameObjectColor.b = 255f / 255f;
        //        gameObjectColor.a = 255f / 255f;

        //        Array.ForEach<UISprite>(listButton[i].GetComponentsInChildren<UISprite>(), s => { s.color = gameObjectColor; });
        //        listButton[i].collider.enabled = true;
        //    }
        //}

        //for (int i = 0; i < listChip.Count; i++)
        //{
        //    listChannel[i].type = (ChannelTLMN.ChannelType)i;
        //    int index = checkNumberUser(listChannel[i]);
        //    listButton[i].GetComponentInChildren<NumberUserInChannel>().SetValue(index);
        //    string text = "Chip > " + Utility.Convert.Chip(listChannel[i].minimumMoney);
        //    if (listChannel[i].minimumMoney == 0)
        //        text = "Phòng tự do";

        //    listChip[i].text = text;
        //}

        List <ChannelTLMN> channelSelect = listChannel.FindAll(c => c.moneyType == GameManager.PlayGoldOrChip || string.IsNullOrEmpty(c.moneyType));

        //disable all button
        for (int i = 0; i < listButton.Count; i++)
        {
            DisableChannelButton(listButton[i].gameObject);
            NumberUserInChannel number = listButton[i].GetComponentInChildren <NumberUserInChannel>();
            if (number)
            {
                //number.lblDecription.text = "";
                number.SetValue(0);
            }
        }

        if (channelSelect.Count == 0)
        {
            return;
        }

        for (int i = 0; i < channelSelect.Count; i++)
        {
            //GameObject button = listButton.Find(x => x.GetComponent<UIContainerAnonymous>().valueString == channelSelect[i].roomName).gameObject;
            GameObject button = listButton.Find(x => channelSelect[i].roomName.StartsWith(x.GetComponent <UIContainerAnonymous>().valueString)).gameObject;

            if (string.IsNullOrEmpty(channelSelect[i].moneyType) || channelSelect[i].minimumMoney <= (GameManager.PlayGoldOrChip == Fields.StatusPlayer.GOLD ? GameManager.Instance.mInfo.gold : GameManager.Instance.mInfo.chip))
            {
                if (button)
                {
                    EnableChannelButton(button);
                }
            }
            int index = checkNumberUser(channelSelect[i]);
            if (i == 4) // Làm mờ nút giải đấu
            {
                DisableChannelButton(button);
            }
            if (button)
            {
                NumberUserInChannel number = button.GetComponentInChildren <NumberUserInChannel>();
                if (number != null)
                {
                    number.SetValue(index);
                    string text = GameManager.PlayGoldOrChip == Fields.StatusPlayer.CHIP ? "Chip >" : "Gold >";
                    text += Utility.Convert.Chip(channelSelect[i].minimumMoney);
                    if (channelSelect[i].minimumMoney == 0)
                    {
                        text = "Phòng tự do";
                    }
                    //number.lblDecription.text = text;
                    listChip[i].text = text;
                }
            }
        }
    }