示例#1
0
    /// <summary>
    /// 添加牌
    /// </summary>
    /// <param name="cType">给谁</param>
    /// <param name="card">发什么牌</param>
    /// <param name="isSelected">是否选中</param>
    /// <param name="pos">桌子位置</param>
    public void AddCard(CharacterType cType, Card card, bool isSelected, ShowPoint pos)
    {
        switch (cType)
        {
        case CharacterType.Player:
            PlayerController.AddCard(card, isSelected);
            PlayerController.Sort(false);
            break;

        case CharacterType.ComputerRight:
            ComputerRightController.AddCard(card, isSelected);
            break;

        case CharacterType.ComputerLeft:
            ComputerLeftController.AddCard(card, isSelected);
            break;

        case CharacterType.Desk:
            DeskController.AddCard(card, isSelected);
            break;

        default:
            break;
        }
    }
    /// <summary>
    /// 给玩家轮流发牌以及出牌的显示
    /// </summary>
    /// <param name="card">发的牌</param>
    /// <param name="type">发给谁</param>
    /// <param name="isSelected">是否被选中</param>
    public void AddCards(Card card, CharacterType type, bool isSelected, ShowPoint pos)
    {
        switch (type)
        {
        case CharacterType.Player:
            m_player.AddCard(card, isSelected);
            m_player.CardsSort(false);    //降序排列
            break;

        case CharacterType.ComputerRight:
            m_ComputerRight.AddCard(card, isSelected);
            break;

        case CharacterType.ComputerLeft:
            m_ComputerLeft.AddCard(card, isSelected);
            break;

        case CharacterType.Desk:
            //地主牌以及其他玩家出牌,根据牌的归属的判断设置牌的位置
            m_Desk.AddCard(card, isSelected, pos);
            break;

        default:
            break;
        }
    }
    /// <summary>
    /// 生成手牌
    /// </summary>
    /// <param name="card"></param>
    /// <param name="index"></param>
    /// <param name="isSelected"></param>
    /// <param name="type"></param>
    public void CreateCardUI(Card card, int index, bool isSelected, ShowPoint type)
    {
        //
        GameObject temp = LeanPool.Spawn(m_Prefab);

        temp.transform.localScale = new Vector3(1, 1, 1);

        CardUI cardUI = temp.GetComponent <CardUI>();

        cardUI.Card       = card;
        cardUI.IsSelected = isSelected;

        if (type == ShowPoint.Player)
        {
            cardUI.SetCardPosition(PlayPoint, index);
        }
        else if (type == ShowPoint.ComputerRight)
        {
            cardUI.SetCardPosition(ComputerRightPoint, index);
        }
        else if (type == ShowPoint.ComputerLeft)
        {
            cardUI.SetCardPosition(ComputerLeftPoint, index);
        }
        else if (type == ShowPoint.Desk)
        {
            cardUI.SetCardPosition(CreatePoint, index);
        }
    }
    /// <summary>
    /// 添加卡牌
    /// </summary>
    /// <param name="card"></param>
    /// <param name="isSelected"></param>
    /// <param name="type"></param>
    public void AddCard(Card card, bool isSelected, ShowPoint type)
    {
        switch (type)
        {
        case ShowPoint.Desk:
            Cards.Add(card);
            card.BelongTo = m_characterType;
            CreateCardUI(card, Cards.Count - 1, isSelected, type);
            break;

        case ShowPoint.Player:
            m_PlayerList.Add(card);
            card.BelongTo = m_characterType;
            CreateCardUI(card, m_PlayerList.Count - 1, isSelected, type);
            break;

        case ShowPoint.ComputerRight:
            m_RComputerList.Add(card);
            card.BelongTo = m_characterType;
            CreateCardUI(card, m_RComputerList.Count - 1, isSelected, type);
            break;

        case ShowPoint.ComputerLeft:
            m_LComputerList.Add(card);
            card.BelongTo = m_characterType;
            CreateCardUI(card, m_LComputerList.Count - 1, isSelected, type);
            break;

        default:
            break;
        }
    }
示例#5
0
    private void CreateCardUI(Card card, int index, bool selected, ShowPoint pos)
    {
        //对象池生成
        GameObject g = LeanPool.Spawn(prefab);

        g.name = characterType.ToString() + index.ToString();
        //设置位置和是否选中
        CardUI cardUI = g.GetComponent <CardUI>();

        cardUI.Card       = card;
        cardUI.IsSelected = selected;
        switch (pos)
        {
        case ShowPoint.Desk:
            cardUI.SetPosition(CreatePoint, index);
            break;

        case ShowPoint.Player:
            cardUI.SetPosition(PlayerPoint, index);
            break;

        case ShowPoint.ComputerRight:
            cardUI.SetPosition(ComputerRightPoint, index);
            break;

        case ShowPoint.ComputerLeft:
            cardUI.SetPosition(ComputerLeftPoint, index);
            break;

        default:
            break;
        }
    }
    /// <summary>
    /// 清空卡牌
    /// </summary>
    /// <param name="type"></param>
    public void ClearList(ShowPoint type)
    {
        switch (type)
        {
        case ShowPoint.Desk:
            Cards.Clear();
            CardUI[] cardUI = CreatePoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < cardUI.Length; i++)
            {
                cardUI[i].Destory();
            }
            break;

        case ShowPoint.Player:
            m_PlayerList.Clear();
            CardUI[] PcardUI = PlayPoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < PcardUI.Length; i++)
            {
                PcardUI[i].Destory();
            }
            break;

        case ShowPoint.ComputerRight:
            m_RComputerList.Clear();
            CardUI[] RcardUI = ComputerRightPoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < RcardUI.Length; i++)
            {
                RcardUI[i].Destory();
            }
            break;

        case ShowPoint.ComputerLeft:
            m_LComputerList.Clear();
            CardUI[] LcardUI = ComputerLeftPoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < LcardUI.Length; i++)
            {
                LcardUI[i].Destory();
            }
            break;

        default:
            break;
        }
    }
示例#7
0
    /// <summary>
    /// 桌面清空
    /// </summary>
    /// <param name="pos"></param>
    public void Clear(ShowPoint pos)
    {
        switch (pos)
        {
        case ShowPoint.Desk:
            Cards.Clear();
            CardUI[] cardUIs = CreatePoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < cardUIs.Length; i++)
            {
                cardUIs[i].Destroy();
            }
            break;

        case ShowPoint.Player:
            PlayerCardList.Clear();
            CardUI[] cardUIPlayer = PlayerPoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < cardUIPlayer.Length; i++)
            {
                cardUIPlayer[i].Destroy();
            }
            break;

        case ShowPoint.ComputerRight:
            ComputerRightCardList.Clear();
            CardUI[] cardUIRight = ComputerRightPoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < cardUIRight.Length; i++)
            {
                cardUIRight[i].Destroy();
            }
            break;

        case ShowPoint.ComputerLeft:
            ComputerLeftCardList.Clear();
            CardUI[] cardUILeft = ComputerLeftPoint.GetComponentsInChildren <CardUI>();
            for (int i = 0; i < cardUILeft.Length; i++)
            {
                cardUILeft[i].Destroy();
            }
            break;

        default:
            break;
        }
    }
示例#8
0
    // Use this for initialization
    void Start()
    {
        pieces = new List <GameObject>();

        gp        = GetComponent <GeneratePieces>();
        showPoint = GetComponent <ShowPoint>();
        smash     = GetComponent <Smash>();

        randomPoint = new RandomPoint();
        voronoi     = new VoronoiCell();

        resetButton.onClick.AddListener(ResetGame);

        prompt.active = true;

        _broken = true;

        ResetGlass();
    }
示例#9
0
        private void DebugTool_Load(object sender, EventArgs e)
        {
            Control.CheckForIllegalCrossThreadCalls = false;

            SerialPortSetInit();
            ChartSetInit();
            this.Size = new System.Drawing.Size(640, 480);
            Size_x    = this.Size.Width;
            Size_y    = this.Size.Height;
            skinTabControl1.Location = new Point(skinMenuStrip1.Location.X, skinMenuStrip1.Size.Height + skinMenuStrip1.Location.Y);
            skinTabControl1.Size     = new Size(this.Size.Width - skinMenuStrip1.Location.X * 2, this.Size.Height - skinTabControl1.Location.Y - skinMenuStrip1.Location.Y);

            ShowPoint  = Chart1.Series.First().Points;
            ShowPoint2 = Chart1.Series[1].Points;
            ShowPoint.Add(new DataPoint(1, 1));
            ShowPoint.Add(new DataPoint(2, 5));
            ShowPoint.Add(new DataPoint(3, -2));
            ShowPoint.Add(new DataPoint(4, 0));
            ShowPoint.Add(new DataPoint(5, 4.5));
        }
示例#10
0
    public virtual void AddCard(Card card, bool selected, ShowPoint pos)
    {
        switch (pos)
        {
        case ShowPoint.Desk:
            Cards.Add(card);
            //***//
            card.BelongTo = characterType;
            CreateCardUI(card, Cards.Count - 1, selected, pos);
            break;

        case ShowPoint.Player:
            PlayerCardList.Add(card);
            //***//
            card.BelongTo = characterType;
            CreateCardUI(card, PlayerCardList.Count - 1, selected, pos);
            break;

        case ShowPoint.ComputerRight:
            ComputerRightCardList.Add(card);
            //***//
            card.BelongTo = characterType;
            CreateCardUI(card, ComputerRightCardList.Count - 1, selected, pos);
            break;

        case ShowPoint.ComputerLeft:
            ComputerLeftCardList.Add(card);
            //***//
            card.BelongTo = characterType;
            CreateCardUI(card, ComputerLeftCardList.Count - 1, selected, pos);
            break;

        default:
            break;
        }
    }
示例#11
0
 /// <summary>
 /// 显示地主牌
 /// </summary>
 /// <param name="card">显示卡牌信息</param>
 /// <param name="index">索引</param>
 public void SetShowCard(Card card, int index)
 {
     Image[] showcards = ShowPoint.GetComponentsInChildren <Image>();
     showcards[index].sprite = Resources.Load <Sprite>("Pokers/" + card.CardName);
     SetAlpha(1);
 }
示例#12
0
        public virtual void Draw(BMapControl c, Graphics g)
        {
            if (!string.IsNullOrEmpty(Info))
            {
                var size = g.MeasureString(Info, Font);
                int w    = (int)size.Width + InfoPadding.Width * 2;
                int h    = (int)size.Height + InfoPadding.Height * 2;
                var pen  = new Pen(Foreground, 1);
                var p    = ShowPoint;

                var pRT = ShowPoint.GetOffSet(w + 20, -(h + 20));

                if (c.ClientRectangle.Right < pRT.X)
                {
                    //屏幕右边越界


                    if (c.ClientRectangle.Top > pRT.Y)
                    {
                        //屏幕上面越界
                        g.DrawLine(pen, p, p = p.GetOffSet(-20, 20));
                        g.DrawLine(pen, p, p = p.GetOffSet(-w, 0));
                        RefreshRegion        = new Region(new Rectangle(ShowPoint.X - 20 - w, ShowPoint.Y, w + 20, h + 20));
                    }
                    else
                    {
                        g.DrawLine(pen, p, p = p.GetOffSet(-20, -20));
                        g.DrawLine(pen, p, p = p.GetOffSet(-w, 0));
                        p.Offset(0, -h);
                        RefreshRegion = new Region(new Rectangle(ShowPoint.X - 20 - w, ShowPoint.Y - 20 - h, w + 20, h + 20));
                    }
                }
                else
                {
                    if (c.ClientRectangle.Top > pRT.Y)
                    {
                        //屏幕上面越界
                        g.DrawLine(pen, p, p = p.GetOffSet(20, 20));
                        g.DrawLine(pen, p, p.GetOffSet(w, 0));
                        //p.Offset(0, 0);
                        RefreshRegion = new Region(new Rectangle(ShowPoint.X, ShowPoint.Y, w + 20, h + 20));
                    }
                    else
                    {
                        g.DrawLine(pen, p, p = p.GetOffSet(20, -20));
                        g.DrawLine(pen, p, p.GetOffSet(w, 0));
                        p.Offset(0, -h);
                        RefreshRegion = new Region(new Rectangle(ShowPoint.X, ShowPoint.Y - 20 - h, w + 20, h + 20));
                    }
                }

                //g.DrawLine(pen, p, p = p.GetOffSet(20, -20));
                //g.DrawLine(pen, p, p.GetOffSet(w, 0));
                //p.Offset(0, -h);


                var rect = new Rectangle(p, new Size(w, h));
                g.FillRectangle(Background, rect);
                p.Offset(InfoPadding.Width, InfoPadding.Height);
                g.DrawString(Info, Font, Foreground, p);
            }
        }