Exemplo n.º 1
0
    /// <summary>
    /// 初始化玩家信息
    /// </summary>
    /// <param name="rightSeatId"></param>
    /// <param name="leftSeatIds"></param>
    public void SetPlayers(int leftSeatId, List <int> rightSeatIds)
    {
        GoldFlowerPlayer player = null;

        for (int i = 0; i < rightSeatIds.Count; i++)
        {
            player = XXGoldFlowerGameModel.Inst.mPlayerInfoDic[rightSeatIds[i]];
            RightPlayers[i].gameObject.SetActive(true);
            Assets.LoadIcon(player.headUrl, (t) =>
            {
                RightPlayers[i].GetComponentInChildren <UITexture>().mainTexture = t;
            });
            RightPlayers[i].GetComponentInChildren <UILabel>().text = player.nickname;
        }
        for (int i = rightSeatIds.Count; i < RightPlayers.Length; i++)
        {
            RightPlayers[i].gameObject.SetActive(false);
        }
        player = XXGoldFlowerGameModel.Inst.mPlayerInfoDic[leftSeatId];
        Assets.LoadIcon(player.headUrl, (t) =>
        {
            mLeftHead.mainTexture = t;
        });
        mLeftNickName.text = player.nickname;
        StartCoroutine(PkLose());
    }
Exemplo n.º 2
0
    /// <summary>
    /// 有玩家坐下
    /// </summary>
    /// <param name="msg"></param>
    private void NetOnPlayerSeatDown(MessageData msg)
    {
        OnGoldFlowerOnSeatDown ack    = msg.Read <OnGoldFlowerOnSeatDown>();
        GoldFlowerPlayer       player = ack.info;

        if (player.userId == PlayerModel.Inst.UserInfo.userId)
        {
            XXGoldFlowerGameModel.Inst.mMySeatId = player.seatId;
        }
        PlayerSeatDown(player);
        mView.NetOnPlayerSeatDown(player);
    }
Exemplo n.º 3
0
 /// <summary>
 /// 玩家坐下
 /// </summary>
 /// <param name="player"></param>
 private void PlayerSeatDown(GoldFlowerPlayer player)
 {
     if (!XXGoldFlowerGameModel.Inst.mSeatIdList.Contains(player.seatId))
     {
         XXGoldFlowerGameModel.Inst.mSeatIdList.Add(player.seatId);
     }
     if (!XXGoldFlowerGameModel.Inst.mPlayerInfoDic.ContainsKey(player.seatId))
     {
         XXGoldFlowerGameModel.Inst.mPlayerInfoDic.Add(player.seatId, player);
     }
     else
     {
         XXGoldFlowerGameModel.Inst.mPlayerInfoDic[player.seatId] = player;
     }
     if (player.seatId == XXGoldFlowerGameModel.Inst.mMySeatId)
     {
         XXGoldFlowerGameModel.Inst.mAutoGen = player.autoGen;
     }
 }
Exemplo n.º 4
0
    /// <summary>
    /// 显示文字聊天
    /// </summary>
    /// <param name="chat"></param>
    private void PlayTxtVoiceChat(SendReceiveGameChat chat)
    {
        mTxtChatSp.gameObject.SetActive(true);

        List <ConfigDada> mRulelist = mRulelist = ConfigManager.GetConfigs <TSTGameTxtChatConfig>();

        for (int i = 0; i < mRulelist.Count; i++)
        {
            TSTGameTxtChatConfig config = mRulelist[i] as TSTGameTxtChatConfig;

            if (config.id == chat.faceIndex)
            {
                mTxtChatSp.GetComponentInChildren <UILabel>().text = config.name;
                mTxtChatSp.GetComponent <UISprite>().width         = mTxtChatSp.GetComponentInChildren <UILabel>().width + 70;

                int sex = 1;

                GoldFlowerPlayer player = null;

                if (XXGoldFlowerGameModel.Inst.mPlayerInfoDic.TryGetValue(chat.fromSeatId, out player))
                {
                    sex = player.sex;
                }

                if (sex == 1)
                {
                    SoundProcess.PlaySound("ChatSound/" + config.soundNameman);
                }
                else
                {
                    SoundProcess.PlaySound("ChatSound/" + config.soundNamewoman);
                }


                StopCoroutine("DelayHideTxtChat");
                StartCoroutine("DelayHideTxtChat");
            }
        }
    }