Пример #1
0
        private void BuysBtm_MouseDown(object sender, MouseButtonEventArgs e)
        {
            int    i;
            string id, amount, agentid, date;

            OKDT.Buy[]     readBuys;
            OKDT.Storage[] readStorage;
            OKDT.Storage   StorageBuff;
            BuyStruct[]    buyChilds;

            BuyStruct Header = new BuyStruct("Id", "Имя продукта", "Объем", "Id поставщика", "Дата");

            AddRow.Height = new GridLength(0);
            StructureViewStack.Children.Clear();
            readBuys            = OKDT.BuyClass.ReadBuys();
            readStorage         = OKDT.StructWorkClass.ReadFullStorage();
            buyChilds           = new BuyStruct[readBuys.Length];
            HeaderFrame.Content = Header;

            for (i = 0; i < buyChilds.Length; i++)
            {
                StorageBuff = readStorage.Where(a => a.Id == readBuys[i].ProductId).FirstOrDefault();

                id      = Convert.ToString(readBuys[i].Id);
                amount  = Convert.ToString(readBuys[i].Amount);
                agentid = Convert.ToString(readBuys[i].ConterAgentId);

                buyChilds[i] = new BuyStruct(id, StorageBuff.Name, amount, agentid, "Заглушка даты");
                StructureViewStack.Children.Add(buyChilds[i]);
            }
        }
 /// <summary>
 /// justShowNum 是否显示消耗为:几个物品,而不是对应物品的价格
 /// </summary>
 public void calculateTotal()
 {
     if (msg.msgInfo.GetType() == typeof(Goods) || item.GetType() == typeof(NoticeActiveGoods))
     {
         Goods good = msg.msgInfo as Goods;
         totalMoney.text = (now * good.getCostPrice()).ToString();
     }
     //这里添加多样性
     else if (msg.msgInfo.GetType() == typeof(Prop))
     {
         //使用道具不显示cost
     }
     else if (msg.msgInfo.GetType() == typeof(ArenaChallengePrice))
     {
         ArenaChallengePrice are = msg.msgInfo as ArenaChallengePrice;
         totalMoney.text = are.getPrice(now).ToString();
     }
     else if (msg.msgInfo.GetType() == typeof(BuyStruct))
     {
         BuyStruct buyStruct = msg.msgInfo as BuyStruct;
         totalMoney.text = (buyStruct.unitPrice * now).ToString();
     }
     else if (msg.msgInfo.GetType() == typeof(LaddersChallengePrice))
     {
         LaddersChallengePrice are = msg.msgInfo as LaddersChallengePrice;
         totalMoney.text = are.getPrice(now).ToString();
     }
 }
Пример #3
0
 /// <summary>
 /// justShowNum 是否显示消耗为:几个物品,而不是对应物品的价格
 /// </summary>
 public void calculateTotal()
 {
     if (msg.msgInfo.GetType() == typeof(Goods) || item.GetType() == typeof(NoticeActiveGoods))
     {
         Goods good = msg.msgInfo as Goods;
         //if (good.getGoodsShopType() == ShopType.LADDER_HEGOMONEY)
         //{
         //    totalMoney.text = (now *  (good.getCostPrice ()/good.getGoodsShowNum())).ToString ();
         //} else {
         //   //totalMoney.text = (now * good.getCostPrice ()).ToString ();
         //    totalMoney.text = getTotalCost(good, now);
         //}
         totalMoney.text = getTotalCost(good, now, good.getGoodsShopType());
     }
     //这里添加多样性
     else if (msg.msgInfo.GetType() == typeof(Prop))
     {
         //使用道具不显示cost
     }
     else if (msg.msgInfo.GetType() == typeof(ArenaChallengePrice))
     {
         ArenaChallengePrice are = msg.msgInfo as ArenaChallengePrice;
         totalMoney.text = are.getPrice(now).ToString();
     }
     else if (msg.msgInfo.GetType() == typeof(BuyStruct))
     {
         BuyStruct buyStruct = msg.msgInfo as BuyStruct;
         totalMoney.text = (buyStruct.unitPrice * now).ToString();
     }
     else if (msg.msgInfo.GetType() == typeof(BossAttackTimeBuyStruct))
     {
         BossAttackTimeBuyStruct buyStruct = msg.msgInfo as BossAttackTimeBuyStruct;
         totalMoney.text = (buyStruct.unitPrice * now).ToString();
     }
     else if (msg.msgInfo.GetType() == typeof(LaddersChallengePrice))
     {
         LaddersChallengePrice are = msg.msgInfo as LaddersChallengePrice;
         totalMoney.text = are.getPrice(now).ToString();
     }
     else if (msg.msgInfo.GetType() == typeof(ActivityChapter))
     {
         ActivityChapter _chapter = msg.msgInfo as ActivityChapter;
         int[]           prises   = GoodsBuyCountManager.Instance.getSampleByGoodsSid(_chapter.sid).prise;
         int             rmb      = prises.Length <= _chapter.getReBuyNum() ? prises[prises.Length - 1] : prises[_chapter.getReBuyNum()];
         totalMoney.text = ((now * (rmb + (rmb + (now - 1) * (prises[1] - prises[0]))))) / 2 + "";
         msg.costNum     = StringKit.toInt(totalMoney.text);
         msg.msgNum      = now;
     }
 }
Пример #4
0
    //最原始的初始化
    public void init(object obj, int numberMax, int numberMin, int numberNow, int numberSetp, int costType, CallBackMsg callback)
    {
        msg           = new MessageHandle();
        msg.msgInfo   = obj;
        item          = obj;
        this.callback = callback;
        setp          = numberSetp;
        max           = numberMax;
        min           = numberMin;
        now           = numberNow;
        coverDistanceToOne();
        this.costType = costType;
        updateCoinIcon();
        updateDisplayeNumber();
        calculateTotal();
        goodsTexture.gameObject.SetActive(false);
        goodsBg.gameObject.SetActive(false);
        GoodsView tmpGoodsView = CreateGoodsView();

        if (obj.GetType() == typeof(Goods) || obj.GetType() == typeof(NoticeActiveGoods))
        {
            Goods good = item as Goods;
            tmpGoodsView.init(good.getGoodsType(), good.getGoodsSid(), good.getGoodsShowNum());
            titleText.text = (obj as Goods).getName();
            if (good.getGoodsType() == GoodsType.EQUIP)
            {
                currentHaveNum.text = LanguageConfigManager.Instance.getLanguage("pveUse09", StorageManagerment.Instance.getEquipsBySid(good.getGoodsSid()).Count.ToString());
            }
            else if (good.getGoodsType() == GoodsType.TOOL)
            {
                currentHaveNum.text = LanguageConfigManager.Instance.getLanguage("pveUse09", StorageManagerment.Instance.getProp(good.getGoodsSid()) == null ? "0" : StorageManagerment.Instance.getProp(good.getGoodsSid()).getNum().ToString());
            }
        }
        else if (obj.GetType() == typeof(Prop))
        {
            Prop prop = item as Prop;
            tmpGoodsView.init(prop);
            titleText.text = prop.getName();
        }
        else if (obj.GetType() == typeof(Exchange) || obj.GetType() == typeof(NewExchange))
        {
            ExchangeSample sample = (obj as Exchange).getExchangeSample();
            now = numberMax;
            tmpGoodsView.init(sample.type, sample.exchangeSid, sample.num);
            titleText.text = tmpGoodsView.showName;
        }
        else if (obj.GetType() == typeof(ArenaChallengePrice))
        {
            ArenaChallengePrice are = obj as ArenaChallengePrice;
            titleText.text = are.getName();
            ResourcesManager.Instance.LoadAssetBundleTexture(are.getIconPath(), goodsTexture);
            goodsTexture.gameObject.SetActive(true);
            goodsBg.gameObject.SetActive(true);
            tmpGoodsView.gameObject.SetActive(false);
        }
        else if (obj.GetType() == typeof(BuyStruct))
        {
            BuyStruct buyStruct = obj as BuyStruct;
            titleText.text = buyStruct.titleTextName;
            ResourcesManager.Instance.LoadAssetBundleTexture(buyStruct.iconId, goodsTexture);
            goodsTexture.gameObject.SetActive(true);
            if (buyStruct.goodsBgId != 0)
            {
                goodsBg.spriteName = QualityManagerment.qualityIDToIconSpriteName(buyStruct.goodsBgId);
            }
            goodsBg.gameObject.SetActive(true);
            tmpGoodsView.gameObject.SetActive(false);
        }
        else if (obj.GetType() == typeof(LaddersChallengePrice))
        {
            LaddersChallengePrice are = obj as LaddersChallengePrice;
            titleText.text = are.getName();
            ResourcesManager.Instance.LoadAssetBundleTexture(are.getIconPath(), goodsTexture);
            goodsTexture.gameObject.SetActive(true);
            goodsBg.gameObject.SetActive(true);
            tmpGoodsView.gameObject.SetActive(false);
        }
        else if (obj.GetType() == typeof(ActivityChapter))
        {
            ActivityChapter chapter = obj as ActivityChapter;
            ResourcesManager.Instance.LoadAssetBundleTexture(constResourcesPath.TIMES_ICONPATH, goodsTexture);
            goodsTexture.gameObject.SetActive(true);
            tmpGoodsView.gameObject.SetActive(false);
        }
    }