Exemple #1
0
    static UIElement CreateDockPanel(UIElement parent)
    {
        var dock = UICreator.CreateHImage(Vector3.zero, new Vector2(800, 800), "DockPanel", parent);

        dock.MainColor     = new Color32(56, 56, 56, 255);
        dock.compositeType = CompositeType.DockPanel;
        dock.Sprite        = EditorModelManager.FindSprite(icons, background);
        dock.SprType       = SpriteType.Sliced;


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

        AreaLevel.name = "AreaLevel";
        AreaLevel.SetParent(dock);

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

        LineLevel.name = "LineLevel";
        LineLevel.SetParent(dock);

        var Line = UICreator.CreateHImage(Vector3.zero, new Vector2(800, 8), "Line", dock);

        Line.MainColor = Color.black;
        UICreator.CreateHImage(new Vector3(0, -60, 0), new Vector2(100, 100), "Area", dock);

        return(dock);
    }
Exemple #2
0
    static UIElement CreateDockPanel(Transform parent)
    {
        var dock = UICreator.CreateHImage(Vector3.zero, new Vector2(800, 800), "DockPanel", parent);

        dock.MainColor     = new Color32(56, 56, 56, 255);
        dock.compositeType = CompositeType.DockPanel;
        dock.Sprite        = EditorModelManager.FindSprite(icons, background);
        dock.SprType       = SpriteType.Sliced;


        var AreaLevel = new GameObject("AreaLevel");
        var trans     = AreaLevel.transform;

        trans.SetParent(dock.transform);
        trans.localPosition = Vector3.zero;
        trans.localScale    = Vector3.one;
        trans.localRotation = Quaternion.identity;

        var LineLevel = new GameObject("LineLevel");

        trans = LineLevel.transform;
        trans.SetParent(dock.transform);
        trans.localPosition = Vector3.zero;
        trans.localScale    = Vector3.one;
        trans.localRotation = Quaternion.identity;

        var Line = UICreator.CreateHImage(Vector3.zero, new Vector2(800, 8), "Line", dock.transform);

        Line.MainColor = Color.black;
        UICreator.CreateHImage(new Vector3(0, -60, 0), new Vector2(100, 100), "Area", dock.transform);

        return(dock);
    }
Exemple #3
0
    static public UIElement AddScrollX(UIElement parent)
    {
        UIElement p      = UICreator.CreateElement(Vector3.zero, new Vector2(400, 420), "Scroll", parent);
        var       scroll = UICreator.CreateHImage(Vector3.zero, new Vector2(400, 400), "ScrollX", p);

        scroll.marginType    = MarginType.Margin;
        scroll.margin.down   = 20;
        scroll.Mask          = true;
        scroll.MainColor     = new Color32(224, 224, 224, 255);
        scroll.eventType     = HEventType.UserEvent;
        scroll.compositeType = CompositeType.ScrollX;
        scroll.Sprite        = EditorModelManager.FindSprite(icons, background);
        scroll.SprType       = SpriteType.Sliced;

        CreateItem(scroll, "Item");

        var go = CreateSliderH();

        go.SetParent(p);
        go.localPosition   = new Vector3(200, 0, 0);
        go.anchorType      = AnchorType.Alignment;
        go.anchorPointType = AnchorPointType.Down;
        go.marginType      = MarginType.MarginX;
        //var help = scroll.gameObject.AddComponent<ScrollHelper>();
        //help.Slider = go.transform;
        return(p);
    }
Exemple #4
0
    static public UIElement AddScrollY(UIElement parent)
    {
        UIElement p      = UICreator.CreateElement(new Vector3(-10, 200, 0), new Vector2(420, 400), "Scroll", parent);
        var       scroll = UICreator.CreateHImage(Vector3.zero, new Vector2(400, 400), "ScrollY", p);

        scroll.marginType    = MarginType.Margin;
        scroll.margin.right  = 20;
        scroll.Mask          = true;
        scroll.MainColor     = new Color32(224, 224, 224, 255);
        scroll.eventType     = HEventType.UserEvent;
        scroll.compositeType = CompositeType.ScrollY;
        scroll.Sprite        = EditorModelManager.FindSprite(icons, background);
        scroll.SprType       = SpriteType.Sliced;
        scroll.Pivot         = new Vector2(0.5f, 1);

        var item = CreateItem(scroll, "Item");

        item.Pivot = new Vector2(0.5f, 1);
        item.Find("Image").localPosition = new Vector3(0, -50, 0);
        item.Find("Text").localPosition  = new Vector3(0, -50, 0);

        var go = CreateSliderV();

        go.SetParent(p);
        go.localPosition = new Vector3(200, 0, 0);

        go.anchorType      = AnchorType.Alignment;
        go.anchorPointType = AnchorPointType.Right;
        go.marginType      = MarginType.MarginY;
        //var help = scroll.gameObject.AddComponent<ScrollHelper>();
        //help.Slider = go.transform;
        return(p);
    }
Exemple #5
0
    static public UIElement AddDataGrid(UIElement parent)
    {
        var dg = UICreator.CreateElement(Vector3.zero, new Vector2(1280, 720), "DataGrid", parent);

        dg.Pivot         = new Vector2(0f, 1);
        dg.compositeType = CompositeType.DataGrid;
        var grid = UICreator.CreateElement(Vector3.zero, new Vector2(100, 100), "Grid", dg);

        grid.Pivot      = new Vector2(0f, 1f);
        grid.marginType = MarginType.Margin;
        grid.Mask       = true;
        grid.margin.top = 60;

        var items = UICreator.CreateElement(Vector3.zero, new Vector2(100, 100), "Items", grid);

        items.Pivot = new Vector2(0f, 1);

        var line = UICreator.CreateHLine(Vector3.zero, new Vector2(200, 60), "Line", grid);

        line.MainColor  = new Color32(85, 85, 85, 255);
        line.marginType = MarginType.Margin;

        var heads = new UIElement();//new GameObject("Heads");

        heads.name = "Heads";
        heads.SetParent(dg);
        var drags = new UIElement();//new GameObject("Drags");

        drags.name = "Drags";
        drags.SetParent(dg);

        var head = UICreator.CreateElement(Vector3.zero, new Vector2(200, 60), "Head", dg);

        head.Pivot = new Vector2(0f, 1);
        var img = UICreator.CreateHImage(Vector3.zero, new Vector2(200, 60), "Image", head);

        img.marginType = MarginType.Margin;
        var txt = UICreator.CreateHText(Vector3.zero, new Vector2(200, 60), "Text", head);

        txt.marginType = MarginType.Margin;
        txt.TextAnchor = TextAnchor.MiddleLeft;
        txt.FontSize   = 32;
        txt.Text       = "字段名";
        txt.MainColor  = Color.black;
        var item = UICreator.CreateElement(Vector3.zero, new Vector2(200, 60), "Item", dg);

        item.Pivot     = new Vector2(0f, 1);
        txt            = UICreator.CreateHText(Vector3.zero, new Vector2(200, 60), "Text", item);
        txt.marginType = MarginType.Margin;
        txt.TextAnchor = TextAnchor.MiddleLeft;
        txt.FontSize   = 28;
        txt.Text       = "数据";

        var drag = UICreator.CreateElement(Vector3.zero, new Vector2(40, 60), "Drag", dg);

        drag.eventType = HEventType.UserEvent;
        return(dg);
    }
Exemple #6
0
    static public void AddScrollYExtand(MenuCommand menuCommand)
    {
        GameObject parent = menuCommand.context as GameObject;
        Transform  pt     = null;

        if (parent != null)
        {
            pt = parent.transform;
        }
        var sl     = UICreator.CreateHImage(new Vector3(0, 400, 0), new Vector2(400, 800), "ScrollEx", pt);
        var scroll = sl.Content;

        scroll.Mask          = true;
        scroll.MainColor     = new Color32(224, 224, 224, 255);
        scroll.eventType     = HEventType.UserEvent;
        scroll.compositeType = CompositeType.ScrollYExtand;
        scroll.Sprite        = EditorModelManager.FindSprite(icons, background);
        scroll.SprType       = SpriteType.Sliced;
        scroll.Pivot         = new Vector2(0.5f, 1);

        var bds = UICreator.CreateElement(Vector3.zero, new Vector2(400, 100), "Bodys", sl.transform).Content;

        bds.anchorType      = AnchorType.Alignment;
        bds.anchorPointType = AnchorPointType.Top;
        bds.marginType      = MarginType.MarginX;
        bds.Pivot           = new Vector2(0.5f, 1);

        bds                 = UICreator.CreateElement(Vector3.zero, new Vector2(400, 100), "Titles", sl.transform).Content;
        bds.anchorType      = AnchorType.Alignment;
        bds.anchorPointType = AnchorPointType.Top;
        bds.marginType      = MarginType.MarginX;
        bds.Pivot           = new Vector2(0.5f, 1);

        CreateItemE(sl.transform, "Title");
        var item = CreateItemE(sl.transform, "Item");

        item.transform.localPosition = new Vector3(0, -100, 0);
        var tail = CreateItemE(sl.transform, "Tail");

        tail.transform.localPosition = new Vector3(0, -200, 0);

        var body = new GameObject("Body");
        var son  = body.transform;

        son.SetParent(sl.transform);
        son.localPosition = new Vector3(0, -300, 0);
        son.localScale    = Vector3.one;
        son.localRotation = Quaternion.identity;
        var ui = body.AddComponent <UIElement>().Content;

        ui.SizeDelta = new Vector2(400, 100);
        ui.Pivot     = new Vector2(0.5f, 1);
        ui.Mask      = true;
    }
Exemple #7
0
    static public UIElement AddDesignedDockPanel(UIElement parent)
    {
        var dock = CreateDockPanel(parent);

        dock.name          = "DesignedDockPanel";
        dock.compositeType = CompositeType.DesignedDockPanel;

        var drag = UICreator.CreateHImage(Vector3.zero, new Vector2(40, 40), "Drag", dock);

        drag.Sprite = EditorModelManager.FindSprite(icons, file);

        CreateAuxiliary(dock);
        return(dock);
    }
Exemple #8
0
    static public void AddScrollY(MenuCommand menuCommand)
    {
        GameObject parent = menuCommand.context as GameObject;
        Transform  pt     = null;

        if (parent != null)
        {
            pt = parent.transform;
        }
        UIElement p      = UICreator.CreateElement(new Vector3(-10, 200, 0), new Vector2(420, 400), "Scroll", pt);
        var       sl     = UICreator.CreateHImage(Vector3.zero, new Vector2(400, 400), "ScrollY", p.transform);
        var       scroll = sl.Content;

        scroll.marginType    = MarginType.Margin;
        scroll.margin.right  = 20;
        scroll.Mask          = true;
        scroll.MainColor     = new Color32(224, 224, 224, 255);
        scroll.eventType     = HEventType.UserEvent;
        scroll.compositeType = CompositeType.ScrollY;
        scroll.Sprite        = EditorModelManager.FindSprite(icons, background);
        scroll.SprType       = SpriteType.Sliced;
        scroll.Pivot         = new Vector2(0.5f, 1);

        var item = CreateItem(sl.transform, "Item");

        item.Content.Pivot           = new Vector2(0.5f, 1);
        item.transform.localPosition = new Vector3(0, 0, 0);
        item.transform.Find("Image").localPosition = new Vector3(0, -50, 0);
        item.transform.Find("Text").localPosition  = new Vector3(0, -50, 0);

        var go = CreateSliderV();

        if (parent != null)
        {
            var rect = go.transform;
            rect.SetParent(p.transform);
            rect.localPosition = new Vector3(200, 0, 0);
            rect.localScale    = Vector3.one;
            rect.localRotation = Quaternion.identity;
        }
        var slider = go.GetComponent <UIElement>().Content;

        slider.anchorType      = AnchorType.Alignment;
        slider.anchorPointType = AnchorPointType.Right;
        slider.marginType      = MarginType.MarginY;
        var help = sl.gameObject.AddComponent <ScrollHelper>();

        help.Slider = go.transform;
    }
Exemple #9
0
    static UIElement CreateTabControl(Transform parent)
    {
        var tab = UICreator.CreateHImage(Vector3.zero, new Vector2(800, 800), "TabControl", parent);

        tab.Mask          = true;
        tab.MainColor     = new Color32(204, 204, 204, 255);
        tab.eventType     = huqiang.Core.HGUI.HEventType.UserEvent;
        tab.compositeType = CompositeType.TabControl;
        tab.Sprite        = EditorModelManager.FindSprite(icons, background);
        tab.SprType       = SpriteType.Sliced;

        var head = UICreator.CreateElement(Vector3.zero, new Vector2(100, 44), "Head", tab.transform);

        head.marginType      = MarginType.MarginX;
        head.anchorType      = AnchorType.Alignment;
        head.anchorPointType = AnchorPointType.Top;

        var items = UICreator.CreateElement(Vector3.zero, new Vector2(800, 42), "Items", head.transform);

        items.marginType    = MarginType.Margin;
        items.margin.down   = 2;
        items.compositeType = CompositeType.StackPanel;

        var line = UICreator.CreateHImage(Vector3.zero, new Vector2(100, 2), "Line", head.transform);

        line.anchorType      = AnchorType.Alignment;
        line.anchorPointType = AnchorPointType.Down;
        line.marginType      = MarginType.MarginX;

        var item = UICreator.CreateElement(new Vector3(-350, 380), new Vector2(100, 40), "Item", tab.transform);

        var img = UICreator.CreateHImage(Vector3.zero, new Vector2(100, 40), "Image", item.transform);

        img.MainColor = new Color32(168, 168, 168, 255);

        var txt = UICreator.CreateHText(Vector3.zero, new Vector2(80, 40), "Text", item.transform);

        txt.MainColor  = Color.black;
        txt.Text       = "Label";
        txt.FontSize   = 24;
        txt.TextAnchor = TextAnchor.MiddleLeft;

        var content = UICreator.CreateElement(Vector3.zero, new Vector2(800, 756), "Content", tab.transform);

        content.marginType = MarginType.Margin;
        content.margin.top = 44;
        return(tab);
    }
Exemple #10
0
    void InitialTab()
    {
        TabControl tab = view.tab;
        var        img = UICreator.CreateHImage(Vector3.zero, Vector2.zero, "con1", null);

        img.marginType = MarginType.Margin;
        img.MainColor  = Color.red;
        tab.AddContent(img, "标签1");
        img            = UICreator.CreateHImage(Vector3.zero, Vector2.zero, "con2", null);
        img.marginType = MarginType.Margin;
        img.MainColor  = Color.green;
        tab.AddContent(img, "标签2");
        img            = UICreator.CreateHImage(Vector3.zero, Vector2.zero, "con3", null);
        img.marginType = MarginType.Margin;
        img.MainColor  = Color.blue;
        tab.AddContent(img, "标签3");
    }
Exemple #11
0
    static void CreateAuxiliary(Transform parent)
    {
        var aux = UICreator.CreateElement(Vector3.zero, new Vector2(800, 800), "Auxiliary", parent);

        aux.marginType = MarginType.Margin;

        var tab = CreateTabControl(aux.transform);

        tab.marginType = MarginType.Margin;

        var item = tab.transform.Find("Item");

        var clo = UICreator.CreateHImage(new Vector3(41.5f, 0, 0), new Vector2(30, 30), "Close", item);

        clo.eventType = huqiang.Core.HGUI.HEventType.UserEvent;
        clo.Sprite    = EditorModelManager.FindSprite(icons, close);

        var Cover = UICreator.CreateHImage(Vector3.zero, new Vector2(30, 30), "Cover", aux.transform);

        Cover.MainColor = new Color32(128, 128, 128, 128);

        var Docker = UICreator.CreateElement(Vector3.zero, new Vector2(800, 800), "Docker", aux.transform);

        var bk     = EditorModelManager.FindSprite(icons, background);
        var Center = UICreator.CreateHImage(Vector3.zero, new Vector2(80, 80), "Center", Docker.transform);

        Center.Sprite    = bk;
        Center.MainColor = 0x69DCF8d0.ToColor();
        var left = UICreator.CreateHImage(new Vector3(-80, 0, 0), new Vector2(50, 100), "Left", Docker.transform);

        left.Sprite    = bk;
        left.MainColor = 0x69DCF8d0.ToColor();
        var top = UICreator.CreateHImage(new Vector3(0, 80, 0), new Vector2(100, 50), "Top", Docker.transform);

        top.Sprite    = bk;
        top.MainColor = 0x69DCF8d0.ToColor();
        var right = UICreator.CreateHImage(new Vector3(80, 0, 0), new Vector2(50, 100), "Right", Docker.transform);

        right.Sprite    = bk;
        right.MainColor = 0x69DCF8d0.ToColor();
        var down = UICreator.CreateHImage(new Vector3(0, -80, 0), new Vector2(100, 50), "Down", Docker.transform);

        down.Sprite    = bk;
        down.MainColor = 0x69DCF8d0.ToColor();
    }
Exemple #12
0
    static UIElement CreateItem(Transform parent, string name)
    {
        var mod = UICreator.CreateElement(Vector3.zero, new Vector2(100, 100), name, parent);

        var img = UICreator.CreateHImage(Vector3.zero, new Vector2(90, 90), "Image", mod.transform);

        img.MainColor = new Color32(68, 68, 68, 255);
        img.eventType = huqiang.Core.HGUI.HEventType.UserEvent;
        img.Sprite    = EditorModelManager.FindSprite(icons, background);
        img.SprType   = SpriteType.Sliced;

        var txt = UICreator.CreateHText(Vector3.zero, new Vector2(80, 80), "Text", mod.transform);

        txt.Text       = name;
        txt.FontSize   = 30;
        txt.TextAnchor = TextAnchor.MiddleLeft;
        return(mod);
    }
Exemple #13
0
    static public UIElement AddScrollYExtand(UIElement parent)
    {
        var scroll = UICreator.CreateHImage(new Vector3(0, 400, 0), new Vector2(400, 800), "ScrollEx", parent);

        scroll.Mask          = true;
        scroll.MainColor     = new Color32(224, 224, 224, 255);
        scroll.eventType     = HEventType.UserEvent;
        scroll.compositeType = CompositeType.ScrollYExtand;
        scroll.Sprite        = EditorModelManager.FindSprite(icons, background);
        scroll.SprType       = SpriteType.Sliced;
        scroll.Pivot         = new Vector2(0.5f, 1);

        var bds = UICreator.CreateElement(Vector3.zero, new Vector2(400, 100), "Bodys", scroll);

        bds.anchorType      = AnchorType.Alignment;
        bds.anchorPointType = AnchorPointType.Top;
        bds.marginType      = MarginType.MarginX;
        bds.Pivot           = new Vector2(0.5f, 1);

        bds                 = UICreator.CreateElement(Vector3.zero, new Vector2(400, 100), "Titles", scroll);
        bds.anchorType      = AnchorType.Alignment;
        bds.anchorPointType = AnchorPointType.Top;
        bds.marginType      = MarginType.MarginX;
        bds.Pivot           = new Vector2(0.5f, 1);

        CreateItemE(scroll, "Title");
        var item = CreateItemE(scroll, "Item");

        item.localPosition = new Vector3(0, -100, 0);
        var tail = CreateItemE(scroll, "Tail");

        tail.localPosition = new Vector3(0, -200, 0);

        var body = new UIElement();//new GameObject("Body");

        body.name = "Body";
        body.SetParent(scroll);
        body.localPosition = new Vector3(0, -300, 0);
        body.SizeDelta     = new Vector2(400, 100);
        body.Pivot         = new Vector2(0.5f, 1);
        body.Mask          = true;
        return(scroll);
    }
Exemple #14
0
    static public void AddScrollX(MenuCommand menuCommand)
    {
        GameObject parent = menuCommand.context as GameObject;
        Transform  pt     = null;

        if (parent != null)
        {
            pt = parent.transform;
        }
        UIElement p      = UICreator.CreateElement(Vector3.zero, new Vector2(400, 420), "Scroll", pt);
        var       scroll = UICreator.CreateHImage(Vector3.zero, new Vector2(400, 400), "ScrollX", p.transform);

        scroll.marginType    = MarginType.Margin;
        scroll.margin.down   = 20;
        scroll.Mask          = true;
        scroll.MainColor     = new Color32(224, 224, 224, 255);
        scroll.eventType     = huqiang.Core.HGUI.HEventType.UserEvent;
        scroll.compositeType = CompositeType.ScrollX;
        scroll.Sprite        = EditorModelManager.FindSprite(icons, background);
        scroll.SprType       = SpriteType.Sliced;

        CreateItem(scroll.transform, "Item");

        var go = CreateSliderH();

        if (parent != null)
        {
            var rect = go.transform;
            rect.SetParent(p.transform);
            rect.localPosition = new Vector3(200, 0, 0);
            rect.localScale    = Vector3.one;
            rect.localRotation = Quaternion.identity;
        }
        var slider = go.GetComponent <UIElement>();

        slider.anchorType      = AnchorType.Alignment;
        slider.anchorPointType = AnchorPointType.Down;
        slider.marginType      = MarginType.MarginX;
        var help = scroll.gameObject.AddComponent <ScrollHelper>();

        help.Slider = go.transform;
    }
Exemple #15
0
    static public void AddDesignedDockPanel(MenuCommand menuCommand)
    {
        var       game = menuCommand.context as GameObject;
        Transform pt   = null;

        if (game != null)
        {
            pt = game.transform;
        }
        var dock = CreateDockPanel(pt);

        dock.name          = "DesignedDockPanel";
        dock.compositeType = CompositeType.DesignedDockPanel;

        var drag = UICreator.CreateHImage(Vector3.zero, new Vector2(40, 40), "Drag", dock.transform);

        drag.Sprite = EditorModelManager.FindSprite(icons, file);

        CreateAuxiliary(dock.transform);
    }
Exemple #16
0
    static public void AddScroll(MenuCommand menuCommand)
    {
        GameObject parent = menuCommand.context as GameObject;
        Transform  pt     = null;

        if (parent != null)
        {
            pt = parent.transform;
        }
        var scroll = UICreator.CreateHImage(Vector3.zero, new Vector2(400, 400), "gridScroll", pt);

        scroll.Mask          = true;
        scroll.MainColor     = new Color32(224, 224, 224, 255);
        scroll.eventType     = huqiang.Core.HGUI.HEventType.UserEvent;
        scroll.compositeType = CompositeType.GridScroll;
        scroll.Sprite        = EditorModelManager.FindSprite(icons, background);
        scroll.SprType       = SpriteType.Sliced;

        CreateItem(scroll.transform, "Item");
    }
    static public void AddScrollY(MenuCommand menuCommand)
    {
        GameObject parent = menuCommand.context as GameObject;
        Transform  pt     = null;

        if (parent != null)
        {
            pt = parent.transform;
        }
        var scroll = UICreator.CreateHImage(Vector3.zero, new Vector2(400, 400), "ScrollY", pt);

        scroll.Mask          = true;
        scroll.MainColor     = new Color32(224, 224, 224, 255);
        scroll.eventType     = huqiang.Core.HGUI.EventType.UserEvent;
        scroll.compositeType = CompositeType.ScrollY;
        scroll.Sprite        = EditorModelManager.FindSprite(icons, background);
        scroll.SprType       = SpriteType.Sliced;
        scroll.Pivot         = new Vector2(0.5f, 1);

        var item = CreateItem(scroll.transform, "Item");

        item.transform.localPosition = new Vector3(0, -200, 0);

        var slider = UICreator.CreateHImage(new Vector3(190, -200, 0), new Vector2(20, 400), "Slider", scroll.transform);

        slider.eventType     = huqiang.Core.HGUI.EventType.UserEvent;
        slider.compositeType = CompositeType.Slider;
        slider.Sprite        = scroll.Sprite;
        slider.SprType       = SpriteType.Sliced;
        slider.MainColor     = 0x295B7680.ToColor();

        var help = slider.gameObject.AddComponent <SliderHelper>();

        help.direction = UISlider.Direction.Vertical;

        var Nob = UICreator.CreateHImage(new Vector3(0, 185, 0), new Vector2(20, 30), "Nob", slider.transform);

        Nob.MainColor = 0x5F5263ff.ToColor();
        Nob.Sprite    = EditorModelManager.FindSprite(icons, background);
        Nob.SprType   = SpriteType.Sliced;
    }
Exemple #18
0
    static public void AddInputBox(MenuCommand menuCommand)
    {
        GameObject parent = menuCommand.context as GameObject;

        var go    = new GameObject("InputBox", typeof(HImage));
        var trans = go.transform;

        if (parent != null)
        {
            trans.SetParent(parent.transform);
        }
        trans.localPosition = Vector3.zero;
        trans.localScale    = Vector3.one;
        trans.localRotation = Quaternion.identity;
        var img = go.GetComponent <HImage>().Content;

        img.Mask          = true;
        img.compositeType = CompositeType.InputBox;
        img.Sprite        = EditorModelManager.FindSprite(icons, box);
        img.SprType       = SpriteType.Sliced;
        img.SizeDelta     = new Vector2(400, 100);
        var help = go.AddComponent <TextInputHelper>();

        go = new GameObject("InputText", typeof(TextBox));
        var son = go.transform;

        son.SetParent(trans);
        son.localPosition = Vector3.zero;
        son.localScale    = Vector3.one;
        son.localRotation = Quaternion.identity;
        var txt = go.GetComponent <HText>().Content;

        txt.SizeDelta = new Vector2(380, 90);

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


        UICreator.CreateHImage(Vector3.zero, new Vector2(2, 28), "Cursor", son);
        help.Refresh();
    }
Exemple #19
0
    static public void AddPopMenu(MenuCommand menuCommand)
    {
        GameObject parent = menuCommand.context as GameObject;
        var        dg     = UICreator.CreateElement(Vector3.zero, new Vector2(300, 80), "PopMenu", parent.transform);

        dg.Content.compositeType = CompositeType.PopMenu;
        var grid = UICreator.CreateHImage(Vector3.zero, new Vector2(300, 80), "Content", dg.transform);

        grid.Content.MainColor     = new Color32(40, 40, 40, 255);
        grid.Content.compositeType = CompositeType.PopMenu;
        var helper = grid.gameObject.AddComponent <StackPanelHelper>();

        helper.direction = Direction.Vertical;

        var item = UICreator.CreateElement(Vector3.zero, new Vector2(300, 60), "Item", dg.transform);

        item.Content.marginType = MarginType.MarginX;

        var img = UICreator.CreateHImage(Vector3.zero, new Vector2(300, 60), "Image", item.transform);

        img.Content.MainColor  = new Color32(64, 64, 64, 255);
        img.Content.marginType = MarginType.Margin;

        var txt = UICreator.CreateHText(Vector3.zero, new Vector2(200, 60), "Text", item.transform);

        txt.Content.marginType = MarginType.Margin;
        txt.Content.margin     = new Margin(5, 32, 5, 5);
        txt.Content.TextAnchor = TextAnchor.MiddleCenter;
        txt.Content.FontSize   = 32;
        txt.Content.Text       = "Item";

        img = UICreator.CreateHImage(new Vector3(138, 0, 0), new Vector2(24, 32), "Expand", item.transform);
        img.Content.anchorType      = AnchorType.Alignment;
        img.Content.anchorPointType = AnchorPointType.Right;
        img.Content.Sprite          = EditorModelManager.FindSprite(icons, "Next");
    }
Exemple #20
0
    static public UIElement AddDropDown(UIElement parent)
    {
        var drop = new HImage();//new GameObject("DropDown");

        drop.name          = "DropDown";
        drop.SizeDelta     = new Vector2(300, 60);
        drop.Sprite        = EditorModelManager.FindSprite(icons, background);
        drop.SprType       = SpriteType.Sliced;
        drop.MainColor     = new Color32(224, 224, 224, 255);
        drop.eventType     = HEventType.UserEvent;
        drop.compositeType = CompositeType.DropDown;
        drop.SetParent(parent);

        var txt = UICreator.CreateHText(Vector3.zero, Vector2.zero, "Label", drop);

        txt.TextAnchor = TextAnchor.MiddleLeft;
        txt.FontSize   = 36;
        txt.marginType = MarginType.Margin;
        txt.margin     = new Margin(20, 100, 5, 5);
        txt.Text       = "Label";
        txt.MainColor  = Color.black;

        var img = UICreator.CreateHImage(Vector3.zero, new Vector2(50, 50), "Arrow", drop);

        img.SizeDelta       = new Vector2(50, 50);
        img.Sprite          = EditorModelManager.FindSprite(icons, diamond);
        img.anchorPointType = AnchorPointType.Right;
        img.anchorType      = AnchorType.Alignment;
        img.MainColor       = Color.black;

        var main = UICreator.CreateHImage(new Vector3(0, -34, 0), new Vector2(300, 300), "Scroll", drop);

        main.Pivot         = new Vector2(0.5f, 1);
        main.Mask          = true;
        main.MainColor     = new Color32(224, 224, 224, 255);
        main.eventType     = HEventType.UserEvent;
        main.compositeType = CompositeType.ScrollY;
        main.Sprite        = EditorModelManager.FindSprite(icons, background);
        main.SprType       = SpriteType.Sliced;

        var item = UICreator.CreateElement(new Vector3(0, -150, 0), new Vector2(300, 60), "Item", main);

        item.eventType      = HEventType.UserEvent;
        img                 = UICreator.CreateHImage(Vector3.zero, new Vector2(290, 50), "Image", item);
        img.Sprite          = EditorModelManager.FindSprite(icons, background);
        img.SprType         = SpriteType.Sliced;
        txt                 = UICreator.CreateHText(Vector3.zero, Vector2.zero, "Text", item);
        txt.marginType      = MarginType.Margin;
        txt.margin          = new Margin(60, 60, 5, 5);
        txt.MainColor       = Color.black;
        txt.Text            = "Option";
        txt.FontSize        = 32;
        txt.TextAnchor      = TextAnchor.MiddleLeft;
        img                 = UICreator.CreateHImage(Vector3.zero, new Vector2(30, 30), "Check", item);
        img.Sprite          = EditorModelManager.FindSprite(icons, star);
        img.anchorType      = AnchorType.Alignment;
        img.anchorOffset.x  = 20;
        img.anchorPointType = AnchorPointType.Left;
        img.MainColor       = Color.black;

        var slider = UICreator.CreateHImage(new Vector3(140, -150, 0), new Vector2(20, 300), "Slider", main);

        slider.eventType     = HEventType.UserEvent;
        slider.compositeType = CompositeType.Slider;
        slider.Sprite        = EditorModelManager.FindSprite(icons, background);
        slider.SprType       = SpriteType.Sliced;
        slider.MainColor     = 0x295B7680.ToColor();

        //var help = slider.gameObject.AddComponent<SliderHelper>();
        //help.direction = huqiang.UIComposite.UISlider.Direction.Vertical;


        var Nob = UICreator.CreateHImage(new Vector3(0, 135, 0), new Vector2(20, 30), "Nob", slider);

        Nob.MainColor = 0x5F5263ff.ToColor();
        Nob.Sprite    = EditorModelManager.FindSprite(icons, background);
        Nob.SprType   = SpriteType.Sliced;
        return(drop);
    }
Exemple #21
0
    static public void AddDropDown(MenuCommand menuCommand)
    {
        GameObject parent = menuCommand.context as GameObject;

        var       ss   = new GameObject("DropDown");
        Transform rect = ss.transform;
        var       drop = ss.AddComponent <HImage>();

        drop.SizeDelta     = new Vector2(300, 60);
        drop.Sprite        = EditorModelManager.FindSprite(icons, background);
        drop.SprType       = SpriteType.Sliced;
        drop.MainColor     = new Color32(224, 224, 224, 255);
        drop.eventType     = huqiang.Core.HGUI.HEventType.UserEvent;
        drop.compositeType = CompositeType.DropDown;
        if (parent != null)
        {
            rect.SetParent(parent.transform);
        }
        rect.localPosition = Vector3.zero;
        rect.localScale    = Vector3.one;
        rect.localRotation = Quaternion.identity;

        var txt = UICreator.CreateHText(Vector3.zero, Vector2.zero, "Label", rect);

        txt.TextAnchor = TextAnchor.MiddleLeft;
        txt.FontSize   = 36;
        txt.marginType = MarginType.Margin;
        txt.margin     = new Margin(20, 100, 5, 5);
        txt.Text       = "Label";
        txt.MainColor  = Color.black;

        var img = UICreator.CreateHImage(Vector3.zero, new Vector2(50, 50), "Arrow", rect);

        img.SizeDelta       = new Vector2(50, 50);
        img.Sprite          = EditorModelManager.FindSprite(icons, diamond);
        img.anchorPointType = AnchorPointType.Right;
        img.anchorType      = AnchorType.Alignment;
        img.MainColor       = Color.black;

        var main = UICreator.CreateHImage(new Vector3(0, -34, 0), new Vector2(300, 300), "Scroll", rect);

        main.Pivot         = new Vector2(0.5f, 1);
        main.Mask          = true;
        main.MainColor     = new Color32(224, 224, 224, 255);
        main.eventType     = huqiang.Core.HGUI.HEventType.UserEvent;
        main.compositeType = CompositeType.ScrollY;
        main.Sprite        = EditorModelManager.FindSprite(icons, background);
        main.SprType       = SpriteType.Sliced;

        var item = UICreator.CreateElement(new Vector3(0, -150, 0), new Vector2(300, 60), "Item", main.transform);

        item.eventType      = huqiang.Core.HGUI.HEventType.UserEvent;
        img                 = UICreator.CreateHImage(Vector3.zero, new Vector2(290, 50), "Image", item.transform);
        img.Sprite          = EditorModelManager.FindSprite(icons, background);
        img.SprType         = SpriteType.Sliced;
        txt                 = UICreator.CreateHText(Vector3.zero, Vector2.zero, "Text", item.transform);
        txt.marginType      = MarginType.Margin;
        txt.margin          = new Margin(60, 60, 5, 5);
        txt.MainColor       = Color.black;
        txt.Text            = "Option";
        txt.FontSize        = 32;
        txt.TextAnchor      = TextAnchor.MiddleLeft;
        img                 = UICreator.CreateHImage(Vector3.zero, new Vector2(30, 30), "Check", item.transform);
        img.Sprite          = EditorModelManager.FindSprite(icons, star);
        img.anchorType      = AnchorType.Alignment;
        img.anchorOffset.x  = 20;
        img.anchorPointType = AnchorPointType.Left;
        img.MainColor       = Color.black;

        var slider = UICreator.CreateHImage(new Vector3(140, -150, 0), new Vector2(20, 300), "Slider", main.transform);

        slider.eventType     = huqiang.Core.HGUI.HEventType.UserEvent;
        slider.compositeType = CompositeType.Slider;
        slider.Sprite        = EditorModelManager.FindSprite(icons, background);
        slider.SprType       = SpriteType.Sliced;
        slider.MainColor     = 0x295B7680.ToColor();

        var help = slider.gameObject.AddComponent <SliderHelper>();

        help.direction = UISlider.Direction.Vertical;


        var Nob = UICreator.CreateHImage(new Vector3(0, 135, 0), new Vector2(20, 30), "Nob", slider.transform);

        Nob.MainColor = 0x5F5263ff.ToColor();
        Nob.Sprite    = EditorModelManager.FindSprite(icons, background);
        Nob.SprType   = SpriteType.Sliced;
    }
Exemple #22
0
    static public void AddImage(MenuCommand menuCommand)
    {
        GameObject parent = menuCommand.context as GameObject;

        UICreator.CreateHImage(Vector3.zero, new Vector2(100, 100), "Image", parent.transform);
    }
Exemple #23
0
    static public void AddDataGrid(MenuCommand menuCommand)
    {
        GameObject parent = menuCommand.context as GameObject;
        var        dg     = UICreator.CreateElement(Vector3.zero, new Vector2(1280, 720), "DataGrid", parent.transform);

        dg.Pivot         = new Vector2(0f, 1);
        dg.compositeType = CompositeType.DataGrid;
        var grid = UICreator.CreateElement(Vector3.zero, new Vector2(100, 100), "Grid", dg.transform);

        grid.Pivot      = new Vector2(0f, 1f);
        grid.marginType = MarginType.Margin;
        grid.Mask       = true;
        grid.margin.top = 60;

        var items = UICreator.CreateElement(Vector3.zero, new Vector2(100, 100), "Items", grid.transform);

        items.Pivot = new Vector2(0f, 1);

        var line = UICreator.CreateHLine(Vector3.zero, new Vector2(200, 60), "Line", grid.transform);

        line.MainColor  = new Color32(85, 85, 85, 255);
        line.marginType = MarginType.Margin;

        var heads = new GameObject("Heads");

        heads.transform.SetParent(dg.transform);
        heads.transform.localScale    = Vector3.one;
        heads.transform.localPosition = Vector3.zero;
        heads.transform.localRotation = Quaternion.identity;
        var drags = new GameObject("Drags");

        drags.transform.SetParent(dg.transform);
        drags.transform.localScale    = Vector3.one;
        drags.transform.localPosition = Vector3.zero;
        drags.transform.localRotation = Quaternion.identity;

        var head = UICreator.CreateElement(Vector3.zero, new Vector2(200, 60), "Head", dg.transform);

        head.Pivot = new Vector2(0f, 1);
        var img = UICreator.CreateHImage(Vector3.zero, new Vector2(200, 60), "Image", head.transform);

        img.marginType = MarginType.Margin;
        var txt = UICreator.CreateHText(Vector3.zero, new Vector2(200, 60), "Text", head.transform);

        txt.marginType = MarginType.Margin;
        txt.TextAnchor = TextAnchor.MiddleLeft;
        txt.FontSize   = 32;
        txt.Text       = "字段名";
        txt.MainColor  = Color.black;
        var item = UICreator.CreateElement(Vector3.zero, new Vector2(200, 60), "Item", dg.transform);

        item.Pivot     = new Vector2(0f, 1);
        txt            = UICreator.CreateHText(Vector3.zero, new Vector2(200, 60), "Text", item.transform);
        txt.marginType = MarginType.Margin;
        txt.TextAnchor = TextAnchor.MiddleLeft;
        txt.FontSize   = 28;
        txt.Text       = "数据";

        var drag = UICreator.CreateElement(Vector3.zero, new Vector2(40, 60), "Drag", dg.transform);

        drag.eventType = huqiang.Core.HGUI.HEventType.UserEvent;
    }