Example #1
0
    /// <summary>
    /// 发手牌
    /// </summary>
    public void HandDeal()
    {
        Vector3[] pos = new Vector3[4];
        pos[0] = new Vector3(-3.45f, 0.5f, -3.4f);
        pos[1] = new Vector3(3.5f, 0.1f, -1.8f);
        pos[2] = new Vector3(1.8f, 0.1f, 3.5f);
        pos[3] = new Vector3(-3.5f, 0.1f, 1.8f);

        Vector3[] rot = new Vector3[4];
        rot[0] = new Vector3(-10, 0, -90);
        rot[1] = new Vector3(-90, 180, 0);
        rot[2] = new Vector3(-90, 90, 0);
        rot[3] = new Vector3(-90, 0, 0);

        Vector3[] C = new Vector3[4];
        C[0] = new Vector3(0.45f, 0, 0);
        C[1] = new Vector3(0, 0, 0.3f);
        C[2] = new Vector3(-0.3f, 0, 0);
        C[3] = new Vector3(0, 0, -0.3f);

        Vector3 sca = Vector3.one;

        players[0].Sort();
        players[1].webInit();
        players[2].webInit();
        players[3].webInit();

        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < 13; j++)
            {
                pos[i] += C[i];
                if (i == 0)
                {
                    sca = Vector3.one * 1.5f;
                }
                else
                {
                    sca = Vector3.one;
                }

                Brand mBrand = players[i].Get(j);
                mBrand.Init(pos[i], Quaternion.Euler(rot[i]), sca);
                if (i == 0)
                {
                    mBrand.AddBox();
                }
            }
        }

        int Begin = GameSetting.Instance.StartNum * 2 - 1;

        for (int i = Begin; i < Begin + 52; i++)
        {
            Destroy(GameObject.Find(i.ToString()).gameObject);
        }

        PSpos = Begin + 52;

        if (GameSetting.Instance.Playerid == GameSetting.Instance.target)
        {
            FlowOfGame.Instance.Deal = true;
        }
    }
Example #2
0
    /// <summary>
    /// 发牌
    /// </summary>
    public void Deal(int playerId)
    {
        int id = ChangePlayerId(playerId);

        Vector3[] pos = new Vector3[4];
        pos[0] = new Vector3(-3.45f, 0.5f, -3.4f);
        pos[1] = new Vector3(3.5f, 0.1f, -1.8f);
        pos[2] = new Vector3(1.8f, 0.1f, 3.5f);
        pos[3] = new Vector3(-3.5f, 0.1f, 1.8f);

        Vector3[] rot = new Vector3[4];
        rot[0] = new Vector3(-10, 0, -90);
        rot[1] = new Vector3(-90, 180, 0);
        rot[2] = new Vector3(-90, 90, 0);
        rot[3] = new Vector3(-90, 0, 0);

        Vector3[] C = new Vector3[4];
        C[0] = new Vector3(0.55f, 0, 0);
        C[1] = new Vector3(0, 0, 0.4f);
        C[2] = new Vector3(-0.4f, 0, 0);
        C[3] = new Vector3(0, 0, -0.4f);

        Vector3[] C1 = new Vector3[4];
        C1[0] = new Vector3(0.45f, 0, 0);
        C1[1] = new Vector3(0, 0, 0.3f);
        C1[2] = new Vector3(-0.3f, 0, 0);
        C1[3] = new Vector3(0, 0, -0.3f);

        Vector3 sca = Vector3.one;

        if (id == 0)
        {
            sca *= 1.5f;
        }

        pos[id] += C1[id] * (players[id].getSize() - 1) + C[id];

        Brand mBrand = players[id].GetEnd();

        mBrand.Init(pos[id], Quaternion.Euler(rot[id]), sca);
        if (id == 0)
        {
            mBrand.AddBox();
        }

        Destroy(GameObject.Find(PSpos.ToString()).gameObject);
        PSpos++;

        SceneGame.Instance.ChangePS();

        if (playerId == GameSetting.Instance.Playerid)
        {
            if (players[0].isTing())
            {
                SceneGame.Instance.showButton("Ting");
            }
            if (players[0].isHu(mBrand.id))
            {
                SceneGame.Instance.showButton("Hu");
            }
        }
    }
Example #3
0
    /// <summary>
    /// 发手牌
    /// </summary>
    public void HandDeal()
    {
        Vector3[] pos = new Vector3[4];
        pos[0] = new Vector3(-3.45f, 0.5f, -3.4f);
        pos[1] = new Vector3(3.5f, 0.1f, -1.8f);
        pos[2] = new Vector3(1.8f, 0.1f, 3.5f);
        pos[3] = new Vector3(-3.5f, 0.1f, 1.8f);

        Vector3[] rot = new Vector3[4];
        rot[0] = new Vector3(-10, 0, -90);
        rot[1] = new Vector3(-90, 180, 0);
        rot[2] = new Vector3(-90, 90, 0);
        rot[3] = new Vector3(-90, 0, 0);

        Vector3[] C = new Vector3[4];
        C[0] = new Vector3(0.45f, 0, 0);
        C[1] = new Vector3(0, 0, 0.3f);
        C[2] = new Vector3(-0.3f, 0, 0);
        C[3] = new Vector3(0, 0, -0.3f);

        Vector3 sca = Vector3.one;

        players[0].Sort();
        players[1].Sort();
        players[2].Sort();
        players[3].Sort();

        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < 13; j++)
            {
                pos[i] += C[i];
                if (i == 0)
                {
                    sca = Vector3.one * 1.5f;
                }
                else
                {
                    sca = Vector3.one;
                }

                Brand mBrand = players[i].Get(j);
                mBrand.Init(pos[i], Quaternion.Euler(rot[i]), sca);
                if (i == 0)
                {
                    mBrand.AddBox();
                }
            }
        }

        int[] StartNum = new int[4] {
            68, 92, 0, 34
        };

        Debug.Log(nowplayer);

        int Begin = StartNum[nowplayer] + Random.Range(2, 13) * 2;

        int f = 0;

        while (f <= 52)
        {
            PSpos = Begin + f;
            if (PSpos > 135)
            {
                PSpos -= 136;
            }
            Destroy(GameObject.Find(PSpos.ToString()).gameObject);
            f++;
        }

        Deal(nowplayer);
    }