Exemplo n.º 1
0
 private void SetCardPlane(int[] cardId)
 {
     for (int i = 0; i < m_cardShow.Count; i++)
     {
         m_cardShow[i].SafeSetActive(false);
     }
     for (int i = 0; i < cardId.Length; i++)
     {
         if (i >= m_cardShow.Count)
         {
             continue;
         }
         if (m_cardShow[i] == null)
         {
             continue;
         }
         m_cardShow[i].SafeSetActive(true);
         var card = ConfigManager.Get <CardInfo>(cardId[i]);
         if (card == null)
         {
             continue;
         }
         AtlasHelper.SetHuazha(m_cardShow[i], card.icon);
     }
 }
Exemplo n.º 2
0
    private void SetCardInfo(Toggle btn, int index)
    {
        if (btn == null || moduleUnion.CardSignInfo == null)
        {
            return;
        }
        var key  = moduleUnion.CardSignInfo.cardId[index];
        var info = ConfigManager.Get <CardInfo>(key);

        btn.onValueChanged.RemoveAllListeners();
        AtlasHelper.SetHuazha(btn.gameObject, info?.icon);
        btn.isOn = m_tChick.Exists(a => a == key);
        btn.onValueChanged.AddListener(delegate
        {
            var t = m_tChick.Exists(a => a == key);
            if (!btn.isOn && t)
            {
                m_tChick.Remove(key);
            }
            else if (btn.isOn && !t)
            {
                m_tChick.Add(key);
            }
        });
    }
Exemplo n.º 3
0
    private void SetRulePlane(RectTransform rt, CardTypeInfo info)
    {
        if (info == null)
        {
            return;
        }

        var desc = rt.Find("desc").GetComponent <Text>();

        Util.SetText(desc, info.descId);
        var point = rt.Find("bg/time_txt").GetComponent <Text>();
        var pTxt  = string.Format(ConfigText.GetDefalutString(629, 16), info.point);
        var title = string.Format("{0} {1}", ConfigText.GetDefalutString(info.nameId), pTxt);

        Util.SetText(point, title);
        List <RectTransform> typeList = new List <RectTransform>();
        var typeGroup = rt.Find("itemGroup").GetComponent <RectTransform>();

        foreach (RectTransform item in typeGroup)
        {
            item.gameObject.SetActive(false);
            typeList.Add(item);
        }
        for (int i = 0; i < info.cardId.Length; i++)
        {
            if (i >= typeList.Count)
            {
                continue;
            }
            typeList[i].SafeSetActive(true);
            var card = ConfigManager.Get <CardInfo>(info.cardId[i]);
            if (card == null)
            {
                continue;
            }
            var c = typeList[i].Find("card");
            AtlasHelper.SetHuazha(c.gameObject, card.icon);
        }
        var btn = typeGroup.GetComponentDefault <Button>();

        btn.onClick.AddListener(delegate
        {
            SetCardPlane(info.cardId);
        });
    }