Example #1
0
        public void AddRuneCfgListInfo(GSToGC.GoodsCfgInfo cfgInfo)
        {
            RuneGoodsInfo mGoodInfo;
            int           gdid = cfgInfo.goodid;

            if (!RunecfgListDict.TryGetValue(gdid, out mGoodInfo))
            {
                mGoodInfo                = new RuneGoodsInfo();
                mGoodInfo.mGoodsId       = gdid;
                mGoodInfo.RLDiamondPrice = -1;
                mGoodInfo.RLGoldPrice    = -1;

                for (int i = 0; i < cfgInfo.consume.Count; ++i)
                {
                    if (cfgInfo.consume[i].consumetype == 2)
                    {
                        mGoodInfo.RLDiamondPrice = cfgInfo.consume[i].price;
                    }
                    else
                    {
                        mGoodInfo.RLGoldPrice = cfgInfo.consume[i].price;
                    }
                }
                RunecfgListDict.Add(gdid, mGoodInfo);
            }
        }
Example #2
0
        /// <summary>
        /// 获得帐号所拥有的物品
        /// </summary>
        /// <param name="cfgInfo"></param>
        public void GameUserOwnedGoods(GSToGC.GoodsCfgInfo cfgInfo)
        {
            MarketGoodsType type;
            int             gsId = cfgInfo.goodid;

            if (ConfigReader.HeroBuyXmlInfoDict.ContainsKey(gsId))
            {
                type = MarketGoodsType.GoodsTypeHero;
            }
            MarketHeroListModel.Instance.HeroListInfo(cfgInfo);
        }
        public void HeroListInfo(GSToGC.GoodsCfgInfo cfgInfo)
        {
            MarketGoodsInfo mGoodInfo;
            int             gdid = cfgInfo.goodid;

            if (!HeroListDict.TryGetValue(gdid, out mGoodInfo))
            {
                mGoodInfo = new MarketGoodsInfo();
                HeroListDict.Add(gdid, mGoodInfo);
            }
            GSToGC.GoodsCfgInfo.CfgType cfg = (GSToGC.GoodsCfgInfo.CfgType)cfgInfo.cfg_type;
            if (cfg == GSToGC.GoodsCfgInfo.CfgType.CfgType_Discount)
            {
                mGoodInfo.DisCountConsume = cfgInfo.consume;
                foreach (var item in cfgInfo.consume)
                {
                    if ((GameDefine.ConsumeType)item.consumetype == GameDefine.ConsumeType.TypeGold)
                    {
                        mGoodInfo.RLGoldPrice = item.price;
                    }
                    else if ((GameDefine.ConsumeType)item.consumetype == GameDefine.ConsumeType.TypeDiamond)
                    {
                        mGoodInfo.RLDiamondPrice = item.price;
                    }
                }
            }
            else if (cfg == GSToGC.GoodsCfgInfo.CfgType.CfgType_Common)
            {
                mGoodInfo.CommonConsume = cfgInfo.consume;
                foreach (var item in cfgInfo.consume)
                {
                    if ((GameDefine.ConsumeType)item.consumetype == GameDefine.ConsumeType.TypeGold)
                    {
                        mGoodInfo.RLGoldPrice = item.price;
                    }
                    else if ((GameDefine.ConsumeType)item.consumetype == GameDefine.ConsumeType.TypeDiamond)
                    {
                        mGoodInfo.RLDiamondPrice = item.price;
                    }
                }
            }
            mGoodInfo.mGoodsId   = gdid;
            mGoodInfo.ConfigType = cfg;
            HeroListDict[gdid]   = mGoodInfo;
        }
Example #4
0
        private ErrorCode SynCommidityCfgInfo()
        {
            GSToGC.GoodsBuyCfgInfo msg = new GSToGC.GoodsBuyCfgInfo();
            foreach (KeyValuePair <uint, HeroBuyCfg> kv in CS.instance.csCfg.heroBuyCfgMap)
            {
                HeroBuyCfg pCfg = kv.Value;
                if (!pCfg.bIfShowInShop)
                {
                    continue;
                }
                GSToGC.GoodsCfgInfo goodsCfgInfo = new GSToGC.GoodsCfgInfo {
                    Goodid = ( int )kv.Key
                };
                foreach (ConsumeStruct consumeStruct in pCfg.consumeList)
                {
                    GSToGC.GoodsCfgInfo.Types.Consume pConsume =
                        new GSToGC.GoodsCfgInfo.Types.Consume
                    {
                        Consumetype = ( int )consumeStruct.type,
                        Price       = consumeStruct.price
                    };
                    goodsCfgInfo.Consume.Add(pConsume);
                }

                goodsCfgInfo.CfgType = GSToGC.GoodsCfgInfo.Types.CfgType.Common;
                msg.Info.Add(goodsCfgInfo);
            }

            foreach (KeyValuePair <uint, RunesCfg> kv in CS.instance.csCfg.runesCfgMap)
            {
                RunesCfg pCfg = kv.Value;
                if (!pCfg.bIfShowInShop)
                {
                    continue;
                }
                GSToGC.GoodsCfgInfo goodsCfgInfo = new GSToGC.GoodsCfgInfo {
                    Goodid = ( int )kv.Key
                };
                foreach (ConsumeStruct consumeStruct in pCfg.sConsumeList)
                {
                    GSToGC.GoodsCfgInfo.Types.Consume pConsume =
                        new GSToGC.GoodsCfgInfo.Types.Consume
                    {
                        Consumetype = ( int )consumeStruct.type,
                        Price       = consumeStruct.price
                    };
                    goodsCfgInfo.Consume.Add(pConsume);
                }

                goodsCfgInfo.CfgType = (GSToGC.GoodsCfgInfo.Types.CfgType.Common);
                msg.Info.Add(goodsCfgInfo);
            }

            foreach (KeyValuePair <uint, DiscountCfg> kv in CS.instance.csCfg.discountCfgMap)
            {
                DiscountCfg         pCfg          = kv.Value;
                GSToGC.GoodsCfgInfo sGoodsCfgInfo = new GSToGC.GoodsCfgInfo {
                    Goodid = ( int )kv.Key
                };
                foreach (ConsumeStruct consumeStruct in pCfg.sConsumeList)
                {
                    GSToGC.GoodsCfgInfo.Types.Consume pConsume =
                        new GSToGC.GoodsCfgInfo.Types.Consume
                    {
                        Consumetype = ( int )consumeStruct.type,
                        Price       = consumeStruct.price
                    };
                    sGoodsCfgInfo.Consume.Add(pConsume);
                }

                sGoodsCfgInfo.CfgType = (GSToGC.GoodsCfgInfo.Types.CfgType.Discount);
                msg.Info.Add(sGoodsCfgInfo);
            }

            foreach (uint newGoodsCfg in CS.instance.csCfg.newGoodsCfgVec)
            {
                GSToGC.GoodsCfgInfo goodsCfgInfo = new GSToGC.GoodsCfgInfo
                {
                    Goodid  = ( int )newGoodsCfg,
                    CfgType = GSToGC.GoodsCfgInfo.Types.CfgType.New
                };
                msg.Info.Add(goodsCfgInfo);
            }

            foreach (uint hotGoodsCfg in CS.instance.csCfg.hotGoodsCfgVec)
            {
                GSToGC.GoodsCfgInfo goodsCfgInfo = new GSToGC.GoodsCfgInfo
                {
                    Goodid  = ( int )hotGoodsCfg,
                    CfgType = GSToGC.GoodsCfgInfo.Types.CfgType.Hot
                };
                msg.Info.Add(goodsCfgInfo);
            }

            CS.instance.PostMsgToGC(this.userNetInfo, msg, ( int )GSToGC.MsgID.EMsgToGcfromGsNotifyGoodsCfgInfo);
            return(ErrorCode.Success);
        }