/// <summary> /// 播放跟注下音效 /// </summary> public void PlayFollowAudio() { if (player != null) { if (flowTimes <= 1) { GamePlaySound(player.sex, "genzhu"); } else if (flowTimes == 2) { GamePlaySound(player.sex, "wohaigen"); } else if (flowTimes == 3) { GamePlaySound(player.sex, "nigenwojiugen"); } else if (flowTimes == 4) { GamePlaySound(player.sex, "wozaigen"); } else if (flowTimes >= 5) { GamePlaySound(player.sex, "wohaiyaogen"); } flowTimes++; ChatMsgContent msgContent = new ChatMsgContent(); msgContent.msgType = MsgType.Text; msgContent.chatMsg = "跟注"; msgContent.userName = player.userName; msgContent.gender = player.sex; ShowPlayerMsg(msgContent); } }
/// <summary> /// 加注音效 /// </summary> public void PlayAddBetAudio(int index) { if (player != null) { betIndex = index; if (betIndex == 1) { GamePlaySound(player.sex, "jiazu"); } else if (betIndex >= 2 && betIndex < 4) { GamePlaySound(player.sex, "wozaijiadian"); } else if (betIndex == 4) { GamePlaySound(player.sex, "yaowanjiuwandade"); } ChatMsgContent msgContent = new ChatMsgContent(); msgContent.msgType = MsgType.Text; msgContent.chatMsg = "加注"; msgContent.userName = player.userName; msgContent.gender = player.sex; ShowPlayerMsg(msgContent); } }
public void AddBullet(ChatMsgContent chatMsgContent) { BulletMsg bm = null; if (objPool.Count > 0) { bm = objPool.Dequeue(); } if (bm == null) { bm = new BulletMsg(); bm.obj = GameObject.Instantiate(bullet); } bm.obj.GetComponent <Text>().text = "<size=38>" + "<color=red>【VIP" + chatMsgContent.viplv + "】</color></size>" + chatMsgContent.userName + ": " + chatMsgContent.chatMsg; bm.msgContent = chatMsgContent; //obj.GetComponent<ContentSizeFitter>().SetLayoutHorizontal(); //float x = obj.GetComponent<RectTransform>().sizeDelta.x; //obj.transform.localPosition = new Vector3(740 + x, rowPos[Random.Range(0, 7)], 0); DebugUtils.DebugerExtension.Log(bm.obj.transform.localPosition.ToString()); BulletQueue.Enqueue(bm); }
/// <summary> /// 点击了发送 /// </summary> private void BtnSendMsgOnClick() { AudioManager.Instance.PlaySound("button"); string msg = input.text.Trim(); if (msg.Length > 0) { ChatMsgContent msgContent = new ChatMsgContent(); msgContent.msgType = MsgType.Text; msgContent.chatMsg = msg; msgContent.viplv = PlayerCache.loginInfo.vipLv; msgContent.userName = PlayerCache.loginInfo.userName; msgContent.gender = PlayerCache.loginInfo.sex; PlayerCache.roomPlayerObjDic[PlayerCache.loginInfo.uid].ShowPlayerMsg(msgContent); zjhPanel.zJHOperation.sendChatMsg((int)MsgType.Text, msg); chatPanelTrans.gameObject.SetActive(false); msgTxtContent.text += "<color=red><size=30>" + "【VIP" + PlayerCache.loginInfo.vipLv + "】</size></color>" + "<color=purple>" + PlayerCache.loginInfo.userName + ":</color> <color=green>" + msg + "</color>\n";; } else { XUIMidMsg.QuickMsg("请输入聊天消息"); } input.text = ""; }
/// <summary> /// 接收聊天信息 /// </summary> /// <param name="chatDto"></param> public void ReceiveMsg(ChatDto chatDto) { switch ((MsgType)chatDto.msgType) { case MsgType.Text: ChatMsgContent msgContent = new ChatMsgContent { msgType = MsgType.Text, chatMsg = chatDto.msg, userName = chatDto.username, viplv = chatDto.vipLv, gender = chatDto.sex }; AudioManager.Instance.PlaySound("mess"); PlayerCache.roomPlayerObjDic[chatDto.uid].ShowPlayerMsg(msgContent); msgTxtContent.text += "<color=red><size=30>" + "【VIP" + chatDto.vipLv + "】</size></color>" + "<color=orange>" + chatDto.username + ":</color>" + chatDto.msg + "\n"; break; case MsgType.Expression: ChatMsgContent msgContent1 = new ChatMsgContent { msgType = MsgType.Expression, chatMsg = chatDto.msg, userName = chatDto.username, gender = chatDto.sex }; PlayerCache.roomPlayerObjDic[chatDto.uid].ShowPlayerMsg(msgContent1); break; default: break; } }
public void ShowPlayerMsg(ChatMsgContent msgContent) { if (playerMsgCoroutine != null) { ILMgr.Instance.StopCoroutine(playerMsgCoroutine); playerMsgCoroutine = null; } playerMsgCoroutine = ILMgr.Instance.StartCoroutine(PlayerMsg(msgContent)); }
/// <summary> /// 发送快速消息 /// </summary> /// <param name="msgTrns">msg Transfom</param> private void BtnSendQuickMsg(Transform msgTrns) { AudioManager.Instance.PlaySound("button"); string content = msgTrns.GetChild(0).GetComponent <Text>().text; ChatMsgContent msgContent = new ChatMsgContent(); msgContent.msgType = MsgType.Text; msgContent.chatMsg = content; msgContent.userName = PlayerCache.loginInfo.userName; msgContent.gender = PlayerCache.loginInfo.sex; PlayerCache.roomPlayerObjDic[PlayerCache.loginInfo.uid].ShowPlayerMsg(msgContent); zjhPanel.zJHOperation.sendChatMsg((int)MsgType.Text, content); QuickMsgPanelTrans.gameObject.SetActive(false); isOpenQuickMsg = false; chatPanelTrans.gameObject.SetActive(false); }
/// <summary> /// 显示玩家发送的消息 /// </summary> /// <param name="MsgTrans">玩家座位Transform</param> /// <param name="msg">消息</param> /// <returns></returns> private IEnumerator PlayerMsg(ChatMsgContent msgContent) { switch (msgContent.msgType) { case MsgType.Text: //文本消息 if (msgContent.chatMsg != null) { Text text = transform.GetChild(0).GetChild(0).GetComponent <Text>(); if (msgContent.chatMsg == "加注" || msgContent.chatMsg == "跟注" || msgContent.chatMsg == "全压" || msgContent.chatMsg == "我还是放弃吧" || msgContent.chatMsg == "看牌咯") { transform.GetChild(0).GetChild(0).GetComponent <Text>().text = msgContent.chatMsg; text.transform.parent.gameObject.SetActive(true); } else { bulletScreen.AddBullet(msgContent); } yield return(new WaitForSeconds(3f)); text.transform.parent.gameObject.SetActive(false); } break; case MsgType.Expression: //表情消息 if (msgContent.chatMsg != null) { Image expressionImg = transform.GetChild(2).GetChild(8).GetComponent <Image>(); expressionImg.gameObject.SetActive(true); Sprite[] sprites = GameTools.Instance.GetAnimatoinSprite("Sprite/Expression/" + msgContent.chatMsg); for (int j = 0; j < 3; j++) { for (int i = 0; i < sprites.Length; i++) { expressionImg.sprite = sprites[i]; yield return(new WaitForSeconds(0.15f)); } } expressionImg.gameObject.SetActive(false); } break; } }
public void OtherPlayerAllIn() { if (player != null) { GamePlaySound(player.sex, "quanyaniganme"); ChatMsgContent msgContent = new ChatMsgContent(); msgContent.msgType = MsgType.Text; msgContent.chatMsg = "全压"; msgContent.userName = player.userName; msgContent.gender = player.sex; ShowPlayerMsg(msgContent); transform.GetChild(1).gameObject.SetActive(false); transform.GetChild(2).GetChild(9).gameObject.SetActive(true); transform.GetChild(2).GetChild(2).gameObject.SetActive(true); } }
/// <summary> /// 发送表情 /// </summary> /// <param name="msgTrns"></param> private void BtnExpressionMsg(Transform msgTrns) { string content = msgTrns.name; string num = content.Substring(11); AudioManager.Instance.PlaySound("face_vip_" + num); ChatMsgContent msgContent = new ChatMsgContent(); msgContent.msgType = MsgType.Expression; msgContent.chatMsg = content; msgContent.userName = PlayerCache.loginInfo.userName; msgContent.gender = PlayerCache.loginInfo.sex; PlayerCache.roomPlayerObjDic[PlayerCache.loginInfo.uid].ShowPlayerMsg(msgContent); zjhPanel.zJHOperation.sendChatMsg((int)MsgType.Expression, content); ExpressionPanelTrans.gameObject.SetActive(false); isOpenQuickMsg = false; chatPanelTrans.gameObject.SetActive(false); }
public void UpdateState(params object[] param) { #region //更新状态 PlayerStatus type = (PlayerStatus)param[0]; Sprite sprite; Image image = transform.GetChild(1).GetComponent <Image>(); if (player != null) { switch (type) { case PlayerStatus.None: break; case PlayerStatus.Prepare: //准备 isPrepare = true; sprite = GameTools.Instance.GetSpite("Sprite/Status/prepare_user"); image.sprite = sprite; image.SetNativeSize(); transform.GetChild(1).gameObject.SetActive(true); break; case PlayerStatus.Look: GamePlaySound(player.sex, "wokanpailou"); //看牌 if (player.uid != PlayerCache.loginInfo.uid) { sprite = GameTools.Instance.GetSpite("Sprite/Status/card_user_look"); image.gameObject.SetActive(true); image.sprite = sprite; image.SetNativeSize(); ChatMsgContent msgContent = new ChatMsgContent(); msgContent.msgType = MsgType.Text; msgContent.chatMsg = "看牌咯"; msgContent.userName = player.userName; msgContent.gender = player.sex; ShowPlayerMsg(msgContent); } isLook = true; break; case PlayerStatus.GiveUp: //弃牌 GamePlaySound(player.sex, "wohaishifangqiba"); AudioManager.Instance.PlaySound("s_giveUp"); sprite = GameTools.Instance.GetSpite("Sprite/Status/card_user_giveup"); image.gameObject.SetActive(true); image.sprite = sprite; image.SetNativeSize(); if (player.uid != PlayerCache.loginInfo.uid) { ChatMsgContent msgContent = new ChatMsgContent(); msgContent.msgType = MsgType.Text; msgContent.chatMsg = "我还是放弃吧"; msgContent.userName = player.userName; msgContent.gender = player.sex; ShowPlayerMsg(msgContent); } isFlod = true; break; case PlayerStatus.Lose: //失败 AudioManager.Instance.PlaySound("s_bipaiFailed"); sprite = GameTools.Instance.GetSpite("Sprite/Status/card_user_lose"); image.gameObject.SetActive(true); image.sprite = sprite; image.SetNativeSize(); break; default: break; } } #endregion }