Beispiel #1
0
    //创建牌
    void CreateCards(Transform parentTrans, List <Card> cards, bool isSort)
    {
        List <Card> temp = cards;

        if (isSort)
        {
            temp.Sort((a, b) =>
            {
                int a_count = cards.FindAll(p => p.GetCardWeight == a.GetCardWeight).Count;
                int b_count = cards.FindAll(p => p.GetCardWeight == b.GetCardWeight).Count;
                if (a_count > b_count)
                {
                    return(-1);
                }
                else if (a_count < b_count)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });
        }
        for (int i = 0; i < temp.Count; i++)
        {
            CardUI a = LandlordsPage.MakeSprite(temp[i], false, parentTrans);
            a.SetCardSize(new Vector2(145, 190));
        }
        ani.Play();
    }
Beispiel #2
0
 /// <summary>
 /// 展示自身的牌
 /// </summary>
 public void ShowCards(bool isShow)
 {
     if (isShow)
     {
         if (_handCard == null)
         {
             return;
         }
         net_protocol.DdzJSPlayerInfo result = LandlordsModel.Instance.ResultModel.GetResultInfos().Find(p => p.userId.ToString() == _handCard.playerInfo.uid);
         if (result == null)
         {
             return;
         }
         for (int i = 0; i < result.poker.Count; i++)
         {
             Card   card = new Card(result.poker[i], _handCard.playerInfo.uid);
             CardUI ui   = LandlordsPage.MakeSprite(card, false, resultCardsShow);
             ui.SetCardSize(new Vector2(145, 190));
             ui.Card.IsSprite = false;
             ui.name          = (i + 1).ToString();
         }
     }
     else
     {
         for (int i = 0; i < resultCardsShow.childCount; i++)
         {
             resultCardsShow.GetChild(i).GetComponent <CardUI>().Destroy();
         }
     }
 }
Beispiel #3
0
 // 快速发牌
 void QuickDealCard()
 {
     for (int i = 0; i < _handCard.CardsCount; i++)
     {
         CardUI ui = LandlordsPage.MakeSprite(_handCard[i], false, handCard);
         if (ui)
         {
             ui.SetCardSize(new Vector2(239, 325));
         }
     }
     StartCoroutine(SpriteSort());
 }
 /// <summary>
 /// 显示层发底牌
 /// </summary>
 public void DealDipai(List <Card> cards)
 {
     for (int i = 0; i < dipaiDesk.childCount; i++)
     {
         dipaiDesk.GetChild(i).GetComponent <CardUI>().Destroy();
     }
     for (int i = 0; i < cards.Count; i++)
     {
         CardUI cardUI = LandlordsPage.MakeSprite(cards[i], false, dipaiDesk);
         cardUI.SetCardSize(new Vector2(56, 76));
     }
 }
Beispiel #5
0
 // 协程发牌
 IEnumerator DelayDealCard()
 {
     AudioManager.Instance.PlayTempSound(AudioManager.AudioSoundType.dealCard, PageManager.Instance.CurrentPage.name);
     for (int i = 0; i < _handCard.CardsCount; i++)
     {
         CardUI ui = LandlordsPage.MakeSprite(_handCard[i], false, handCard);
         if (ui)
         {
             ui.SetCardSize(new Vector2(239, 325));
         }
         yield return(new WaitForSecondsRealtime(0.1f));
     }
     StartCoroutine(SpriteSort());
 }
    //public Text turnLb;

    void Awake()
    {
        Instance       = this;
        cardAssetBunle = BundleManager.Instance.GetSpriteBundle("card", typeof(LandlordsPage).ToString());
        faceBundle     = BundleManager.Instance.GetSpriteBundle("face");
    }
Beispiel #7
0
    //public static EnterDdzRoomResp _resp;
    /// <summary>
    /// 有人进入房间应答
    /// </summary>
    /// <param name="resp"></param>
    public static void G2C_EnterRoom(EnterDdzRoomResp resp)
    {
        //_resp = resp;
        if (LandlordsModel.Instance.IsInFight)
        {
            return;
        }
        //房间信息
        if (resp.yuePaiInfo != null)//房卡房
        {
            LandlordsModel.Instance.RoomModel.CurRoomInfo = new LandlordsRoomModel.LandlordsRoomInfo()
            {
                RoomID       = resp.yuePaiInfo.rno.ToString(),
                RoomType     = RoomType.RoomCard,
                Beishu       = resp.yuePaiInfo.fs,
                LeastStore   = resp.yuePaiInfo.ante,
                CostCard     = resp.yuePaiInfo.ks,
                CurPlayCount = resp.yuePaiInfo.currJs,
                MaxPlayCount = resp.yuePaiInfo.js
            };
            LandlordsModel.Instance.RoomModel.CurRoomInfo.IsMatch = false;
        }
        else if (resp.matchInfo != null)//比赛房
        {
            LandlordsModel.Instance.RoomModel.CurRoomInfo = new LandlordsRoomModel.LandlordsRoomInfo()
            {
                RoomID = resp.matchInfo.matcherid.ToString(),//比赛ID
                IsQdz  = resp.matchInfo.isQdz
            };
            switch (resp.matchInfo.type)
            {
            case 1:    // 比赛银币
                LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType = RoomType.SilverCoin;
                break;

            case 2:    //比赛金币
                LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType = RoomType.GoldBar;
                break;

            case 3:    //比赛积分
                LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType = RoomType.Match;
                break;
            }
            LandlordsModel.Instance.RoomModel.CurRoomInfo.IsMatch = true;
        }
        else//游戏币房
        {
            LandlordsModel.Instance.RoomModel.CurRoomInfo = new LandlordsRoomModel.LandlordsRoomInfo()
            {
                RoomID     = resp.roomId.ToString(),
                RoomType   = LandlordsRoomModel.GetYxbRoomTypeByID(resp.roomId),
                LeastStore = int.Parse(LandlordsRoomModel.GetYxbRoomConfigById(resp.roomId)["ante"].ToString())
            };
            LandlordsModel.Instance.RoomModel.CurRoomInfo.IsMatch = false;
        }
        bool isRoomCard = LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType == RoomType.RoomCard;

        //3个玩家信息
        if (LandlordsModel.Instance.RoomPlayerHands != null)
        {
            LandlordsModel.Instance.RoomPlayerHands.Clear();
        }
        for (int i = 0; i < resp.playerBaseInfo.Count; i++)
        {
            PlayerBaseInfo playerInfo = resp.playerBaseInfo[i]; Debug.LogWarning("有玩家进入:" + playerInfo.nickname);
            string         uid        = playerInfo.userId.ToString();

            LandkirdsHandCardModel hand = LandlordsModel.Instance.CreateHandCardMode(uid, playerInfo.gender == 0 ? Six.boy : Six.girl);
            hand.playerInfo.userNickname = playerInfo.nickname;
            hand.playerInfo.icon         = playerInfo.photo;
            if (LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType == RoomType.SilverCoin)
            {
                hand.playerInfo.money = playerInfo.silver;
            }
            else if (LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType == RoomType.GoldBar)
            {
                hand.playerInfo.money = playerInfo.gold;
            }
            hand.playerInfo.lv    = playerInfo.level;
            hand.playerInfo.vip   = playerInfo.vip;
            hand.playerInfo.win   = playerInfo.won;
            hand.playerInfo.lose  = playerInfo.lost;
            hand.playerInfo.ratio = (float)playerInfo.rate;
            hand.playerInfo.pos   = playerInfo.location;
            hand.playerInfo.exp   = playerInfo.exp;
            //hand.playerInfo.isFriend = playerInfo.isFriend;
            hand.MatchScore = playerInfo.currJiFen;
            if (i == 0 && isRoomCard)
            {
                hand.IsRoomer = true;
            }
            if (!hand.IsRoomer)
            {
                hand.IsZhunbei = playerInfo.isPrepared;
            }
        }
        if (resp.playerBaseInfo[resp.playerBaseInfo.Count - 1].userId == UserInfoModel.userInfo.userId)//如果当前进来的是自己
        {
            LandlordsPage page = LandlordsPage.Instance;
            if (page == null)
            {
                page = PageManager.Instance.OpenPage <LandlordsPage>();
            }
            if (!LandlordsModel.Instance.RoomModel.CurRoomInfo.IsMatch && resp.playerBaseInfo[0].userId == UserInfoModel.userInfo.userId && LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomType == RoomType.RoomCard)//如果自己是房主并且是房卡房
            {
                LandlordsModel.Instance.MyInfo.IsRoomer = true;
                NodeManager.OpenNode <InvateNode>().Inits(LandlordsModel.Instance.RoomModel.CurRoomInfo.RoomID);
            }
            page.InitRoom();
        }
        else
        {
            LandlordsModel.Instance.RoomPlayerSort();
            LandlordsPage.Instance.playView.InitPlayerPrefab();
        }
        if (LandlordsModel.Instance.RoomModel.CurRoomInfo.IsMatch)
        {
            BisaiInfoReq();
        }
    }