Beispiel #1
0
 private void Exchange()
 {
     string contents = "game_activity_id=" + _do.Activity.Id;
     if (_do.ChosenConditions.Count > 0)
     {
         foreach (var key in _do.ChosenConditions.Keys)
         {
             contents += string.Format("&condition_{0}={1}", key, _do.ChosenConditions[key]);
         }
     }
     dynamic resp = Post("/gameactivity/do", contents);
     if (resp != null && resp.errorCode == 0)
     {
         if (resp.data != null && (bool)resp.data.award_ok)
         {
             string msg = "兑换[" + _do.Activity.Name + "]成功";
             if (resp.data.entity != null)
             {
                 _do.Activity.AwardGot = (string)resp.data.entity.name + "*" + (string)resp.data.entity_count;
                 msg += ",获得:" + _do.Activity.AwardGot;
             }
             LogWarn(msg);
         }
         else
         {
             LogError("兑换失败");
         }
     }
     // refresh the list no matter the result
     SGLL.CallStatusUpdate(this, ChangedType.Activity);
     _do = null;
     SGLL.Data.ActivityData.ColdDown = -3600;
 }
Beispiel #2
0
        private void DoActivity()
        {
            foreach (var cond in _do.Activity.Conditions)
            {
                if (!cond.IsEnough)
                {
                    if ((cond.EntityName == "蒋干" || cond.EntityName == "蒙古马")
                    && MatchParam(SR.ParaKey.ActivityAutoJM, "true", false))
                    {
                        LogInfo("卡片不足,准备购买:" + cond.EntityName);
                        BuyDaoju(cond.EntityName);
                        SGLL.CallStatusUpdate(this, ChangedType.Profile | ChangedType.Activity);
                    }
                    _do = null;
                    SGLL.Data.ActivityData.ColdDown = -3600;
                    return;
                }

                if (cond.NeedChoose && !_do.ChosenConditions.ContainsKey(cond.Id))
                {
                    ChooseCard(cond);
                    return;
                }
            }

            Exchange();
        }