Esempio n. 1
0
    // 更新界面右边 Item 显示
    void UpdateRightItem()
    {
        for (int i = 0; i < m_RightLayout.transform.childCount; ++i)
        {
            m_RightLayout.transform.GetChild(i).gameObject.SetActive(false);
        }

        // 是否有月卡专属
        int count = 0;

        if (ObjectSelf.GetInstance().ismonthfirsthave == 1)
        {
            Text tipsText = m_RightLayout.transform.GetChild(count).GetComponent <Text>();
            tipsText.text = GameUtils.getString("treasure_event11_des");
            tipsText.gameObject.SetActive(true);
            count += 1;
        }

        bool ret = false;

        foreach (var item in ObjectSelf.GetInstance().superlist)
        {
            RuintreasureTemplate temp = (RuintreasureTemplate)DataTemplate.GetInstance().m_RuintreasureTable.getTableData(item);
            if (temp != null)
            {
                if (temp.getId() == 100007)
                {
                    //
                    //TODO...
                    ret = true;
                }

                Text tipsText = m_RightLayout.transform.GetChild(count).GetComponent <Text>();
                tipsText.text = GameUtils.getString(temp.getParameter2());
                tipsText.gameObject.SetActive(true);
            }

            count++;
        }

        // 本次免费
        if (ret)
        {
            m_RefreshTipsText.gameObject.SetActive(true);
            m_RefreshBtn.transform.FindChild("Image").gameObject.SetActive(false);
            m_ReDiamondNum.gameObject.SetActive(false);
        }
        else
        {
            m_RefreshTipsText.gameObject.SetActive(false);
            m_RefreshBtn.transform.FindChild("Image").gameObject.SetActive(true);
            m_ReDiamondNum.gameObject.SetActive(true);
        }
    }
Esempio n. 2
0
    // 更新界面中间 Item 显示
    void UpdateCenterItem()
    {
        for (int i = 1; i <= ObjectSelf.GetInstance().lotteryitemmap.Count; i++)
        {
            if (ObjectSelf.GetInstance().lotteryitemmap.ContainsKey(i))
            {
                LotteryItemlayer lotery = ObjectSelf.GetInstance().lotteryitemmap[i] as LotteryItemlayer;
                if (lotery != null)
                {
                    GameObject item = m_ItemLayout.transform.GetChild(i - 1).gameObject;
                    item.SetActive(true);
                    string str = "treasure_content" + i.ToString();
                    item.transform.FindChild("LayerText").GetComponent <Text>().text = GameUtils.getString(str);
                    GameObject Goods = item.transform.FindChild("Goods").gameObject;                      // goods

                    if (ObjectSelf.GetInstance().mapkey == i)
                    {
                        item.transform.FindChild("BgIndex").gameObject.SetActive(true);
                    }
                    else
                    {
                        item.transform.FindChild("BgIndex").gameObject.SetActive(false);
                    }

                    int j = 0;
                    foreach (var lotteryItem in lotery.lotteryitemlist)
                    {
                        LotteryItem lotItem = lotteryItem;

                        RuintreasureTemplate temp = (RuintreasureTemplate)DataTemplate.GetInstance().m_RuintreasureTable.getTableData(lotteryItem.id);

                        GameObject goods = Goods.transform.GetChild(lotItem.viewnum - 1).gameObject;
                        goods.gameObject.SetActive(true);

                        // 取消显示所有星级
                        GameObject starLevel = goods.transform.Find("UI_Star_Level").gameObject;
                        starLevel.SetActive(false);
                        for (int k = 0; k < 5; ++k)
                        {
                            starLevel.transform.GetChild(k).gameObject.SetActive(false);
                        }


                        if (lotItem.isget == 1)                           // 已领取
                        {
                            GameObject reached = goods.transform.FindChild("Reached").gameObject;
                            reached.SetActive(true);

                            // 特殊事件,显示特殊字
                            if (lotItem.superid == 100001 || lotItem.superid == 100008 || lotItem.superid == 100009)
                            {
                                reached.transform.FindChild("TipsText").GetComponent <Text>().text = "X3";
                            }
                            else if (lotItem.superid == 100002)
                            {
                                reached.transform.FindChild("TipsText").GetComponent <Text>().text = "X2";
                            }
                            else
                            {
                                reached.transform.FindChild("TipsText").GetComponent <Text>().text = GameUtils.getString("shop_content29");
                            }
                        }
                        else
                        {
                            GameObject reached = goods.transform.FindChild("Reached").gameObject;
                            reached.SetActive(false);
                        }

                        // 事件
                        if (temp.getType() == 2)
                        {
                            Image icon = goods.transform.FindChild("Icon").GetComponent <Image>();
                            icon.gameObject.SetActive(false);
                            goods.transform.FindChild("qiyu").gameObject.SetActive(true);
                            //icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + "UI_baozang_6");
                            //icon.sprite = Resources.Load<Sprite>(temp.getIcon());
                            goods.transform.FindChild("NumberText").gameObject.SetActive(false);
                        }
                        else                          // 物品
                        {
                            goods.transform.FindChild("qiyu").gameObject.SetActive(false);
                            Image icon = goods.transform.FindChild("Icon").GetComponent <Image>();
                            icon.gameObject.SetActive(true);
                            //icon.sprite = Resources.Load<Sprite>("UI/Sprites/UI_baozang_6.png");

                            int             ID   = temp.getParameter1();
                            EM_OBJECT_CLASS type = GameUtils.GetObjectClassById(ID);

                            if (type == EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON || type == EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE)                              // 道具 对应数据表26
                            {
                                ItemTemplate itemTemp = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(ID);
                                icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + itemTemp.getIcon_s());

                                // 显示符文星级

                                if (type == EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE)
                                {
                                    int        quality = itemTemp.getRune_quality();
                                    GameObject star    = goods.transform.Find("UI_Star_Level").gameObject;
                                    star.SetActive(true);
                                    for (int k = 0; k < quality; ++k)
                                    {
                                        star.transform.GetChild(k).gameObject.SetActive(true);
                                    }
                                }



                                //Debug.Log(i + "   " + j + "   EM_OBJECT_CLASS_COMMON " + temp.getId() + "   " + itemTemp.getIcon_s() + "   " + lotteryItem.id);
                            }
                            else if (type == EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES)                               // 资源 对应数据表53
                            {
                                ResourceindexTemplate resTemp = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(ID);

                                icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + resTemp.getIcon3());

                                //Debug.Log(i + "   " + j + "   EM_OBJECT_CLASS_RES " + temp.getId() + "   " + resTemp.getIcon3() + "   " + lotteryItem.id);
                            }
                            else
                            {
                                Debug.Log(i + "   " + j + "   other " + temp.getId() + " " + lotteryItem.id);
                            }

                            goods.transform.FindChild("NumberText").gameObject.SetActive(true);
                            goods.transform.FindChild("NumberText").GetComponent <Text>().text = temp.getParameter2();
                        }


                        j++;
                    }
                }
            }
        }
    }