예제 #1
0
        protected override void DoHandle(BEscape msg)
        {
            var user = _user.Read();

            GameUtil.SetMyCurrency(user, msg.currency_type, msg.current_count);
            _user.Invalidate(Time.time);

            var escapeUser = msg.player != null ? msg.player.nickname : "玩家";

            _dialogManager.ShowConfirmBox(
                string.Format(
                    "<color=green>{0}</color>没打到{1}就逃走了\n<color=#ff6600>补偿您{2}{3}</color>",
                    escapeUser,
                    Dmm.PokerLogic.PokerNumType.LabelOf(CurrentRoomTargetHost()),
                    msg.compensation,
                    CurrencyType.LabelOf(msg.currency_type)
                    )
                );

            _analyticManager.Bonus(DataUtil.CalculateGeValue(msg.currency_type, msg.compensation),
                                   AwardType.Compensation);
        }
예제 #2
0
        protected override void DoHandle(BRoundEnd msg)
        {
            var msgPlayingData = msg.playing_data;

            if (msgPlayingData != null)
            {
                _playingData.Write(msgPlayingData, Time.time);
            }

            _bRoundEnd.Write(msg, Time.time);

            var tableUser = _tableUserData.Read();
            var table     = _table.Read();
            var myUser    = _user.Read();
            var room      = _roomData.Read();

            // 更新一下桌子的数据。
            if (DataUtil.UpdateTable(msg.table, table))
            {
                _table.Invalidate(Time.time);
            }

            // 更新玩家自己的数据。
            var user = DataUtil.GetUser(msg.table, tableUser.MySeat);

            if (DataUtil.UpdateUserPublic(user, myUser))
            {
                _user.Invalidate(Time.time);
            }

            // 重置玩家的状态。
            ResetAllUserState();

            if (_appController.IsSingleGameMode())
            {
                return;
            }

            // 非单机模式下,进行统计。
            if (msg.total_multiple > 1)
            {
                _analyticManager.EventValue("round_end_fanbei", null, msg.total_multiple);
            }

            var type  = room == null ? CurrencyType.GOLDEN_EGG : room.currency_type;
            var count = 0;

            var userName = user == null ? null : user.username;

            if (StringUtil.AreEqual(msg.username1, userName))
            {
                count = msg.final_money1;
            }
            else if (StringUtil.AreEqual(msg.username2, userName))
            {
                count = msg.final_money2;
            }
            else if (StringUtil.AreEqual(msg.username3, userName))
            {
                count = msg.final_money3;
            }
            else if (StringUtil.AreEqual(msg.username4, userName))
            {
                count = msg.final_money4;
            }

            var currentRoomTaxRate = room == null ? 0 : room.tax_rate;
            var currentRoomId      = room == null ? -1 : room.room_id;

            if (count > 0)
            {
                _analyticManager.Bonus(
                    DataUtil.CalculateGeValue(type, count * (100 - currentRoomTaxRate) / 100),
                    AwardType.RoundEndWin);
            }
            else if (count < 0)
            {
                var geVal = (int)DataUtil.CalculateGeValue(type, Math.Abs(count));
                _analyticManager.Buy("round_end_lose", 1, geVal);

                // 统计结算带来的负金蛋流量。
                var attrs = new Dictionary <string, string>();
                attrs.Add("base_money", "" + currentRoomTaxRate);
                _analyticManager.EventValue("round_end_ge" + currentRoomId, attrs,
                                            geVal * currentRoomTaxRate / 100);
            }
        }