示例#1
0
        public async void ConfirmCreateBtnEvent()
        {
            C2F_CreatorFriendCircle c2FCreatorFriendCircle = new C2F_CreatorFriendCircle();

            c2FCreatorFriendCircle.Name         = mFriendCicleNameInputField.text;
            c2FCreatorFriendCircle.Announcement = mAnnouncementInputField.text;
            c2FCreatorFriendCircle.WanFaCofigs  = _CurrSelectWanFaConfigs;
            c2FCreatorFriendCircle.ToyGameId    = ToyGameId.CardFiveStar;
            if (string.IsNullOrEmpty(c2FCreatorFriendCircle.Name))
            {
                UIComponent.GetUiView <NormalHintPanelComponent>().ShowHintPanel("亲友圈名字不能为空");
                return;
            }
            if (_CurrSelectWanFaConfigs == null || !RoomConfigIntended.IntendedRoomConfigParameter(c2FCreatorFriendCircle.WanFaCofigs, c2FCreatorFriendCircle.ToyGameId))
            {
                UIComponent.GetUiView <NormalHintPanelComponent>().ShowHintPanel("玩法配置出错请重新选择");
                return;
            }

            F2C_CreatorFriendCircle f2CCreatorFriend = (F2C_CreatorFriendCircle)await SessionComponent.Instance.Call(c2FCreatorFriendCircle);

            if (string.IsNullOrEmpty(f2CCreatorFriend.Message))
            {
                FrienCircleComponet.Ins.SucceedCreatorFriendsCircle(f2CCreatorFriend.FriendsCircle);
                Hide();
            }
            else
            {
                UIComponent.GetUiView <NormalHintPanelComponent>().ShowHintPanel(f2CCreatorFriend.Message);
            }
        }
 //修改玩法
 public static async Task AlterWanFa(this FriendsCircle friendsCircle, RepeatedField <int> roomConfigs, long toyGameId, IResponse iResponse)
 {
     //效验配置 如果配置错误 会使用默认配置
     if (!RoomConfigIntended.IntendedRoomConfigParameter(roomConfigs, toyGameId))
     {
         //效验不通过 不会修改
         iResponse.Message = "玩法参数有误 无法修改";
         return;
     }
     friendsCircle.DefaultWanFaCofigs = roomConfigs;
     await FriendsCircleComponent.Ins.SaveDB(friendsCircle);
 }
示例#3
0
        //创建亲友圈
        public static async Task <FriendsCircle> CreatorFriendsCircle(this FriendsCircleComponent friendsCircleComponent,
                                                                      long creatorUserId, string name, string announcement, RepeatedField <int> roomConfigs, long toyGameId, IResponse iResponse)
        {
            User creatorUser = await UserHelp.QueryUserInfo(creatorUserId);

            if (creatorUser.Jewel < 200)
            {
                iResponse.Message = "钻石少于200无法创建亲友圈";
                return(null);
            }
            //效验配置 如果配置错误 会使用默认配置
            if (!RoomConfigIntended.IntendedRoomConfigParameter(roomConfigs, toyGameId))
            {
                iResponse.Message = "玩法配置错误 无法创建";
                return(null);
            }
            FriendsCircle friendsCircle = FriendsCircleFactory.Create(name, creatorUserId, roomConfigs, announcement);
            await friendsCircle.SucceedJoinFriendsCircle(creatorUserId); //成功加入到亲友圈 这个方法和保存亲友圈数据到数据库

            return(friendsCircle);
        }
示例#4
0
        //创建房卡匹房间
        public static MatchRoom Create(RepeatedField <int> roomConfigLists, long toyGameId, int roomId, int friendsCircleId, long userJewelNum, IResponse iResponse)
        {
            int  needJeweNumCount = 0;
            int  number           = 0;
            bool isAADeductJewel  = false;

            //效验房间配置正不正确 不正确的值会修改为默认值  会赋值 需要的钻石数 和房间配置人数
            if (!RoomConfigIntended.IntendedRoomConfigParameter(roomConfigLists, toyGameId, ref needJeweNumCount,
                                                                ref number, ref isAADeductJewel))
            {
                iResponse.Message = "房间配置表错误";
                return(null);
            }

            //如果是亲友圈房间亲友圈的 圈主钻石数要大于100
            if (friendsCircleId > 0 && userJewelNum < 100)
            {
                iResponse.Message = "亲友圈主人钻石不足100";
                return(null);
            }
            if (userJewelNum < needJeweNumCount)
            {
                iResponse.Message = "钻石不足";
                return(null);
            }
            MatchRoom       matchRoom  = ComponentFactory.Create <MatchRoom>();
            MatchRoomConfig roomConfig = MatchRoomConfigFactory.Create(number, roomId, toyGameId, roomConfigLists);

            matchRoom.RoomId           = roomId;
            matchRoom.FriendsCircleId  = friendsCircleId;
            matchRoom.RoomConfig       = roomConfig;
            matchRoom.RoomType         = RoomType.RoomCard;
            matchRoom.NeedJeweNumCount = needJeweNumCount;
            matchRoom.IsAADeductJewel  = isAADeductJewel;
            return(matchRoom);
        }