Ejemplo n.º 1
0
    public UILabel mLabel;               //文本框

    /// <summary>
    /// 设置数据并显示
    /// </summary>
    /// <param name="data">聊天数据</param>
    /// <param name="pos">坐标,世界坐标</param>
    /// <param name="call">回调</param>
    public void SetData(SendReceiveGameChat data, Vector3 pos, eChatTextDirectionType dType)
    {
        //设置位置
        transform.position = pos;
        gameObject.SetActive(true);
        eGameChatContentType _type = (eGameChatContentType)data.chatType;

        if (_type == eGameChatContentType.Chat)//普通文字
        {
            mLabel.text = data.content;
        }
        else if (_type == eGameChatContentType.TexTVoice)//文字语音
        {
            List <ConfigDada> conList = ConfigManager.GetConfigs <TSTGameTxtChatConfig>();
            ConfigDada        conData = conList.Find(o => o.conIndex == data.faceIndex.ToString());
            if (conData == null)
            {
                return;
            }
            TSTGameTxtChatConfig con = conData as TSTGameTxtChatConfig;
            mLabel.text = con.name;

            string voice = data.sex == 1 ? con.soundNameman : con.soundNamewoman;
            SoundProcess.PlaySound("ChatSound/" + voice);
        }
        mBg.width = 20 + mLabel.width;//设置背景长度
        DelayRun(2, () =>
        {
            gameObject.SetActive(false);
        });
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 获取特效配置表
    /// </summary>
    /// <param name="insType">操作类型</param>
    /// <returns></returns>
    private MJGameInsEffectConfig GetInsEffectConfig(eMJInstructionsType insType)
    {
        string     index = insType.GetHashCode().ToString();
        ConfigDada con   = ConfigManager.GetConfigs <MJGameInsEffectConfig>().Find(o => o.conIndex.Equals(index));

        if (con == null)
        {
            return(null);
        }
        return(con as MJGameInsEffectConfig);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 流局
    /// </summary>
    public void SetNoWinnerShow()
    {
        List <ConfigDada> conList = ConfigManager.GetConfigs <MJGameInsEffectConfig>();
        ConfigDada        con     = conList.Find(o => o.conIndex == "100");

        if (con == null)
        {
            return;
        }
        MJGameInsEffectConfig insCon = con as MJGameInsEffectConfig;

        LoadAndShowEffect(insCon.effect[0], MJGameModel.Inst.mMySeatId);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 播放牌声音
    /// </summary>
    /// <param name="cardId">牌id</param>
    /// <param name="seatId">座位号</param>
    private void PlayCardVoice(int cardId, int seatId)
    {
        int        sex  = MJGameModel.Inst.mRoomPlayers[seatId].sex;//性别
        string     card = cardId.ToString();
        ConfigDada con  = ConfigManager.GetConfigs <MJGameCardVoiceConfig>().Find(o => o.conIndex.Equals(card));

        if (con != null)
        {
            MJGameCardVoiceConfig voiceCon = con as MJGameCardVoiceConfig;
            if (voiceCon.voice == null || voiceCon.voice.Length == 0)
            {
                return;
            }
            int index = Random.Range(0, voiceCon.voice.Length); //随机选一个声音
            if (sex == 1)                                       //男
            {
                SoundProcess.PlaySound(VOICE_MJ_MAN + voiceCon.voice[index]);
            }
            else//女
            {
                SoundProcess.PlaySound(VOICE_MJ_WOMAN + voiceCon.voice[index]);
            }
        }
    }
Ejemplo n.º 5
0
 /// <summary>
 /// 播放操作声音
 /// </summary>
 /// <param name="data"></param>
 private void PlayInsVoice(MJoptInfoData data)
 {
     if (data.ins == eMJInstructionsType.YPDX)//一炮多响
     {
         if (data.seatIdList != null)
         {
             string ins = data.ins.GetHashCode().ToString();
             for (int i = 0; i < data.seatIdList.Count; i++)
             {
                 int                  sex      = MJGameModel.Inst.mRoomPlayers[data.seatIdList[i]].sex;//性别
                 ConfigDada           con      = ConfigManager.GetConfigs <MJGameInsVoiceConfig>().Find(o => o.conIndex.Equals(ins));
                 MJGameInsVoiceConfig voiceCon = con as MJGameInsVoiceConfig;
                 if (voiceCon == null || voiceCon.voice == null || voiceCon.voice.Length == 0)
                 {
                     return;
                 }
                 int index = Random.Range(0, voiceCon.voice.Length); //随机选一个声音
                 if (sex == 1)                                       //男
                 {
                     SoundProcess.PlaySound(VOICE_INS_MAN + voiceCon.voice[index]);
                 }
                 else//女
                 {
                     SoundProcess.PlaySound(VOICE_INS_WOMAN + voiceCon.voice[index]);
                 }
             }
         }
     }
     else if (data.ins == eMJInstructionsType.PENG || data.ins == eMJInstructionsType.GANG)//碰和杠
     {
         string               ins      = data.ins.GetHashCode().ToString();
         int                  sex      = MJGameModel.Inst.mRoomPlayers[data.seatId].sex;//性别
         ConfigDada           con      = ConfigManager.GetConfigs <MJGameInsVoiceConfig>().Find(o => o.conIndex.Equals(ins));
         MJGameInsVoiceConfig voiceCon = con as MJGameInsVoiceConfig;
         if (voiceCon == null || voiceCon.voice == null || voiceCon.voice.Length == 0)
         {
             return;
         }
         int index = Random.Range(0, voiceCon.voice.Length); //随机选一个声音
         if (sex == 1)                                       //男
         {
             SoundProcess.PlaySound(VOICE_INS_MAN + voiceCon.voice[index]);
         }
         else//女
         {
             SoundProcess.PlaySound(VOICE_INS_WOMAN + voiceCon.voice[index]);
         }
         //if (data.ins == eMJInstructionsType.GANG)//杠要播放刮风和下雨的声音
         //SoundProcess.PlaySound(VOICE_INS_OTHER + voiceCon.subTypeVoice[data.type]);
     }
     else if (data.ins == eMJInstructionsType.HU)
     {
         string               ins      = data.ins.GetHashCode().ToString();
         int                  sex      = MJGameModel.Inst.mRoomPlayers[data.seatId].sex;//性别
         ConfigDada           con      = ConfigManager.GetConfigs <MJGameInsVoiceConfig>().Find(o => o.conIndex.Equals(ins));
         MJGameInsVoiceConfig voiceCon = con as MJGameInsVoiceConfig;
         if (voiceCon == null || voiceCon.voice == null || voiceCon.voice.Length == 0)
         {
             return;
         }
         string str = sex == 1 ? VOICE_INS_MAN : VOICE_INS_WOMAN;
         if ((eHuThrType)data.thrType != eHuThrType.NONE && voiceCon.thrTypeVoice != null && voiceCon.thrTypeVoice.Length > data.thrType)//第三级类型
         {
             SoundProcess.PlaySound(str + voiceCon.thrTypeVoice[data.thrType]);
             return;
         }
         if ((eHuSubType)data.subType != eHuSubType.NONE && voiceCon.subTypeVoice != null && voiceCon.subTypeVoice.Length > data.subType)//第二级类型
         {
             SoundProcess.PlaySound(str + voiceCon.subTypeVoice[data.subType]);
             return;
         }
         if ((eHuType)data.type != eHuType.NONE && voiceCon.voice != null && voiceCon.voice.Length > data.type)//第一级类型
         {
             SoundProcess.PlaySound(str + voiceCon.voice[data.type]);
             return;
         }
     }
 }