예제 #1
0
    /// <summary>
    /// 互动表情点击
    /// </summary>
    /// <param name="id"></param>
    private void OnBtnInteractiveExpressionClick(int seatPos, int id)
    {
        m_UISeatInfoView.Close();
        cfg_interactiveExpressionEntity entity = cfg_interactiveExpressionDBModel.Instance.Get(id);

        ChatCtrl.Instance.OnInteractiveClick(proto.common.ENUM_PLAYER_MESSAGE.ANIMATION, entity.code, RoomNiuNiuProxy.Instance.GetSeatBySeatPos(seatPos).PlayerId, entity.sound);
    }
예제 #2
0
 public void SetEmoji(List <cfg_interactiveExpressionEntity> lst, Action <int, int> onEmojiClick)
 {
     if (m_InteractiveContainer == null)
     {
         return;
     }
     OnEmojiClick = onEmojiClick;
     for (int i = 0; i < lst.Count; ++i)
     {
         cfg_interactiveExpressionEntity entity = lst[i];
         GameObject go = new GameObject();
         go.SetParent(m_InteractiveContainer);
         Image img = go.AddComponent <Image>();
         UIItemChatExpression item = go.AddComponent <UIItemChatExpression>();
         string path = string.Format("download/{0}/source/uisource/gameuisource/interactive/{1}.drb", ConstDefine.GAME_NAME, entity.animation);
         img.overrideSprite = AssetBundleManager.Instance.LoadSprite(path, entity.image);
         item.SetUI(entity.id, entity.image, OnExpressionClick);
     }
 }
예제 #3
0
    /// <summary>
    /// 服务器广播聊天消息
    /// </summary>
    /// <param name="obj"></param>
    private void OnServerBroadcastMessage(byte[] obj)
    {
        OP_PLAYER_MESSAGE proto = OP_PLAYER_MESSAGE.decode(obj);

        if (proto.typeId == ENUM_PLAYER_MESSAGE.STRING)
        {
            string message = System.Text.Encoding.UTF8.GetString(proto.content);
            cfg_commonMessageEntity commonMessageEntity = cfg_commonMessageDBModel.Instance.GetEntityByMessage(message);
            string audioName = string.Empty;
            if (commonMessageEntity != null)
            {
                audioName = commonMessageEntity.AudioName;
            }
            GameCtrl.Instance.OnReceiveMessage(ChatType.Message, proto.playerId, message, audioName, proto.toId);
        }
        else if (proto.typeId == ENUM_PLAYER_MESSAGE.ANIMATION)
        {
            string message = System.Text.Encoding.UTF8.GetString(proto.content);
            cfg_interactiveExpressionEntity entity = cfg_interactiveExpressionDBModel.Instance.GetEntityByCode(message);
            if (entity != null)
            {
                GameCtrl.Instance.OnReceiveMessage(ChatType.InteractiveExpression, proto.playerId, entity.animation, entity.sound, proto.toId);
            }
        }
        else if (proto.typeId == ENUM_PLAYER_MESSAGE.FACE)
        {
            string message = System.Text.Encoding.UTF8.GetString(proto.content);
            cfg_chatExpressionEntity entity = cfg_chatExpressionDBModel.Instance.GetEntityIdByCode(message);
            if (entity != null)
            {
                GameCtrl.Instance.OnReceiveMessage(ChatType.Expression, proto.playerId, entity.image, entity.sound, proto.toId);
            }
        }
        else if (proto.typeId == ENUM_PLAYER_MESSAGE.BYTES)
        {
            if (isPlayExternalAudio)
            {
                MicroPhoneManager.Instance.PlayExternalAudio(proto.content);
                GameCtrl.Instance.OnReceiveMessage(ChatType.MicroPhone, proto.playerId, string.Empty, string.Empty, proto.toId);
            }
        }
    }