예제 #1
0
    public Action clickCancelCallBack;      //取消回调

    /// <summary>
    /// 购买指定礼物界面
    /// </summary>
    /// <param name="item">指定的礼物</param>
    /// <param name="defultAmount">默认数量</param>
    /// <param name="buySucceedCallBack">购买成功回调</param>
    /// <param name="clickCancelCallBack">点击取消回调</param>
    public async void ShowBuyView(ImpulseGiftGoods item, int defultAmount, Action <int> buySucceedCallBack = null, Action clickCancelCallBack = null)
    {
        this.gameObject.SetActive(true);//显示界面
        this.giftInfo = item;

        Title.text       = $"你还没有{ StaticData.GetMultiLanguageByGameItemId(giftInfo.goodsID)}哦,要购买吗";//TODO
        goodsIcon.sprite = await ABManager.GetAssetAsync <Sprite>(giftInfo.goodsIcon);

        goodsName.text   = $"{StaticData.GetMultiLanguageByGameItemId(giftInfo.goodsID)}";
        n2pAddValue.text = $"+{giftInfo.NpcAddValue}";
        p2nAddValue.text = $"+{giftInfo.playerAddValue}";

        int id = giftInfo.goodsPriceBuy[0].ID;              //取到钻石图片的id

        priceAmount = (int)giftInfo.goodsPriceBuy[0].Count; //取到数量
        Sprite sprite = await ZillionaireToolManager.LoadItemSprite(id);

        propIcon.sprite = sprite;

        this.buySucceedCallBack         = buySucceedCallBack;
        this.clickCancelCallBack        = clickCancelCallBack;
        amountComponent._defaultValue   = defultAmount.ToString();
        amountComponent.inputFiled.text = defultAmount.ToString();
        amountComponent.act             = BuyAmount;
        amountComponent._changeAction   = ChangeAct;
        //取消事件
        cancelBtn.onClick.RemoveAllListeners();
        cancelBtn.onClick.AddListener(Cancel);
        //初始价格显示 默认数量*指定礼物价格
        Price.text = (priceAmount * defultAmount).ToString();
    }
예제 #2
0
 /// <summary>
 /// 进入心动界面时刷新礼物信息
 /// </summary>
 void JoinViewRefreshGift()
 {
     //获取礼物数据
     if (ImpulseGiftGoods.Count <= 0)
     {                                                         //获取所有心动礼物 (从道具表)
         foreach (var item in StaticData.configExcel.GameItem) //所有礼物
         {
             if (item.ItemType != Company.Cfg.TypeGameItem.HeartGift)
             {
                 continue;
             }
             ImpulseGiftGoods giftGoods = new ImpulseGiftGoods();
             giftGoods.goodsID          = item.ID;
             giftGoods.goodsName        = item.ItemName;
             giftGoods.goodsIcon        = item.Icon;
             giftGoods.goodsDescription = item.Description;
             ImpulseGiftGoods.Add(giftGoods);
         }
         //获取礼物价格 (从商店表)
         foreach (var item in StaticData.configExcel.Store)
         {
             for (int i = 0; i < ImpulseGiftGoods.Count; i++)
             {
                 if (item.GoodId != ImpulseGiftGoods[i].goodsID)
                 {
                     continue;
                 }
                 ImpulseGiftGoods[i].goodsPriceBuy = item.OriginalPrice;
                 break;
             }
         }
         //获取礼物具体好感数值(从心动礼物表)
         foreach (var item in StaticData.configExcel.ImpulseGift)
         {
             for (int i = 0; i < ImpulseGiftGoods.Count; i++)
             {
                 if (item.ID != ImpulseGiftGoods[i].goodsID)
                 {
                     continue;
                 }
                 ImpulseGiftGoods[i].playerAddValue = item.PlayerAddFavorableValue;
                 ImpulseGiftGoods[i].NpcAddValue    = item.NPCAddFavorableValue;
                 break;
             }
         }
     }
     //从仓库中获取礼物数量
     RefreshLastGift();
 }
예제 #3
0
 public async void ScrollCellIndex(int idx)
 {//更新数据函数
     Init();
     itemInfo = impulesNPCView.GetGiftItem(idx);
     if (itemInfo.goodsIcon != "")
     {
         Icon.sprite = await ABManager.GetAssetAsync <Sprite>(itemInfo.goodsIcon);
     }
     itemName.text = StaticData.GetMultiLanguageByGameItemId(itemInfo.goodsID);
     n2pValue.text = $"+{itemInfo.NpcAddValue}";
     p2nValue.text = $"+{itemInfo.playerAddValue}";
     Amount.text   = itemInfo.goodsAmount.ToString();
     if (itemInfo.isPitchOn == true)
     {
         //选中效果
         PitchOn.gameObject.SetActive(true);
     }
     else
     {
         PitchOn.gameObject.SetActive(false);
     }
 }
예제 #4
0
 /// <summary>
 /// 显示选中的效果
 /// </summary>
 public void ShowPitchOn(ImpulseGiftGoods item, ImpulesGiftItem giftItem)
 {
     //setAmount.inputFiled.text = "1";//不再把数量重置为1
     curGiftGoods    = item;
     curGiftInstance = giftItem;
 }