Example #1
0
    void chooseItem()
    {
        int idx = _new_item_list.selectedIndex;

        //Debug.Log (idx);
        if (items [idx].StartsWith("c"))
        {
            PlayerData.getInstance().gainComponent(items [idx]);
        }
        else if (items [idx].StartsWith("t"))
        {
            PlayerData.getInstance().gainTowerBase(items [idx]);
        }

        Vector3 posLocal = _new_item_list.GetChildAt(idx).position;

        GameManager.getInstance().initGetItemEffect(_new_item_list.LocalToGlobal(posLocal), items[idx]);
        GameManager.getInstance().finishItemGet();
        this.Hide();

        if (PlayerData.getInstance().guideStage == 11)
        {
            GuideManager.getInstance().showGuideDetail();
            PlayerData.getInstance().guideStage = 12;
        }
    }
Example #2
0
    public Rect getFirstBranch()
    {
        GObject firstItem = _branches.GetChildAt(0);
        Rect    rect      = firstItem.TransformRect(new Rect(0, 0, firstItem.width, firstItem.height), GRoot.inst);

        _branches.EnsureBoundsCorrect();

        Vector2 center   = _branches.LocalToGlobal(new Vector3(firstItem.position.x + firstItem.width / 2, firstItem.position.y + firstItem.height / 2, 0));
        Rect    trueRect = new Rect(center.x - rect.size.x / 2 - 4, center.y - rect.size.y / 2, rect.size.x + 4, rect.size.y + 4);

        //GuideManager.getInstance ()._guideLayer.setMark (GuideManager.getInstance ()._guideLayer.GlobalToLocal(center));
        return(trueRect);
    }