Exemple #1
0
    public void UpdateItemUI(GameObject cell, SlgPB.PrizeItem prizeItem)
    {
        UITexture texture = cell.transform.Find("Texture").GetComponent <UITexture>();
        UILabel   label   = cell.transform.Find("Label").GetComponent <UILabel> ();

        label.text = prizeItem.num + "";
    }
        public List <SlgPB.PrizeItem> ToPrizeItems()
        {
            List <SlgPB.PrizeItem> dropGroup = new List <SlgPB.PrizeItem> ();

            foreach (DataDrop drop in drops)
            {
                int itemIdCount = drop.itemIds.Length;
                if (itemIdCount <= 0)
                {
                    SlgPB.PrizeItem item = new SlgPB.PrizeItem();
                    item.type = drop.itemType;
                    item.num  = drop.baseNum;
                    dropGroup.Add(item);
                }
                else
                {
                    foreach (int itemId in drop.itemIds)
                    {
                        SlgPB.PrizeItem item = new SlgPB.PrizeItem();
                        item.type   = drop.itemType;
                        item.itemId = itemId;
                        item.num    = drop.baseNum;

                        dropGroup.Add(item);
                    }
                }
            }

            return(dropGroup);
        }
Exemple #3
0
    IEnumerator PlayPropsAnimation(GameObject item, int index)
    {
        SlgPB.MultiPrizeItem   multiPrizeItem = InstancePlayer.instance.multiFightPrizeItems[index];
        List <SlgPB.PrizeItem> prizeItems     = multiPrizeItem.prizeItems;

        int itemCount = prizeItems.Count;

        for (int i = 0; i < ITME_PROPS_COUNT; ++i)
        {
            GameObject props = item.transform.Find("Bg_Sprite_" + i).gameObject;
            if (i < itemCount)
            {
                props.SetActive(true);
                props.transform.localScale = new Vector3(0.0f, 0.0f, 0.0f);
                iTween.ScaleTo(props, iTween.Hash("scale", new Vector3(1f, 1f, 1f), "time", time_interval_props));

                SlgPB.PrizeItem prizeItem = prizeItems [i];
                UpdateItemUI(props, prizeItem);

                yield return(new WaitForSeconds(time_interval_props));
            }
            else
            {
                props.SetActive(false);
            }
        }
    }
Exemple #4
0
    override protected void DisposeContent(UseItemResponse content)
    {
        dropPrizeItems = content.prizeItems;


        DataItem item = DataManager.instance.dataItemGroup.GetItem(_request.itemId);

        DataDropGroup.DROP_TYPE dropType = DataDropGroup.CheckDropType(item.dropGroup);
        if (dropType == DataDropGroup.DROP_TYPE.EXP)
        {
            SlgPB.PrizeItem prizeItem = dropPrizeItems [0];
            Assert.assert(prizeItem.type == (int)DataConfig.DATA_TYPE.Exp);

            int             exp            = prizeItem.num;
            int             targetHeroId   = _request.target;
            Model_HeroGroup modelHeroGroup = InstancePlayer.instance.model_User.model_heroGroup;
            modelHeroGroup.AddExp(targetHeroId, exp);
        }

        InstancePlayer.instance.model_User.model_itemGroup.AddItemCount(_request.itemId, -_request.num);
    }
Exemple #5
0
 public UIDropItem(SlgPB.PrizeItem prizeItem)
 {
     id    = prizeItem.itemId;
     type  = prizeItem.type;
     count = prizeItem.num;
 }
Exemple #6
0
    void UpdateUI()
    {
        if (_index == null)
        {
            return;
        }
        List <SlgPB.ShopItem> shopItems = InstancePlayer.instance.model_User.model_shop.shopItems;

        _ShopItem = shopItems[_index];
//		MultipleItem multipItem = UIHelper.GetMultipleItem(_ShopItem.itemID,_ShopItem.num,_ShopItem.itemType,1,_icon);

        SlgPB.PrizeItem prizeItem = new SlgPB.PrizeItem();
        prizeItem.itemId = _ShopItem.itemID;
        prizeItem.type   = _ShopItem.itemType;
        prizeItem.num    = _ShopItem.num;
        UIDropItem dropitem = UIHelper.GetUIDropItemByPrizeItem(prizeItem);

        _icon.SetTexturePath(dropitem.icon);
        int quality = DataManager.instance.dataItemGroup.GetItem(_ShopItem.itemID).quality;

        switch (quality - 1)
        {
        case 0:
            _name.color = UICommon.UNIT_NAME_COLOR_0;
            break;

        case 1:
            _name.color = UICommon.UNIT_NAME_COLOR_1;
            break;

        case 2:
            _name.color = UICommon.UNIT_NAME_COLOR_2;
            break;

        case 3:
            _name.color = UICommon.UNIT_NAME_COLOR_3;
            break;

        case 4:
            _name.color = UICommon.UNIT_NAME_COLOR_4;
            break;

        case 5:
            _name.color = UICommon.UNIT_NAME_COLOR_5;
            break;

        default:
            _name.color = UICommon.UNIT_NAME_COLOR_0;
            break;
        }

        _name.text         = DataManager.instance.dataItemGroup.GetItem(_ShopItem.itemID).name;
        _iconBg.spriteName = "pvp_itemBg_" + quality;
        _number.text       = _ShopItem.num.ToString();
        if (_ShopItem.isSold == 0)
        {
            _CashLabel.gameObject.SetActive(true);
            _Label_ed.gameObject.SetActive(false);
            _CashLabel.text    = _ShopItem.price.ToString();
            _bug_Btn.isEnabled = true;
        }
        else
        {
            _CashLabel.gameObject.SetActive(false);
            _Label_ed.gameObject.SetActive(true);
            _bug_Btn.isEnabled = false;
        }
    }
Exemple #7
0
    public static UIDropItem GetUIDropItemByPrizeItem(SlgPB.PrizeItem prizeItem)
    {
        UIDropItem drop = new UIDropItem(prizeItem);

        switch (drop.type)
        {
        case (int)DataConfig.DATA_TYPE.Unit:
        {
            DataUnit dataUnit = DataManager.instance.dataUnitsGroup.GetUnit(drop.id);
            drop.name = dataUnit.name;
            drop.icon = UICommon.UNIT_SMALL_PATH_PREFIX + drop.id;
        }
        break;

        case (int)DataConfig.DATA_TYPE.UnitPart:
        {
            DataUnitPart dataUnitPart = DataManager.instance.dataUnitPartGroup.GetPart(drop.id, 1);
            drop.name = dataUnitPart.name;
        }
        break;

        case (int)DataConfig.DATA_TYPE.Item:
        {
            DataItem dataItem = DataManager.instance.dataItemGroup.GetItem(drop.id);
            drop.name = dataItem.name;
            drop.icon = UICommon.ITEM_PATH_PREFIX + drop.id;
        }
        break;

        case (int)DataConfig.DATA_TYPE.Hero:
        {
            DataHero dataHero = DataManager.instance.dataHeroGroup.GetHeroPrimitive(drop.id);
            drop.name = dataHero.name;
            drop.icon = UICommon.HERO_SMALL_PATH_PREFIX + drop.id;
        }
        break;

        case (int)DataConfig.DATA_TYPE.Combat:
        {
            drop.name = DataConfig.GetDataTypeName(DataConfig.DATA_TYPE.Combat);
            drop.icon = UICommon.DROP_ITEM_PATH_PREFIX + (int)drop.type;
        }
        break;

        case (int)DataConfig.DATA_TYPE.Honor:
        {
            drop.name = DataConfig.GetDataTypeName(DataConfig.DATA_TYPE.Honor);
            drop.icon = UICommon.DROP_ITEM_PATH_PREFIX + (int)drop.type;
        }
        break;

        case (int)DataConfig.DATA_TYPE.Food:
        {
            drop.name = DataConfig.GetDataTypeName(DataConfig.DATA_TYPE.Food);
            drop.icon = UICommon.DROP_ITEM_PATH_PREFIX + (int)drop.type;
        }
        break;

        case (int)DataConfig.DATA_TYPE.Oil:
        {
            drop.name = DataConfig.GetDataTypeName(DataConfig.DATA_TYPE.Oil);
            drop.icon = UICommon.DROP_ITEM_PATH_PREFIX + (int)drop.type;
        }
        break;

        case (int)DataConfig.DATA_TYPE.Metal:
        {
            drop.name = DataConfig.GetDataTypeName(DataConfig.DATA_TYPE.Metal);
            drop.icon = UICommon.DROP_ITEM_PATH_PREFIX + (int)drop.type;
        }
        break;

        case (int)DataConfig.DATA_TYPE.Rare:
        {
            drop.name = DataConfig.GetDataTypeName(DataConfig.DATA_TYPE.Rare);
            drop.icon = UICommon.DROP_ITEM_PATH_PREFIX + (int)drop.type;
        }
        break;

        case (int)DataConfig.DATA_TYPE.Cash:
        {
            drop.name = DataConfig.GetDataTypeName(DataConfig.DATA_TYPE.Cash);
            drop.icon = UICommon.DROP_ITEM_PATH_PREFIX + (int)drop.type;
        }
        break;

        case (int)DataConfig.DATA_TYPE.Exp:
        {
            drop.name = DataConfig.GetDataTypeName(DataConfig.DATA_TYPE.Exp);
            drop.icon = UICommon.DROP_ITEM_PATH_PREFIX + (int)drop.type;
        }
        break;

        case (int)DataConfig.DATA_TYPE.Energy:
        {
            drop.name = DataConfig.GetDataTypeName(DataConfig.DATA_TYPE.Energy);
            drop.icon = UICommon.DROP_ITEM_PATH_PREFIX + (int)drop.type;
        }
        break;

        case (int)DataConfig.DATA_TYPE.Building:
            break;

        case (int)DataConfig.DATA_TYPE.Mission:
            break;

        case (int)DataConfig.DATA_TYPE.Battle:
            break;

        case (int)DataConfig.DATA_TYPE.DropGroup:
            break;

        case (int)DataConfig.DATA_TYPE.Equipment:
            break;
        }

        return(drop);
    }