CrabUI
Loading...
Searching...
No Matches
CUIPropsDebug.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Reflection;
5
6using Barotrauma;
7using Microsoft.Xna.Framework;
8using Microsoft.Xna.Framework.Input;
9using Microsoft.Xna.Framework.Graphics;
10
11namespace CrabUI
12{
13 public class CUIPropsDebug : CUIFrame
14 {
15 static CUIPropsDebug() { CUI.OnDispose += () => { Instance = null; }; }
16 public static CUIPropsDebug Instance;
17 public static bool Opened => Instance?.Parent != null;
18 public static CUIPropsDebug Open()
19 {
20 if (!Opened)
21 {
22 Instance = new CUIPropsDebug();
23 CUI.TopMain.Append(Instance);
24 }
25
26 return Instance;
27 }
28
29 public CUIComponentSelector Selector;
30 public CUIPropsInterface Props;
31
32 public CUIPropsDebug() : base()
33 {
34 Absolute = new CUINullRect(w: 600, h: 400);
35 Anchor = new Vector2(0.3f, 0.5f);
36
37 this["layout"] = new CUIVerticalList()
38 {
39 Relative = new CUINullRect(0, 0, 1, 1),
40 };
41 this["layout"]["handle"] = CUIPrefab.FormHandle("Prop Debug");
42 this["layout"]["main"] = new CUIHorizontalList()
43 {
44 FillEmptySpace = new CUIBool2(false, true),
45 ConsumeDragAndDrop = true,
46 };
47
48 this["layout"]["main"]["select"] = Selector = new CUIComponentSelector()
49 {
50 FitContent = new CUIBool2(true, false),
51 DeepPalette = PaletteOrder.Secondary,
52 BackgroundColor = new Color(0, 0, 0),
53 };
54 this["layout"]["main"]["props"] = Props = new CUIPropsInterface()
55 {
56 FillEmptySpace = new CUIBool2(true, false),
57 DeepPalette = PaletteOrder.Secondary,
58 };
59
60 Selector.OnSelect += (c) => Props.Target = c;
61
62 Props.Target = this;
63 IgnoreDebug = true;
64
65
66 Selector.Refresh();
67 }
68 }
69}
CUIBool2 FillEmptySpace
Will be resized to fill empty space in list components.
CUINullRect Relative
Relative to parent size and position, [0..1].
Color BackgroundColor
Color of BackgroundSprite, default is black If you're using custom sprite and don't see it make sur...
Vector2 Anchor
this point of this component
CUIBool2 FitContent
Will resize itself to fit components with absolute size, e.g. text.
CUINullRect Absolute
Absolute size and position in pixels.