Esempio n. 1
0
    // 轮到下一个玩家
    // position-轮到玩家的座位号
    // 最小下注金额
    public void TurnNext(int position, int bet)
    {
        if (position <= 0)
        {
            return;
        }
        // 更新table的信息
        tableInfo.Bet = bet;
        tableInfo.Players[position - 1].Action = PlayerInfoUtil.ACTION_BETTING;

        roomLight.SetActive(true);
        int target = GetPlayerPos(position - 1);

        roomLight.GetComponent <LightControler>().Rotate(target);
        if (selfInfo.Pos > 0 && selfInfo.Pos == position)
        {
            // 修改展示的操作按钮类型
            mButtonControler.SetCurrentType(ButtonControler.BET_HANDLE);
            mButtonControler.SetBaseBet(bet - selfInfo.Bet > 0 ? bet - selfInfo.Bet : 0);
        }
        else
        {
            // 更新底部Button UI
            if (PlayerInfoUtil.IsPlaying(selfInfo))
            {
                // 修改展示的操作按钮类型
                mButtonControler.SetCurrentType(ButtonControler.AUTO_HANDLE);
            }
            else
            {
                // 修改展示的操作按钮类型
                mButtonControler.SetCurrentType(ButtonControler.NONE_HANDLE);
            }
        }
        // 设置计时
        for (int i = 0; i < playerObjs.Count; i++)
        {
            PlayerControler p = playerObjs[i].GetComponent <PlayerControler>();
            if (i == target)
            {
                p.trunYou = true;
            }
            else
            {
                p.trunYou = false;
            }
        }
    }
Esempio n. 2
0
 private void InitMenu()
 {
     if (menuList != null)
     {
         if (mGameControler.tableInfo == null)
         {
             return;
         }
         // 更新换桌按钮是否可点击(正在游戏中不能点击)
         bool enabled = mGameControler.tableInfo.N < 2 || !PlayerInfoUtil.IsPlaying(mGameControler.selfInfo);
         btChangeTable.interactable = enabled;
     }
     else
     {
         menu         = GameObject.Find("Menu");
         menuList     = GameObject.Find("MenuList");
         cardBoardObj = GameObject.Find("cardBoard");
         menuPos      = menuList.transform.localPosition;
         boardPos     = cardBoardObj.transform.localPosition;
         // 菜单按钮的点击实现
         GameObject.Find("switch").GetComponent <Button>().onClick.AddListener(() =>
         {
             // 播放声音
             AudioUtil.Play(AudioUtil.Click);
             PopMenu(true);
         });
         // 返回按钮的点击实现
         GameObject.Find("back").GetComponent <Button>().onClick.AddListener(() =>
         {
             if (mGameHandle != null)
             {
                 // 播放声音
                 AudioUtil.Play(AudioUtil.Click);
                 mGameHandle.RoomPlayerGoneReq();
                 Application.LoadLevel("main");
             }
         });
         // 换桌点击实现
         btChangeTable = GameObject.Find("changeTable").GetComponent <Button>();
         btChangeTable.onClick.AddListener(() =>
         {
             if (!PlayerInfoUtil.IsPlaying(mGameControler.selfInfo))
             {
                 // 播放声音
                 AudioUtil.Play(AudioUtil.Click);
                 PopMenu(false);
                 // 隐藏换桌加载组件
                 mGameControler.SetChangeTableLoadingActive(true);
                 mGameHandle.RoomPlayerChangeTableReq();
             }
         });
         // 站起点击实现
         btStandUp = GameObject.Find("standUp").GetComponent <Button>();
         btStandUp.onClick.AddListener(() =>
         {
             if (mGameHandle != null && mGameControler.selfInfo.Pos > 0)
             {
                 // 播放声音
                 AudioUtil.Play(AudioUtil.Click);
                 mGameHandle.RoomPlayerStandupReq();
                 PopMenu(false);
             }
         });
         GameObject.Find("cardType").GetComponent <Button>().onClick.AddListener(() =>
         {
             // 播放声音
             AudioUtil.Play(AudioUtil.Click);
             PopMenu(false);
             PopCardBoard(true);
         });
         menuList.SetActive(false);
     }
 }