public void ShowPlayerFenShu(PlayerEnum indexVal, int fenShuVal)
    {
        int indexPlayer = (int)indexVal - 1;

        indexPlayer = (indexPlayer < 0 || indexPlayer > 3) ? 0 : indexPlayer;
        int fenShuValTmp = (fenShuVal * XKDaoJuGlobalDt.FenShuBeiLv[indexPlayer]);

        if (fenShuValTmp <= 0)
        {
            return;
        }

        XkGameCtrl.PlayerJiFenArray[indexPlayer] += fenShuValTmp;
        XKPlayerScoreCtrl.ChangePlayerScore(indexVal);

        XKPlayerFenShuMove fenShuMoveCom = GetXKPlayerFenShuMove();

        if (fenShuMoveCom == null)
        {
            return;
        }
        Transform playerTr = XKPlayerMoveCtrl.GetXKPlayerMoveCtrl(indexVal).PiaoFenPoint;
//		playerTr = TestPlayerTr; //test

        Vector3 startPos  = XkGameCtrl.GetInstance().GetWorldObjToScreenPos(playerTr.position);
        int     fenShuLen = fenShuVal.ToString().Length;

        startPos.x += 9f * (fenShuLen - 1);
        fenShuMoveCom.SetPlayerFenShuVal(fenShuVal, startPos, indexPlayer);
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        _Instance    = this;
        FenShuListP1 = new List <XKPlayerFenShuMove>();
        FenShuListP2 = new List <XKPlayerFenShuMove>();
        FenShuListP3 = new List <XKPlayerFenShuMove>();
        GameObject         obj           = null;
        XKPlayerFenShuMove fenShuMoveCom = null;

        for (int i = 0; i < MaxPlayerFS; i++)
        {
            obj = (GameObject)Instantiate(PlayerFenShuPre);
            obj.transform.parent        = transform;
            obj.transform.localScale    = new Vector3(1f, 1f, 1f);
            obj.transform.localPosition = Vector3.zero;
            fenShuMoveCom = obj.GetComponent <XKPlayerFenShuMove>();
            if (fenShuMoveCom != null)
            {
                fenShuMoveCom.Init(m_FenShuAtlasP1);
                fenShuMoveCom.SetActive(false);
            }
            FenShuListP1.Add(fenShuMoveCom);
        }

        for (int i = 0; i < MaxPlayerFS; i++)
        {
            obj = (GameObject)Instantiate(PlayerFenShuPre);
            obj.transform.parent        = transform;
            obj.transform.localScale    = new Vector3(1f, 1f, 1f);
            obj.transform.localPosition = Vector3.zero;
            fenShuMoveCom = obj.GetComponent <XKPlayerFenShuMove>();
            if (fenShuMoveCom != null)
            {
                fenShuMoveCom.Init(m_FenShuAtlasP2);
                fenShuMoveCom.SetActive(false);
            }
            FenShuListP2.Add(fenShuMoveCom);
        }

        for (int i = 0; i < MaxPlayerFS; i++)
        {
            obj = (GameObject)Instantiate(PlayerFenShuPre);
            obj.transform.parent        = transform;
            obj.transform.localScale    = new Vector3(1f, 1f, 1f);
            obj.transform.localPosition = Vector3.zero;
            fenShuMoveCom = obj.GetComponent <XKPlayerFenShuMove>();
            if (fenShuMoveCom != null)
            {
                fenShuMoveCom.Init(m_FenShuAtlasP3);
                fenShuMoveCom.SetActive(false);
            }
            FenShuListP3.Add(fenShuMoveCom);
        }
    }