/// <summary>
    /// 设置数据
    /// </summary>
    /// <param name="itemData"></param>
    /// <param name="storeInfo"></param>
    public void SetData(ItemBean itemData, StoreInfoBean storeInfo)
    {
        this.itemData  = itemData;
        this.storeInfo = storeInfo;
        Sprite spIcon = null;
        string name   = "???";

        if (storeInfo.mark_type == 1)
        {
            ItemsInfoBean itemsInfo = GameItemsHandler.Instance.manager.GetItemsById(itemData.itemId);

            spIcon = GeneralEnumTools.GetGeneralSprite(itemsInfo);
            if (itemsInfo != null)
            {
                name = itemsInfo.name;
            }
        }
        else if (storeInfo.mark_type == 2)
        {
            BuildItemBean buildItem = InnBuildHandler.Instance.manager.GetBuildDataById(itemData.itemId);
            spIcon = BuildItemTypeEnumTools.GetBuildItemSprite(buildItem);
            if (buildItem != null)
            {
                name = buildItem.name;
            }
        }
        SetIcon(spIcon);
        SetPrice(sellNumber, storeInfo);
        SetName(name);
        SetOwn();
        SetSellNumber(sellNumber);
    }
Beispiel #2
0
    public void SetType(GeneralEnum type)
    {
        string typeStr = TextHandler.Instance.manager.GetTextById(400) + ":" + GeneralEnumTools.GetGeneralName(type);

        if (tvType != null)
        {
            tvType.text = typeStr;
        }
    }
Beispiel #3
0
    /// <summary>
    /// 获取随机道具的奖励详情
    /// </summary>
    /// <param name="data"></param>
    /// <param name="iconDataManager"></param>
    /// <param name="gameItemsManager"></param>
    /// <returns></returns>
    private static RewardTypeBean GetRewardDetailsForRandomItems(RewardTypeBean data)
    {
        long[]        listItemsData = StringUtil.SplitBySubstringForArrayLong(data.data, ',');
        long          randomItemsId = RandomUtil.GetRandomDataByArray(listItemsData);
        ItemsInfoBean itemsInfo     = GameItemsHandler.Instance.manager.GetItemsById(randomItemsId);

        data.rewardDescribe  = itemsInfo.name;
        data.rewardNumber    = 1;
        data.rewardId        = randomItemsId;
        data.rewardDescribe += (" x" + data.rewardNumber);
        data.spRewardIcon    = GeneralEnumTools.GetGeneralSprite(itemsInfo, true);
        return(data);
    }
Beispiel #4
0
    /// <summary>
    /// 设置Icon
    /// </summary>
    /// <param name="iconKey"></param>
    /// <param name="itemType"></param>
    public void SetIcon(ItemsInfoBean itemsInfo)
    {
        Vector2 offsetMin = new Vector2(0, 0);
        Vector2 offsetMax = new Vector2(0, 0);
        Sprite  spIcon    = null;

        if (itemsInfo != null)
        {
            switch (itemsInfo.items_type)
            {
            case (int)GeneralEnum.Hat:
                offsetMin = new Vector2(-30, -60);
                offsetMax = new Vector2(30, 0);
                break;

            case (int)GeneralEnum.Clothes:
                offsetMin = new Vector2(-30, -20);
                offsetMax = new Vector2(30, 40);
                break;

            case (int)GeneralEnum.Shoes:
                offsetMin = new Vector2(-30, 0);
                offsetMax = new Vector2(30, 60);
                break;

            default:
                break;
            }
            spIcon = GeneralEnumTools.GetGeneralSprite(itemsInfo, false);
        }
        if (spIcon != null)
        {
            ivIcon.color = new Color(1, 1, 1, 1);
        }
        else
        {
            ivIcon.color = new Color(1, 1, 1, 0);
        }
        ivIcon.sprite = spIcon;

        if (rtIcon != null)
        {
            rtIcon.offsetMin = offsetMin;
            rtIcon.offsetMax = offsetMax;
        }
    }
Beispiel #5
0
    /// <summary>
    /// 获取道具的奖励详情
    /// </summary>
    /// <param name="data"></param>
    /// <param name="iconDataManager"></param>
    /// <param name="gameItemsManager"></param>
    /// <returns></returns>
    private static RewardTypeBean GetRewardDetailsForItems(RewardTypeBean data)
    {
        string[] listItemsData = StringUtil.SplitBySubstringForArrayStr(data.data, ',');
        long     itemId        = long.Parse(listItemsData[0]);

        ItemsInfoBean itemsInfo = GameItemsHandler.Instance.manager.GetItemsById(itemId);

        data.rewardDescribe = itemsInfo.name;
        if (listItemsData.Length == 2)
        {
            data.rewardNumber = int.Parse(listItemsData[1]);
        }
        data.rewardId        = itemId;
        data.rewardDescribe += (" x" + data.rewardNumber);
        data.spRewardIcon    = GeneralEnumTools.GetGeneralSprite(itemsInfo, true);
        return(data);
    }
Beispiel #6
0
    /// <summary>
    /// 协程 物品使用
    /// </summary>
    /// <returns></returns>
    private IEnumerator CoroutineForCommandItems()
    {
        NpcAIMiniGameCombatCpt        actionNpc     = miniGameData.GetRoundActionCharacter();
        List <NpcAIMiniGameCombatCpt> listTargetNpc = miniGameData.GetRoundTargetListCharacter();

        long          itemsId   = miniGameData.GetRoundActionItemsId();
        ItemsInfoBean itemsInfo = GameItemsHandler.Instance.manager.GetItemsById(itemsId);
        //从物品栏移除物品
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        gameData.AddItemsNumber(itemsInfo.id, -1);
        Sprite spItems = GeneralEnumTools.GetGeneralSprite(itemsInfo);

        //增加物品效果
        foreach (NpcAIMiniGameCombatCpt itemNpc in listTargetNpc)
        {
            itemNpc.AddCombatEffect(actionNpc, itemsInfo.effect, itemsInfo.effect_details, spItems);
        }
        yield return(new WaitForSeconds(1f));
    }
Beispiel #7
0
    /// <summary>
    /// 设置图标
    /// </summary>
    /// <param name="iconKey"></param>
    /// <param name="mark"></param>
    /// <param name="markId"></param>
    public void SetIcon(ItemsInfoBean itemsInfo, string mark, long markId)
    {
        Sprite  spIcon    = null;
        Vector2 offsetMin = new Vector2(0, 0);
        Vector2 offsetMax = new Vector2(0, 0);

        if (!CheckUtil.StringIsNull(mark))
        {
            switch ((GeneralEnum)int.Parse(mark))
            {
            case GeneralEnum.Hat:
                offsetMin = new Vector2(-50, -75);
                offsetMax = new Vector2(50, 25);
                break;

            case GeneralEnum.Clothes:
                offsetMin = new Vector2(-50, -25);
                offsetMax = new Vector2(50, 75);
                break;

            case GeneralEnum.Shoes:
                offsetMin = new Vector2(-50, 0);
                offsetMax = new Vector2(50, 100);
                break;

            default:
                break;
            }
        }

        spIcon = GeneralEnumTools.GetGeneralSprite(itemsInfo, false);
        if (ivIcon != null && spIcon != null)
        {
            ivIcon.sprite = spIcon;
        }
        if (rtIcon != null)
        {
            rtIcon.offsetMin = offsetMin;
            rtIcon.offsetMax = offsetMax;
        }
    }