Пример #1
0
        protected void gvClubStrip_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var bh = e.Row.DataItem as BingoHistory;

                var br = new BingoResult(bh.Result, bh.ResultDetail);

                var finalResult = string.Empty;

                switch (br.Result)
                {
                case BingoResultType.Strip:
                    if (br.ResultDetail == "strip")
                    {
                        finalResult =
                            "<span class=\"ClubSys_Strip SHIRT\">球衣</span><span class=\"ClubSys_Strip SHORTS\">球裤</span><span class=\"ClubSys_Strip SOCK\">球袜</span>";
                    }
                    else if (br.ResultDetail.Contains("strips"))
                    {
                        finalResult =
                            "<span class=\"ClubSys_Strip SHIRT\">球衣</span><span class=\"ClubSys_Strip SHORTS\">球裤</span><span class=\"ClubSys_Strip SOCK\">球袜</span><span class=\"ClubSys_Strip RATE\">×5</span>";
                    }
                    else
                    {
                        finalResult =
                            BingoUtil.ShowBothBingoDetail(
                                ("<span class=\"ClubSys_Strip " + br.ResultDetail.ToUpper() + "\">{0}</span>"), br);
                    }
                    break;

                case BingoResultType.Card:
                    if (br.ResultDetail == "legend")
                    {
                        finalResult = "<span class=\"ClubSys_Strip VIDEO\">视频</span>";
                    }
                    else
                    {
                        finalResult =
                            $"<span class=\"ClubSys_Strip CARD\">{Player.Cache.Load(new Guid(br.ResultDetail)).DisplayName}</span>";
                    }
                    break;

                case BingoResultType.Cash:
                    finalResult = "<span class=\"ClubSys_Strip CASH\">枪手币: " + br.ResultDetail + "</span>";
                    break;

                case BingoResultType.Both:
                    finalResult =
                        BingoUtil.ShowBothBingoDetail(
                            "<span class=\"ClubSys_Strip " +
                            br.ResultDetail.Substring(0, br.ResultDetail.IndexOf("+")).ToUpper() +
                            "\">{0}</span> <span class=\"ClubSys_Strip CASH\">枪手币: {1}</span>", br);
                    break;
                }

                var ltrlStrip = e.Row.FindControl("ltrlStrip") as Literal;
                ltrlStrip.Text = finalResult;
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var responseMessage = "-1";
            var userMoney       = "0";
            var bingoHistoryID  = 0;
            var isGoogleAdv     = false;

            try
            {
                if (userid != -1)
                {
                    if (Request.Form["StripResult"] != null)
                    {
                        if (Request.Form["StripResult"] == "start")
                        {
                            bool.TryParse(Request.Form["IsGoogleAdv"], out isGoogleAdv);

                            #region StartGetStrip

                            var clubs = ClubLogic.GetActiveUserClubs(userid);

                            if (clubs.Count != 0)
                            {
                                var clubID = clubs[0].ID.Value;

                                //check the user last time play
                                //TimeSpan ts = PlayerStrip.GetUserBingoTimeSpan(userid);

                                var count = PlayerStrip.GetUserBingoPlayCountThisHour(userid);
                                var info  = Users.GetUserInfo(userid);

                                userMoney = ((int)info.Extcredits2).ToString();

                                if ((ConfigGlobal.BingoPlayCountPerHour > count) &&
                                    (PlayerStrip.GetClubRemainingEquipment(clubID) > 0))
                                {
                                    if (isGoogleAdv && ConfigGlobal.GoogleAdvActive)
                                    {
                                        bingoHistoryID = PlayerStrip.InsertBingoStart(userid, username, clubID);

                                        responseMessage = (ConfigGlobal.BingoPlayCountPerHour - count).ToString();
                                    }
                                    else
                                    {
                                        //play cost
                                        var bingoCost = ConfigGlobal.BingoCost;

                                        if (info.Extcredits2 >= bingoCost)
                                        {
                                            info.Extcredits2 = info.Extcredits2 - bingoCost;

                                            if (AdminUsers.UpdateUserAllInfo(info))
                                            {
                                                bingoHistoryID = PlayerStrip.InsertBingoStart(userid, username, clubID);

                                                //return a rate based on user fortune

                                                //responseResult = PlayerStrip.CalcFlashRate(userid);

                                                //return userFortune

                                                responseMessage =
                                                    (ConfigGlobal.BingoPlayCountPerHour - count).ToString();
                                            }
                                        }
                                        else
                                        {
                                            responseMessage = "-2";
                                        }
                                    }
                                }
                                else
                                {
                                    responseMessage = "0";
                                }
                            }

                            #endregion
                        }
                        else if (Request.Form["StripResult"] == "result")
                        {
                            var finalResult = Request.Form["FinalResult"];
                            var resultType  = Request.Form["ResultType"];

                            var authKey = Request.Form["AuthKey"];
                            bingoHistoryID = int.Parse(Request.Form["ID"]);
                            bool.TryParse(Request.Form["IsGoogleAdv"], out isGoogleAdv);

                            var info = Users.GetUserInfo(userid);

                            if (PlayerStrip.ValidateAuthKey(bingoHistoryID.ToString(), userid.ToString(), authKey))
                            {
                                if (PlayerStrip.ValidateBingoResult(bingoHistoryID, userid))
                                {
                                    if (isGoogleAdv && ConfigGlobal.GoogleAdvActive)
                                    {
                                        #region GetStripResult

                                        var br = BingoUtil.AnalyzeFlashResult(userid, finalResult, resultType);
                                        responseMessage = PlayerStrip.UpdateBingoResult(userid, username, br, resultType);
                                        userMoney       = ((int)info.Extcredits2).ToString("f0");

                                        #endregion
                                    }
                                    else
                                    {
                                        var bingoGetCost = ConfigGlobal.BingoGetCost;
                                        if (info.Extcredits2 >= bingoGetCost)
                                        {
                                            info.Extcredits2 = info.Extcredits2 - bingoGetCost;
                                            if (AdminUsers.UpdateUserAllInfo(info))
                                            {
                                                #region GetStripResult

                                                var br = BingoUtil.AnalyzeFlashResult(userid, finalResult, resultType);
                                                responseMessage = PlayerStrip.UpdateBingoResult(userid, username, br,
                                                                                                resultType);
                                                userMoney = ((int)info.Extcredits2).ToString("f0");

                                                #endregion
                                            }
                                        }
                                        else
                                        {
                                            responseMessage = "-2";
                                        }
                                    }
                                }
                            }
                            else
                            {
                                responseMessage = "-1";
                            }
                        }
                    }
                }
            }
            catch
            {
                responseMessage = "-1";
            }
            var responseText =
                $"ServerMessage={responseMessage}&UserMoney={userMoney}&ID={bingoHistoryID}&UserID={userid}";
            Response.Write(responseText);
        }
Пример #3
0
        private void BindClubHistory()
        {
            if (history == null)
            {
                history = ClubLogic.GetUserClubHistory(username);

                foreach (var ch in history)
                {
                    var actionType = (ClubHistoryActionType)Enum.Parse(typeof(ClubHistoryActionType), ch.ActionType);
                    switch (actionType)
                    {
                    case ClubHistoryActionType.JoinClub:
                        ch.AdditionalData = "ClubSys_Agree";
                        break;

                    case ClubHistoryActionType.RejectJoinClub:
                        ch.AdditionalData = "ClubSys_Disagree";
                        break;

                    case ClubHistoryActionType.LeaveClub:
                        ch.AdditionalData = "ClubSys_Disagree";
                        break;

                    case ClubHistoryActionType.MandatoryLeaveClub:
                        ch.AdditionalData = "ClubSys_Disagree";
                        break;

                    case ClubHistoryActionType.Nominated:
                        ch.AdditionalData = "ClubSys_Agree";
                        break;

                    case ClubHistoryActionType.Dismiss:
                        ch.AdditionalData = "ClubSys_Disagree";
                        break;

                    case ClubHistoryActionType.LuckyPlayer:
                        ch.AdditionalData    = "ClubSys_Agree";
                        ch.ActionDescription = $"<em>{ch.ActionDescription}</em>";
                        break;

                    case ClubHistoryActionType.TransferExtcredit:
                        ch.AdditionalData    = "ClubSys_Agree";
                        ch.ActionDescription = $"<em>{ch.ActionDescription}</em>";
                        break;

                    default:
                        ch.AdditionalData = "ClubSys_Agree";
                        break;
                    }

                    ch.AdditionalData2 = ClubLogic.TranslateClubHistoryActionType(actionType);
                }

                var bingoHistory = PlayerStrip.GetUserBingoHistory(userid);

                foreach (var bh in bingoHistory)
                {
                    var current = new Entity.ClubHistory();

                    var br = new BingoResult(bh.Result, bh.ResultDetail);

                    current.OperatorUserName = username;
                    current.ClubID           = bh.ClubID;
                    current.AdditionalData2  = string.Empty;
                    current.ActionDate       = bh.ActionDate;

                    switch (br.Result)
                    {
                    case BingoResultType.Strip:
                        current.AdditionalData = "ClubSys_Agree";
                        if (br.ResultDetail == "strip")
                        {
                            current.ActionDescription = "获得一套球衣装备";
                        }
                        else if (br.ResultDetail == "strips")
                        {
                            current.ActionDescription = "获得五套球衣装备";
                        }
                        else
                        {
                            current.ActionDescription = BingoUtil.ShowBothBingoDetail("获得一件{0}", br);
                        }
                        break;

                    case BingoResultType.Card:
                        current.AdditionalData = "ClubSys_Agree";
                        if (br.ResultDetail == "legend")
                        {
                            current.ActionDescription = "获得一张视频卡";
                        }
                        else
                        {
                            current.ActionDescription =
                                $"获得球员卡: {Player.Cache.Load(new Guid(br.ResultDetail)).DisplayName}";
                        }
                        break;

                    case BingoResultType.Cash:
                        current.AdditionalData    = "ClubSys_Agree";
                        current.ActionDescription = "获得枪手币: " + br.ResultDetail;
                        break;

                    case BingoResultType.Both:
                        current.AdditionalData    = "ClubSys_Agree";
                        current.ActionDescription = BingoUtil.ShowBothBingoDetail("获得一件{0}和枪手币: {1}", br);
                        break;

                    default:
                        current.AdditionalData    = "ClubSys_Disagree";
                        current.ActionDescription = "什么都没获得";
                        break;
                    }

                    if (br.Result != BingoResultType.Null)
                    {
                        current.ActionDescription = $"<em>{current.ActionDescription}</em>";
                    }

                    history.Add(current);
                }

                var playerHistory = PlayerLog.GetUserPlayerHistory(userid);

                foreach (var ph in playerHistory)
                {
                    var current = new Entity.ClubHistory();

                    current.OperatorUserName  = username;
                    current.ClubID            = ClubLogic.GetActiveUserClubs(userid)[0].ID.Value;
                    current.AdditionalData    = "ClubSys_Star";
                    current.ActionDescription = $"<em>{ph.TypeDesc}</em>";
                    current.ActionDate        = ph.ActionDate;

                    history.Add(current);
                }

                history.Sort(new ClubHistoryComparer());
            }

            gvHistoryLog.DataSource = history;
            gvHistoryLog.DataBind();
        }
Пример #4
0
        private void BindStripHistory()
        {
            if (_list == null)
            {
                _list = PlayerStrip.GetClubBingoHistory(ClubID);

                foreach (var bh in _list)
                {
                    var br = new BingoResult(bh.Result, bh.ResultDetail);
                    switch (br.Result)
                    {
                    case BingoResultType.Strip:
                        if (br.ResultDetail == "strip")
                        {
                            bh.AdditionalData =
                                "<span class=\"ClubSys_Strip SHIRT\">球衣</span><span class=\"ClubSys_Strip SHORTS\">球裤</span><span class=\"ClubSys_Strip SOCK\">球袜</span>";
                        }
                        else if (br.ResultDetail.Contains("strips"))
                        {
                            bh.AdditionalData =
                                "<span class=\"ClubSys_Strip SHIRT\">球衣</span><span class=\"ClubSys_Strip SHORTS\">球裤</span><span class=\"ClubSys_Strip SOCK\">球袜</span><span class=\"ClubSys_Strip RATE\">×5</span>";
                        }
                        else
                        {
                            bh.AdditionalData =
                                BingoUtil.ShowBothBingoDetail(
                                    ("<span class=\"ClubSys_Strip " + br.ResultDetail.ToUpper() + "\">{0}</span>"),
                                    br);
                        }
                        break;

                    case BingoResultType.Card:
                        if (br.ResultDetail == "legend")
                        {
                            bh.AdditionalData = "<span class=\"ClubSys_Strip VIDEO\">视频</span>";
                        }
                        else
                        {
                            bh.AdditionalData =
                                $"<span class=\"ClubSys_Strip CARD\">{Player.Cache.Load(new Guid(br.ResultDetail)).DisplayName}</span>";
                        }
                        break;

                    case BingoResultType.Cash:
                        bh.AdditionalData = "<span class=\"ClubSys_Strip CASH\">枪手币: " + br.ResultDetail + "</span>";
                        break;

                    case BingoResultType.Both:
                        bh.AdditionalData =
                            BingoUtil.ShowBothBingoDetail(
                                "<span class=\"ClubSys_Strip " +
                                br.ResultDetail.Substring(0, br.ResultDetail.IndexOf("+")).ToUpper() +
                                "\">{0}</span><span class=\"ClubSys_Strip CASH\">枪手币: {1}</span>", br);
                        break;
                    }
                }
            }

            gvClubStrip.DataSource = _list;
            gvClubStrip.DataBind();
        }