protected virtual void ChatResponse(ChatMsg msg) { if (this.userDto == null) { return; } //如果是自己 if (msg.userId == this.userDto.id) { //显示聊天框 ShowDialog(ChatConstant.GetContent(msg.chatMsgType)); audioMsg.Set("Sound/Chat/Chat_", msg.chatMsgType.ToString()); Dispatch(AreaCode.AUDIO, AudioEvent.EFFECTAUDIO, audioMsg); } }
public override void OnReceive(int subCode, object value) { switch (subCode) { case FightCode.BAOJING_SRES: { if ((int)value == 1) //报警就剩一张牌了 { audioMsg.Set("Sound/Fight/", "baojing1"); Dispatch(AreaCode.AUDIO, AudioEvent.EFFECTAUDIO, audioMsg); Dispatch(AreaCode.AUDIO, AudioEvent.BGMAUDIO, 2); } else if ((int)value == 2) //报警就剩两张牌了 { audioMsg.Set("Sound/Fight/", "baojing2"); Dispatch(AreaCode.AUDIO, AudioEvent.EFFECTAUDIO, audioMsg); Dispatch(AreaCode.AUDIO, AudioEvent.BGMAUDIO, 2); } } break; case FightCode.BACKTOFIGHT_SRES: BackToFight(); break; case FightCode.RESTART: Restart(); break; case FightCode.GET_CARDS_SRES: GetCardsResponse(value as List <CardDto>); break; case FightCode.QIANG_LANDLORD_BRO: //点击抢地主按钮 的回应 发来一个landlordDto 包含userId 和 底牌 QiangLandlordBro(value as LandlordDto); break; case FightCode.CHUPAI_SRES: { uiMsg.Set("管不上", Color.red); Dispatch(AreaCode.UI, UIEvent.MessageInfoPanel, uiMsg); } break; //case FightCode.TURN_SRES: // break; case FightCode.QIANG_TURN_BRO: //该谁抢地主 TurnToQiang((int)value); break; case FightCode.CHUPAI_TURN_BRO: //该谁出牌 TurnToChu((int)value); break; case FightCode.CHUPAI_BRO: ChuPaiResponse(value as ChuPaiDto); break; case FightCode.BUCHU_BRO: BuChuResponse((int)value); break; case FightCode.BUCHU_SRES: { uiMsg.Set("不能不出,你是头家", Color.red); Dispatch(AreaCode.UI, UIEvent.MessageInfoPanel, uiMsg); } break; case FightCode.BUQIANG_LANDLORD_BRO: //谁不抢 BuQiangLandlordResponse((int)value); break; case FightCode.LEAVE_BRO: //离开了要干嘛?把ui隐藏了 { var userId = (int)value; if (Models.gameModel.MatchRoomDto != null) { //移除之前先把信息保存下来 var leaveUserDto = Models.gameModel.MatchRoomDto.uIdUdtoDic[userId]; //移除数据 Models.gameModel.MatchRoomDto.Delete(userId); //玩家离开了房间 把准备文字和对话面板 地主或农民的ui隐藏 Dispatch(AreaCode.UI, UIEvent.PLAYER_LEAVE, userId); //提示消息 xxx 离开了房间 uiMsg.Set(string.Format("玩家 :{0} 退出", leaveUserDto.name), Color.green); Dispatch(AreaCode.UI, UIEvent.MessageInfoPanel, uiMsg); } } break; case FightCode.OVER_BRO: GameOver(value as OverDto); break; default: break; } }