Esempio n. 1
0
        /// <summary>
        /// 帐号获得新的物品
        /// </summary>
        /// <param name="Cmdityid"></param>
        public void GameUserGetNewCommodity(int Cmdityid)
        {
            Int64 expiredTime = -1;

            if (GameDefine.GameConstDefine.IfHeroBuyCfg(Cmdityid))
            {
                if (ConfigReader.HeroBuyXmlInfoDict.ContainsKey(Cmdityid))
                {
                    NewCommodityType = MarketGoodsType.GoodsTypeHero;
                    expiredTime      = (Int64)ConfigReader.HeroBuyXmlInfoDict[Cmdityid].Time;
                }
            }
            else if (GameDefine.GameConstDefine.IfRuneBuyCfg(Cmdityid))
            {
                //EventCenter.Broadcast<EMessageType>((Int32)GameEventEnum.GameEvent_ShowMessage, EMessageType.EMT_BuyGoodsSuccess);
                //MarketRuneListModel.Instance.UpdateBuyedRuneInfo(Cmdityid, 0);
            }

            CommodityInfos info = new CommodityInfos()
            {
                goodsId      = Cmdityid,
                GoodsType    = NewCommodityType,
                Expired_time = expiredTime
            };

            switch (NewCommodityType)
            {
            case MarketGoodsType.GoodsTypeHero:
                this.DeltGetHeroInfoData(info);
                break;
            }
            //OwnedHeroInfoDict
            NewCommodityId = Cmdityid;
            //EventCenter
        }
Esempio n. 2
0
        /// <summary>
        /// 刷新帐号拥有的英雄信息数据
        /// </summary>
        /// <param name="heroid"></param>
        /// <param name="info"></param>
        public void DeltGetHeroInfoData(CommodityInfos info)
        {
            if (info.Expired_time > 0)
            {
                int sDay  = Mathf.Abs(GetDay(info.Expired_time));
                int sHour = Mathf.Abs(GetHour(info.Expired_time));
                int sMin  = Mathf.Abs(GetMinute(info.Expired_time));
                int sSec  = Mathf.Abs(GetSecond(info.Expired_time));
                info.gametTime = new TimeSpan(sDay, sHour, sMin, sSec);
                info.LastTime  = DateTime.Now;
                info.LastTime += info.gametTime;
            }
            if (this.OwnedHeroInfoDict.ContainsKey(info.goodsId))
            {
                OwnedHeroInfoDict[info.goodsId] = info;
            }
            else
            {
                OwnedHeroInfoDict.Add(info.goodsId, info);
                EventCenter.Broadcast <int>((Int32)GameEventEnum.GameEvent_CsGetNewHero, info.goodsId);
            }

            EventCenter.Broadcast <int>((Int32)GameEventEnum.GameEvent_RefreshGoodHero, info.goodsId);
            EventCenter.Broadcast <int>((Int32)GameEventEnum.GameEvent_RefreshTimeLimitHero, info.goodsId);
        }