Пример #1
0
    void ProcessReady(JSONObject messageObj)
    {
        string         uid    = messageObj["body"].ToString();
        GameObject     player = GameObject.Find(_nnPlayerName + uid);
        TBTWPlayerCtrl ctrl   = player.GetComponent <TBTWPlayerCtrl>();

        //去掉牌型显示
        if (uid == EginUser.Instance.uid)
        {
            //StartCoroutine(ctrl.SetDeal(false, null));
            ctrl.SetDeal(false, null);
            ctrl.SetCardTypeUser(null, 0);
            ctrl.SetScore(-1);
        }
        else
        {
            //如果主玩家已经重新开始,则清除当前用户的牌型显示
            if (!btnBegin.activeSelf)
            {
                //StartCoroutine(ctrl.SetDeal(false, null));
                ctrl.SetDeal(false, null);
                ctrl.SetCardTypeOther(null, 0);
                ctrl.SetScore(-1);
            }
        }

        //显示准备
        ctrl.SetReady(true);
        _playingPlayerList.Add(player);
    }
Пример #2
0
    GameObject AddPlayer(JSONObject memberinfo, int _userIndex)
    {
        string uid       = memberinfo["uid"].ToString();
        string bag_money = memberinfo["bag_money"].ToString();
        string nickname  = memberinfo["nickname"].str;
        int    avatar_no = (int)(memberinfo["avatar_no"].n);
        int    position  = (int)(memberinfo["position"].n);
        bool   ready     = (bool)memberinfo["ready"].b;
        bool   waiting   = (bool)memberinfo["waiting"].b;
        string level     = memberinfo["level"].ToString();

        GameObject player = NGUITools.AddChild(this.gameObject, tbtwPlayerPrefab);

        player.name = _nnPlayerName + uid;


        //myplayer.Add(player);


        SetAnchorPosition(player, _userIndex, position);
        TBTWPlayerCtrl ctrl = player.GetComponent <TBTWPlayerCtrl>();

        ctrl.SetPlayerInfo(avatar_no, nickname, bag_money, level);

        if (waiting)
        {
            if (ready)
            {
                ctrl.SetReady(true);
                _readyPlayerList.Add(player);
            }
            _waitPlayerList.Add(player);
        }
        else
        {
            _playingPlayerList.Add(player);
        }

        return(player);
    }