Ejemplo n.º 1
0
    static UIElement CreateItem(UIElement parent, string name)
    {
        var mod = new UIElement();

        mod.name      = name;
        mod.SizeDelta = new Vector2(100, 100);
        mod.SetParent(parent);//UICreator.CreateElement(Vector3.zero,new Vector2(100,100),name,parent);

        var img = new HImage();

        img.name      = "Image";
        img.SizeDelta = new Vector2(90, 90);
        img.SetParent(mod);//UICreator.CreateHImage(Vector3.zero,new Vector2(90,90),"Image",mod.transform);
        img.MainColor = new Color32(68, 68, 68, 255);
        img.eventType = HEventType.UserEvent;
        img.Sprite    = EditorModelManager.FindSprite(icons, background);
        img.SprType   = SpriteType.Sliced;

        var txt = new HText();

        txt.name      = "Text";
        txt.SizeDelta = new Vector2(80, 80);
        txt.SetParent(mod);//UICreator.CreateHText(Vector3.zero,new Vector2(80,80),"Text",mod.transform);
        txt.Text       = name;
        txt.FontSize   = 30;
        txt.TextAnchor = TextAnchor.MiddleLeft;
        return(mod);
    }
Ejemplo n.º 2
0
    static public UIElement AddInputBox(UIElement parent)
    {
        HImage img = new HImage();

        img.name = "InputBox";
        img.SetParent(parent);
        img.localPosition = Vector3.zero;
        img.localScale    = Vector3.one;
        img.localRotation = Quaternion.identity;
        img.compositeType = CompositeType.InputBox;
        img.Sprite        = EditorModelManager.FindSprite(icons, box);
        img.SprType       = SpriteType.Sliced;
        img.SizeDelta     = new Vector2(400, 100);

        HText txt = new HText();

        txt.SetParent(img);
        txt.localPosition = Vector3.zero;
        txt.localScale    = Vector3.one;
        txt.localRotation = Quaternion.identity;
        txt.SizeDelta     = new Vector2(380, 90);

        txt.marginType = MarginType.Margin;
        txt.margin     = new Margin(5, 5, 5, 5);
        txt.name       = "InputText";

        HImage cur = new HImage();

        cur.name      = "Cursor";
        cur.SizeDelta = new Vector2(2, 28);
        return(img);
    }
Ejemplo n.º 3
0
    static public UIElement AddText(UIElement parent)
    {
        HText img = new HText();

        img.name      = "Text";
        img.SizeDelta = new Vector2(160, 40);
        img.SetParent(parent);
        return(img);
    }
Ejemplo n.º 4
0
    static public UIElement AddTreeView(UIElement parent)
    {
        var ss = new HImage();//new GameObject("TreeView");

        ss.name          = "TreeView";
        ss.SizeDelta     = new Vector2(400, 400);
        ss.Mask          = true;
        ss.compositeType = CompositeType.TreeView;
        ss.SetParent(parent);

        var Item = new UIElement();//new GameObject("Item");

        Item.SetParent(ss);
        Item.SizeDelta = new Vector2(200, 40);

        var txt = new HText();//new GameObject("Text");

        txt.SetParent(Item);
        txt.SizeDelta  = new Vector2(200, 40);
        txt.TextAnchor = TextAnchor.MiddleLeft;
        txt.FontSize   = 24;
        return(ss);
    }
Ejemplo n.º 5
0
    static public UIElement AddDate(UIElement parent)
    {
        var date = new UIElement();//new GameObject("Date");

        date.SizeDelta     = new Vector2(400, 200);
        date.eventType     = HEventType.UserEvent;
        date.compositeType = CompositeType.UIDate;
        date.SetParent(parent);

        var label = new HText();//new GameObject("YearLabel", typeof(HText));

        label.name = "YearLabel";
        //var ht = label.GetComponent<HText>();
        label.SizeDelta  = new Vector2(80, 40);
        label.FontSize   = 24;
        label.TextAnchor = TextAnchor.MiddleCenter;
        label.Text       = "Year";
        label.SetParent(date);
        label.localPosition = new Vector3(-80, 0, 0);

        label            = new HText();//new GameObject("MonthLabel", typeof(HText));
        label.name       = "MonthLabel";
        label.SizeDelta  = new Vector2(80, 40);
        label.FontSize   = 24;
        label.TextAnchor = TextAnchor.MiddleCenter;
        label.Text       = "Month";
        label.SetParent(date);
        label.localPosition = new Vector3(40, 0, 0);

        label            = new HText();//new GameObject("DayLabel", typeof(HText));
        label.name       = "DayLabel";
        label.SizeDelta  = new Vector2(80, 40);
        label.FontSize   = 24;
        label.TextAnchor = TextAnchor.MiddleCenter;
        label.Text       = "Year";
        label.SetParent(date);
        label.localPosition = new Vector3(160, 0, 0);

        var now  = DateTime.Now;
        var Year = new UIElement(); //new GameObject("Year", typeof(UIElement));

        Year.name          = "Year";
        Year.SizeDelta     = new Vector2(80, 400);
        Year.eventType     = HEventType.UserEvent;
        Year.compositeType = CompositeType.ScrollY;
        Year.SetParent(date);
        Year.localPosition = new Vector3(-147, 0, 0);

        var Item = new HText();//new GameObject("Item");

        Item.name = "Item";
        Item.SetParent(Year);
        Item.SizeDelta  = new Vector2(60, 40);
        Item.TextAnchor = TextAnchor.MiddleCenter;
        Item.Text       = now.Year.ToString();
        Item.FontSize   = 24;

        var Month = new UIElement();//new GameObject("Month",typeof(UIElement));

        Month.name          = "Month";
        Month.SizeDelta     = new Vector2(80, 400);
        Month.eventType     = HEventType.UserEvent;
        Month.compositeType = CompositeType.ScrollY;
        Month.SetParent(date);
        Month.localPosition = new Vector3(-22, 0, 0);
        Month.localScale    = Vector3.one;
        Month.localRotation = Quaternion.identity;

        Item      = new HText();//new GameObject("Item");
        Item.name = "Item";
        Item.SetParent(Month);
        Item.SizeDelta  = new Vector2(60, 40);
        Item.TextAnchor = TextAnchor.MiddleCenter;
        Item.Text       = now.Month.ToString();
        Item.FontSize   = 24;

        var Day = new UIElement();//new GameObject("Day", typeof(UIElement));

        Day.name          = "Day";
        Day.SizeDelta     = new Vector2(80, 400);
        Day.eventType     = HEventType.UserEvent;
        Day.compositeType = CompositeType.ScrollY;
        Day.SetParent(date);
        Day.localPosition = new Vector3(107, 0, 0);

        Item      = new HText();//new GameObject("Item");
        Item.name = "Item";
        Item.SetParent(Day);
        Item.SizeDelta  = new Vector2(60, 40);
        Item.TextAnchor = TextAnchor.MiddleCenter;
        Item.Text       = now.Day.ToString();
        Item.FontSize   = 24;
        return(date);
    }