Beispiel #1
0
    public void showWait()
    {
        RoomMgr   rm    = RoomMgr.GetInstance();
        NetMgr    nm    = NetMgr.GetInstance();
        GameMaima maima = rm.state.maima;

        bool      act  = maima.seatindex == rm.seatindex;
        Transform mas  = tmaima.Find("mas");
        UIGrid    grid = mas.GetComponent <UIGrid>();

        tmaima.gameObject.SetActive(true);

        title.text = act ? "请选择飞苍蝇" : "请等待飞苍蝇";
        score.text = "";

        int count = maima.mas.Count;
        int i     = 0;

        for (i = 0; i < mas.childCount && i < count; i++)
        {
            Transform board = mas.GetChild(i);
            Transform tile  = board.Find("tile");
            FrameAnim anim  = board.GetComponent <FrameAnim>();

            board.gameObject.SetActive(true);

            tile.gameObject.SetActive(false);
            anim.reset();

            GameObject _fire = board.Find("fire").gameObject;
            _fire.SetActive(false);

            int j = i;

            PUtils.onClick(board, () => {
                if (!act)
                {
                    return;
                }

                nm.send("maima", "index", j);
            });
        }

        for (int j = i; j < mas.childCount; j++)
        {
            Transform board = mas.GetChild(j);
            board.gameObject.SetActive(false);
        }

        grid.Reposition();
    }
Beispiel #2
0
    public void showResult(Action cb)
    {
        RoomMgr   rm    = RoomMgr.GetInstance();
        NetMgr    nm    = NetMgr.GetInstance();
        GameMaima maima = rm.state.maima;

        bool      act  = false;
        Transform mas  = tmaima.Find("mas");
        UIGrid    grid = mas.GetComponent <UIGrid>();

        tmaima.gameObject.SetActive(true);

        title.text = "请等待飞苍蝇";
        score.text = "";

        int id    = maima.selected;
        int i     = 0;
        int count = maima.mas.Count;

        for (i = 0; i < mas.childCount && i < count; i++)
        {
            Transform board = mas.GetChild(i);
            Transform tile  = board.Find("tile");
            FrameAnim anim  = board.GetComponent <FrameAnim>();

            board.gameObject.SetActive(true);
            tile.gameObject.SetActive(false);
            anim.reset();

            PUtils.onClick(board, () => {});

            if (i == id)
            {
                continue;
            }

            int        _mjid = maima.mas[i];
            GameObject _fire = board.Find("fire").gameObject;
            _fire.SetActive(false);

            anim.run(() => {
                tile.gameObject.SetActive(true);
                UISprite t   = tile.GetComponent <UISprite>();
                t.spriteName = "" + _mjid;

                UISpriteData sp = t.GetAtlasSprite();
                t.width         = sp.width;
                t.height        = sp.height;
            });
        }

        for (int j = i; j < mas.childCount; j++)
        {
            Transform board = mas.GetChild(j);
            board.gameObject.SetActive(false);
        }

        grid.Reposition();

        int mjid = maima.mas[id];
        int add  = maima.scores[id];

        Transform  _board = mas.GetChild(id);
        FrameAnim  frame  = _board.GetComponent <FrameAnim>();
        Transform  _tile  = _board.Find("tile");
        GameObject fire   = _board.Find("fire").gameObject;

        fire.SetActive(true);

        frame.run(() => {
            _tile.gameObject.SetActive(true);
            UISprite t = _tile.GetComponent <UISprite>();

            t.spriteName    = "" + mjid;
            UISpriteData sp = t.GetAtlasSprite();
            t.width         = sp.width;
            t.height        = sp.height;

            _tile.localScale = new Vector3(1.8f, 1.8f, 1.0f);

            score.text = add > 0 ? "+" + add : "" + add;

            end(cb);
        });
    }