Exemple #1
0
 public Layout(Vector2 size, bool autoLayout, LayoutDirection autoLayoutDirection, LayoutStart autoLayoutStart, int spacing, string backgroundSprite = "")
 {
     Size                = size;
     AutoLayout          = autoLayout;
     AutoLayoutDirection = autoLayoutDirection;
     AutoLayoutStart     = autoLayoutStart;
     Spacing             = spacing;
     BackgroundSprite    = backgroundSprite;
 }
Exemple #2
0
 public static void SetAutoLayout(
     this UIPanel c,
     LayoutDirection direction,
     RectOffset padding = null,
     LayoutStart start  = LayoutStart.TopLeft
     )
 {
     c.autoLayout          = true;
     c.autoLayoutDirection = direction;
     c.autoLayoutStart     = start;
     c.autoLayoutPadding   = padding ?? Helper.ZeroOffset;
 }
Exemple #3
0
        public override void Start()
        {
            base.Start();
            Vector2 screenRes = UIView.GetAView().GetScreenResolution();

            relativePosition = SerializationService.Instance.GetToolBarPosition() ?? CalculateDefaultToolBarPosition();
            LayoutStart layoutStart = (relativePosition.x + 20.0f > screenRes.x / 2.0f) ? ((relativePosition.y + 137.5f > screenRes.y / 2.0f) ? LayoutStart.BottomRight : LayoutStart.TopRight) : (relativePosition.y + 137.5f > screenRes.y / 2.0f) ? LayoutStart.BottomLeft : LayoutStart.TopLeft;

            Setup("Theme Mixer UI", 0.0f, 275.0f, 0, true, LayoutDirection.Horizontal, layoutStart);
            autoFitChildrenHorizontally = false;
            CreateToolBar();
            EnsureToolbarOnScreen();
            RefreshZOrder();
        }
Exemple #4
0
        public virtual void Setup(string panelName, float panelWidth, float panelHeight, int spacing = UIUtils.DefaultSpacing, bool panelAutoLayout = false, LayoutDirection layoutDirection = LayoutDirection.Horizontal, LayoutStart layoutStart = LayoutStart.TopLeft, string bgSprite = "")
        {
            name                = panelName;
            width               = panelWidth;
            height              = panelHeight;
            autoLayout          = panelAutoLayout;
            autoLayoutDirection = layoutDirection;
            switch (layoutDirection)
            {
            case LayoutDirection.Horizontal: autoFitChildrenHorizontally = true; break;

            case LayoutDirection.Vertical: autoFitChildrenVertically = true; break;
            }
            autoLayoutStart  = layoutStart;
            atlas            = UISprites.DefaultAtlas;
            backgroundSprite = bgSprite;
            switch (layoutStart)
            {
            case LayoutStart.TopLeft:
                padding           = new RectOffset(spacing, 0, spacing, 0);
                autoLayoutPadding = new RectOffset(0, spacing, 0, spacing);
                break;

            case LayoutStart.BottomLeft:
                padding           = new RectOffset(spacing, 0, 0, spacing);
                autoLayoutPadding = new RectOffset(0, spacing, spacing, 0);
                break;

            case LayoutStart.TopRight:
                padding           = new RectOffset(0, spacing, 0, spacing);
                autoLayoutPadding = new RectOffset(spacing, 0, spacing, 0);
                break;

            case LayoutStart.BottomRight:
                padding           = new RectOffset(spacing, 0, 0, spacing);
                autoLayoutPadding = new RectOffset(0, spacing, spacing, 0);
                break;
            }
            builtinKeyNavigation = true;
            color = UIColor;
        }
Exemple #5
0
 internal void Setup(string v1, float panelWidth, float panelHeight, int v2, bool v3, LayoutDirection horizontal, LayoutStart topLeft, ColorID colorID, SavedSwatch savedSwatch)
 {
     Setup(v1, panelWidth, panelHeight, v2, v3, horizontal, topLeft);
     Setup(savedSwatch);
     ColorID = colorID;
 }