Esempio n. 1
0
    public static string GetAwardSpriteName(int AwardId)
    {
        string _result = null;

        EM_OBJECT_CLASS _awardClass = GameUtils.GetObjectClassById(AwardId);

        switch (_awardClass)
        {
        case EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES:
            ResourceindexTemplate _resTable = DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(AwardId) as ResourceindexTemplate;
            if (_resTable != null)
            {
                _result = _resTable.getIcon3();
            }
            break;

        case EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE:
            ItemTemplate _itemTable = DataTemplate.GetInstance().m_ItemTable.getTableData(AwardId) as ItemTemplate;
            if (_itemTable != null)
            {
                _result = _itemTable.getIcon_s();
            }
            break;

        case EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON:
            ItemTemplate _runeTable = DataTemplate.GetInstance().m_ItemTable.getTableData(AwardId) as ItemTemplate;
            if (_runeTable != null)
            {
                _result = _runeTable.getIcon_s();
            }
            break;

        case EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO:
            HeroTemplate _heroTable = DataTemplate.GetInstance().m_HeroTable.getTableData(AwardId) as HeroTemplate;

            if (_heroTable != null)
            {
                ArtresourceTemplate _atrResTable = DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_heroTable.getArtresources()) as ArtresourceTemplate;
                _result = _atrResTable.getHeadiconresource();
            }
            break;

        case EM_OBJECT_CLASS.EM_OBJECT_CLASS_SKIN:
            ArtresourceTemplate _atrResTable1 = DataTemplate.GetInstance().m_ArtresourceTable.getTableData(AwardId) as ArtresourceTemplate;
            if (_atrResTable1 != null)
            {
                _result = _atrResTable1.getHeadiconresource();
            }
            break;

        default:
            break;
        }

        return(_result);
    }
Esempio n. 2
0
    public void Init(int ID, int isReceive)
    {
        //int itemid = ID / 1000000;
        if (isReceive == 0)
        {
            ReceiveGo.SetActive(false);
        }
        else
        {
            ReceiveGo.SetActive(true);
        }

        InnerdropTemplate item = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(ID);

        NumText.text = "x" + item.getDropnum().ToString();
        int _goid  = item.getObjectid();//掉落物ID
        int itemid = item.getObjectid() / 1000000;

        switch (itemid)
        {
        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES:     //资源
            ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(_goid);
            if (_temp_res != null)
            {
                GoName.text = GameUtils.getString(_temp_res.getName());
                string _tempIconNam_1 = _temp_res.getIcon3();
                SpriteImage.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_1);
            }
            break;

        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE:    //符文
            ItemTemplate _temp_rune = (ItemTemplate)DataTemplate.GetInstance().GetItemTemplateById(_goid);
            if (_temp_rune != null)
            {
                GoName.text = GameUtils.getString(_temp_rune.getName());
                SpriteImage.gameObject.SetActive(false);
                RuneIcon.SetActive(true);
                ShowRune(_temp_rune);
            }
            break;

        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON:     //道具
            ItemTemplate _temp_common = (ItemTemplate)DataTemplate.GetInstance().GetItemTemplateById(_goid);
            if (_temp_common != null)
            {
                GoName.text = GameUtils.getString(_temp_common.getName());
                string _tempIconNam_3 = _temp_common.getIcon_s();
                SpriteImage.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_3);
            }
            break;

        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO:     //英雄
            HeroTemplate _temp_hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(_goid);
            if (_temp_hero != null)
            {
                GoName.text = GameUtils.getString(_temp_hero.getNameID());
                int _tempIconNam_4 = _temp_hero.getArtresources();

                ArtresourceTemplate _temp_Art = (ArtresourceTemplate)DataTemplate.GetInstance().GetArtResourceTemplate(_tempIconNam_4);
                string _tempIconNam_5         = _temp_Art.getHeadiconresource();
                SpriteImage.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_5);

                NumText.transform.parent.gameObject.SetActive(false);
                this.star.gameObject.SetActive(true);
                int star    = _temp_hero.getQuality();
                int maxStar = _temp_hero.getMaxQuality();
                this.star.Set(star, maxStar);
            }
            break;

        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_SKIN:     //皮肤
            ArtresourceTemplate _temp_Art_2 = (ArtresourceTemplate)DataTemplate.GetInstance().GetArtResourceTemplate(_goid);
            if (_temp_Art_2 != null)
            {
                GoName.text = GameUtils.getString(_temp_Art_2.getNameID());
                string _tempIconNam_6 = _temp_Art_2.getHeadiconresource();
                SpriteImage.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_6);
            }
            break;
        }
    }
Esempio n. 3
0
    public void Data(object data)
    {
        InnerdropTemplate value = data as InnerdropTemplate;

        if (value == null)
        {
            return;
        }

        int itemid = value.getObjectid();
        int type   = itemid / 1000000;

        switch (type)
        {
        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES:
            ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid);
            if (_temp_res != null)
            {
                this.desc.text = GameUtils.getString(_temp_res.getName());
                string _tempIconNam_1 = _temp_res.getIcon3();
                this.icon.sprite  = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_1);
                this.numText.text = "x" + value.getDropnum();
            }
            break;

        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE:     //符文
        {
            ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(value.getObjectid());
            this.desc.text = GameUtils.getString(itemTable.getName());
            this.icon.gameObject.SetActive(false);
            RuneIcon.SetActive(true);
            ShowRune(itemTable);
        }
        break;

        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON:
        {
            ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(value.getObjectid());
            //UI_RewardsItemManage uifigt = item.GetComponent<UI_RewardsItemManage>();
            //uifigt.id = value.getObjectid();
            //uifigt.typeNum = 2;
            this.desc.text           = GameUtils.getString(itemTable.getName());
            this.icon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + itemTable.getIcon());
            this.numText.text        = "x" + value.getDropnum().ToString();
        }
        break;

        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO:
        {
            HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(value.getObjectid());
            //UI_RewardsItemManage uihero = item.GetComponent<UI_RewardsItemManage>();
            //uihero.id = inner.getObjectid();
            //uihero.typeNum = 3;
            this.desc.text = GameUtils.getString(hero.getTitleID());        //"英雄";
            ArtresourceTemplate art = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(hero.getArtresources());
            this.icon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + art.getHeadiconresource());
            int star    = hero.getQuality();
            int maxStar = hero.getMaxQuality();
            this.star.Set(star, maxStar);
        }
        break;

        default:
            break;
        }
    }
Esempio n. 4
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++;
                    }
                }
            }
        }
    }
Esempio n. 5
0
    public void GiftShows()
    {
        // GameEventDispatcher.Inst.dispatchEvent(GameEventID.KE_KnapsackUpdateShow);
        for (int i = 0; i < itemList.Count; i++)
        {
            Destroy(itemList[i]);
        }
        itemList.Clear();
        giftList = UI_ItemsManage._instance.giftIDList;
        for (int i = 0; i < giftList.Count; i++)
        {
            InnerdropTemplate inner = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(giftList[i]);
            int itemid = inner.getObjectid() / 1000000;
            switch (itemid)
            {
            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES:
                if (itemid == 1400)
                {
                    GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Bag/item"), transform.position, transform.rotation) as GameObject;
                    item.transform.parent     = mGrid;
                    item.transform.localScale = Vector3.one;
                    UI_RewardsItemManage  uifigt = item.GetComponent <UI_RewardsItemManage>();
                    ResourceindexTemplate itemT  = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(inner.getObjectid());
                    uifigt.mName.text = GameUtils.getString(itemT.getName());
                    itemT.getIcon3();
                    uifigt.mIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + itemT.getIcon3());
                    uifigt.mNum.text            = "x" + inner.getDropnum();
                    itemList.Add(item);
                }
                break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE:
            {
                GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Bag/rune"), transform.position, transform.rotation) as GameObject;
                item.transform.parent     = mGrid;
                item.transform.localScale = Vector3.one;
                ItemTemplate         itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(inner.getObjectid());
                UI_RewardsItemManage uifigt    = item.GetComponent <UI_RewardsItemManage>();
                uifigt.mName.text           = GameUtils.getString(itemTable.getName());
                uifigt.typeNum              = 1;
                uifigt.id                   = inner.getObjectid();
                uifigt.mIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + itemTable.getIcon());
                uifigt.mNum.text            = "x" + inner.getDropnum().ToString();
                itemList.Add(item);
            }
            break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON:
            {
                GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Bag/item"), transform.position, transform.rotation) as GameObject;
                item.transform.parent     = mGrid;
                item.transform.localScale = Vector3.one;
                ItemTemplate         itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(inner.getObjectid());
                UI_RewardsItemManage uifigt    = item.GetComponent <UI_RewardsItemManage>();
                uifigt.id                   = inner.getObjectid();
                uifigt.typeNum              = 2;
                uifigt.mName.text           = GameUtils.getString(itemTable.getName());
                uifigt.mIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + itemTable.getIcon());
                uifigt.mNum.text            = "x" + inner.getDropnum().ToString();
                itemList.Add(item);
            }
            break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO:
            {
                GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Bag/hero"), transform.position, transform.rotation) as GameObject;
                item.transform.parent     = mGrid;
                item.transform.localScale = Vector3.one;
                HeroTemplate         hero   = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(inner.getObjectid());
                UI_RewardsItemManage uihero = item.GetComponent <UI_RewardsItemManage>();
                uihero.id         = inner.getObjectid();
                uihero.typeNum    = 3;
                uihero.mName.text = GameUtils.getString(hero.getTitleID());        //"英雄";
                ArtresourceTemplate art = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(hero.getArtresources());
                uihero.mIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + art.getHeadiconresource());
                int star    = hero.getQuality();
                int maxStar = hero.getMaxQuality();
                for (int j = 0; j < 5; j++)
                {
                    uihero.starList[j].SetActive(j < star);
                    uihero.starList[j + 5].SetActive(j < maxStar);
                }

                itemList.Add(item);
            }
            break;

            default:
                break;
            }
        }
    }