Example #1
0
    public void addChild(string attach, Layer child)
    {
        Vector3       oldpos   = child.rootObject().transform.localPosition;
        Quaternion    oldrot   = child.rootObject().transform.localRotation;
        Vector3       oldscale = child.rootObject().transform.localScale;
        RectTransform rt       = child.rootObject().GetComponent <RectTransform>();
        Vector3       rtScale  = new Vector3();

        if (rt != null)
        {
            rtScale = rt.localScale;
        }

        GameObject at = UT.getChild(rootObject(), attach);

        child.rootObject().transform.SetParent(at.transform);
        mChild.Add(child);
        child.mParent = this;

        if (rt != null)
        {
            rt.localScale = rtScale;
        }

        child.rootObject().transform.localPosition = oldpos;
        child.rootObject().transform.localRotation = oldrot;
        child.rootObject().transform.localScale = oldscale;
    }
Example #2
0
    public bool mapChild <T>(string name) where T : Layer, new()
    {
        GameObject obj = UT.getChild(rootObject(), name);

        if (obj == null)
        {
            return(false);
        }
        Layer layer = new T();

        layer.setRoot(obj);
        mChild.Add(layer);
        return(true);
    }
Example #3
0
    protected override bool init()
    {
        content = UT.getChild(rootObject(), "ScrollView/Viewport/Content");
        item    = UT.getChild(rootObject(), "ScrollView/Viewport/Content/item");
        item.SetActive(false);
        allItems.Add(item);

        Button btn = UT.getComponent <Button>(rootObject(), "btnGetHero");

        btn.onClick.AddListener(() =>
        {
            modulePackHero.requestDraw(1);
        });
        btn = UT.getComponent <Button>(rootObject(), "btnGetHero10");
        btn.onClick.AddListener(() =>
        {
            modulePackHero.requestDraw(10);
        });
        updateShow();
        return(true);
    }