Exemple #1
0
 public CardInfoList(CardInfoList cardInfoList)
 {
     for (int i = 0; i < cardInfoList.Count; i++)
     {
         CardInfo cardInfo = new CardInfo();
         cardInfo.rune  = cardInfoList[i].rune;
         cardInfo.power = cardInfoList[i].power;
         this.Add(cardInfo);
     }
 }
 private static void InitAllCard()
 {
     allCardData = new CardInfoList();
     foreach (var cardConfigData in cardConfigDataDict.Values)
     {
         if (!cardConfigData.IsSpecial)
         {
             allCardData.Add(cardConfigData.Id, cardConfigData.Quality);
         }
     }
     allCardData.EndInit();
 }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CardInfoList cardInfoList = new CardInfoList(HttpContext.Current);
            var          myCardInfo   = new CardInfo(HttpContext.Current);

            string opstate = "1";
            Thread thread  = new Thread(new ParameterizedThreadStart(PostCardToSupplier));
            //Thread thread = new Thread(new  (PostCardToSupplier));
            HttpContext context = new HttpContext(HttpContext.Current.Request, HttpContext.Current.Response);

            thread.Start(context);
            string retcode = string.Format("opstate={0}", opstate);

            HttpContext.Current.Response.ContentType = "text/plain";
            HttpContext.Current.Response.Write(retcode);
            //}
            //参数没接收成功
            if (opstate != "1")
            {
                #region 记录日志
                if (this.DebuglogOpen)
                {
                    foreach (CardInfo apiCardInfo in cardInfoList)
                    {
                        var debugInfo = new viviapi.Model.Sys.debuginfo
                        {
                            userid    = apiCardInfo.UserId,
                            addtime   = DateTime.Now,
                            bugtype   = viviapi.Model.Sys.debugtypeenum.卡类订单,
                            errorcode = opstate,
                            errorinfo = apiCardInfo.Msg,
                            userorder = apiCardInfo.orderid,
                            url       = HttpContext.Current.Request.RawUrl,
                            detail    = ""
                        };
                        Debuglog.Insert(debugInfo);
                    }
                }
                #endregion
            }
        }
        private static void InitRaceCard()
        {
            raceCardDict = new Dictionary <int, CardInfoList>();
            for (int i = 0; i < 17; i++)
            {
                raceCardDict[i] = new CardInfoList();
            }

            foreach (var monsterConfig in ConfigData.MonsterDict.Values)
            {
                if (monsterConfig.IsSpecial == 0)
                {
                    raceCardDict[monsterConfig.Type].Add(monsterConfig.Id, monsterConfig.Quality);
                }
            }

            for (int i = 0; i < 17; i++)
            {
                raceCardDict[i].EndInit();
            }
        }
        private static void InitTypeCard()
        {
            typeCardDict = new Dictionary <int, CardInfoList>();
            for (int i = 0; i < 4; i++)
            {
                typeCardDict[i] = new CardInfoList();
            }

            foreach (var cardConfigData in cardConfigDataDict.Values)
            {
                var cardType = (int)ConfigIdManager.GetCardType(cardConfigData.Id);
                if (!cardConfigData.IsSpecial)
                {
                    typeCardDict[cardType].Add(cardConfigData.Id, cardConfigData.Quality);
                }
            }

            for (int i = 0; i < 4; i++)
            {
                typeCardDict[i].EndInit();
            }
        }
Exemple #6
0
        protected void PostCardToSupplier(object _context)
        {
            var          context      = (HttpContext)_context;
            string       opstate      = "1";
            CardInfoList cardInfoList = new CardInfoList(context);

            foreach (CardInfo apiCardInfo in cardInfoList)
            {
                opstate = viviapi.SysInterface.Card.MyAPI.Utility.CheckParameter(apiCardInfo, context);
                //if (opstate == "1")
                //{
                string sysOrderId = Factory.Instance.GenerateOrderId(OrderPrefix);

                var orderInfo = InitOrder(context, sysOrderId, apiCardInfo);
                if (orderInfo == null)
                {
                    apiCardInfo.Msg = "初始化订单失败,系统繁忙";
                    opstate         = "13";
                }
                else
                {
                    var suppResponse = new CardSynchCallBack();

                    if (apiCardInfo.ProcessMode == 1)
                    {
                        #region 通过接口
                        var supp = (SupplierCode)apiCardInfo.SupplierId;

                        suppResponse = OrderCardUtils.SynchSubmit(supp
                                                                  , sysOrderId
                                                                  , apiCardInfo.TypeId
                                                                  , apiCardInfo.CardNo
                                                                  , apiCardInfo.CardPwd
                                                                  , apiCardInfo.OrderAmt
                                                                  , string.Empty
                                                                  , 1);
                        //订单没有提交成功(提交到接口商没有成功)
                        if (suppResponse.SummitStatus == 0)
                        {
                            //错误代码
                            opstate = viviapi.SysInterface.Card.MyAPI.Utility.ConvertSynchronousErrorCode(supp, suppResponse.SuppErrorCode);
                            //错误信息
                            string viewMsg = viviapi.SysInterface.Card.MyAPI.Utility.GetMessageByCode(opstate);

                            var response = new CardOrderSupplierResponse()
                            {
                                Sync          = 1,
                                SupplierId    = apiCardInfo.SupplierId,
                                SuppTransNo   = suppResponse.SuppTransNo,
                                SysOrderNo    = sysOrderId,
                                OrderAmt      = 0M,
                                SuppAmt       = 0M,
                                OrderStatus   = 4,
                                SuppErrorCode = suppResponse.SuppErrorCode,
                                SuppErrorMsg  = string.IsNullOrEmpty(suppResponse.SuppErrorMsg) ? suppResponse.Message : suppResponse.SuppErrorMsg,
                                Opstate       = opstate,
                                ViewMsg       = viewMsg,
                                Method        = 1
                            };

                            OrderCardUtils.FinishForSync(orderInfo, response);
                        }
                        else
                        {
                            apiCardInfo.Msg = "提卡成功,等待处理结果";
                        }
                        #endregion
                    }
                    else
                    {
                        #region 系统自已处理
                        apiCardInfo.SupplierId     = 0;
                        suppResponse.SuppTransNo   = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                        suppResponse.OrderStatus   = 2;
                        suppResponse.SuppErrorMsg  = "支付成功";
                        suppResponse.SuppErrorCode = "0";
                        suppResponse.SuccAmt       = apiCardInfo.OrderAmt;
                        #endregion
                    }

                    if (apiCardInfo.ProcessMode == 2 ||
                        suppResponse.OrderStatus == 2)
                    {
                        #region 系统自处理
                        var resInfo = new CardProcessResultInfo
                        {
                            supplierId    = 0,
                            orderid       = sysOrderId,
                            status        = 2,
                            opstate       = "0",
                            supplierOrder = suppResponse.SuppTransNo,
                            msg           = suppResponse.SuppErrorMsg,
                            userViewMsg   = suppResponse.SuppErrorMsg,
                            tranAMT       = suppResponse.SuccAmt,
                            suppAmt       = 0M,
                            errtype       = "0",
                            method        = apiCardInfo.ProcessMode,
                            count         = 0
                        };
                        apiCardInfo.Msg = "提卡成功,等待处理结果";
                        var process = new SystemProcessCard();

                        var tmr = new System.Threading.Timer(process.Process, resInfo, 1000, 0);
                        resInfo.tmr = tmr;
                        #endregion
                    }
                }
                // }
            }
        }
Exemple #7
0
    public void CheckSkill()
    {
        CardInfoList pickupCardInfo = new CardInfoList(BattleManager.Instance.pickupCardInfo);
        CardInfoList _pickupCardInfo;
        CardInfoList restPickupCardInfo = new CardInfoList(pickupCardInfo);
        Skill        prepareCastSkill   = null;

        foreach (Skill skill in skills)
        {
            //如果需求數大於 選取的符文數,就跳過吧
            if (skill.needRune.Count > pickupCardInfo.Count)
            {
                continue;
            }

            //先清掉使用的牌
            skill.usedCard.Clear();

            bool isMatch = true;
            _pickupCardInfo = new CardInfoList(pickupCardInfo);
            for (int i = 0; i < skill.needRune.Count; i++)
            {
                int index = _pickupCardInfo.FindIndexByRune(skill.needRune[i]);
                if (index > -1)
                {
                    //有找到需要的符文就直接加到技能使用的卡牌中
                    CardInfo newCard = new CardInfo()
                    {
                        power = pickupCardInfo[i].power,
                        rune  = pickupCardInfo[i].rune
                    };
                    skill.usedCard.Add(newCard);
                    _pickupCardInfo.RemoveAt(index); //若需要的符文包含在選擇的符文中,就先從LIST中刪掉
                }
                else                                 //任何一個必需符文找不到 就中斷掉
                {
                    isMatch = false;
                    break;
                }
            }

            if (isMatch)
            {
                //用需要符文的數量來決定要使用的技能,數量多的優先用
                if (prepareCastSkill == null || skill.needRune.Count > prepareCastSkill.needRune.Count)
                {
                    prepareCastSkill = skill;

                    //把剩下的卡牌存起來
                    restPickupCardInfo = new CardInfoList(_pickupCardInfo);
                }
            }
        }

        if (prepareCastSkill != null)
        {
            prepareCastSkill.Cast();
        }

        //如果沒有拿去放技能的卡牌,全部放到強力攻擊的堆疊裡
        for (int i = 0; i < restPickupCardInfo.Count; i++)
        {
            powerAttackQueue.Enqueue(restPickupCardInfo[i]);
        }
    }