Client LuaCsForBarotrauma
ParamsEditor.cs
1 using Microsoft.Xna.Framework;
2 using System.Collections.Generic;
3 using System.Linq;
4 
5 namespace Barotrauma
6 {
8  {
9  private static ParamsEditor _instance;
10  public static ParamsEditor Instance
11  {
12  get
13  {
14  if (_instance == null)
15  {
16  _instance = new ParamsEditor();
17  }
18  return _instance;
19  }
20  }
21 
22  public GUIComponent Parent { get; private set; }
23  public GUIListBox EditorBox { get; private set; }
27  public IEnumerable<SerializableEntityEditor> FindEntityEditors() => EditorBox.Content.RectTransform.Children
28  .Select(c => c.GUIComponent as SerializableEntityEditor)
29  .Where(c => c != null);
30 
32  {
33  rectT = rectT ?? new RectTransform(new Vector2(0.25f, 1f), GUI.Canvas) { MinSize = new Point(340, GameMain.GraphicsHeight) };
34  rectT.SetPosition(Anchor.TopRight);
35  Parent = new GUIFrame(rectT, null, Color);
36  EditorBox = new GUIListBox(new RectTransform(Vector2.One * 0.98f, rectT, Anchor.Center), color: Color.Black, style: null)
37  {
38  Spacing = 10,
39  AutoHideScrollBar = true,
40  KeepSpaceForScrollBar = true
41  };
42  return EditorBox;
43  }
44 
45  public void Clear()
46  {
48  }
49 
50  public ParamsEditor(RectTransform rectT = null)
51  {
53  }
54 
55  public static Color Color = new Color(20, 20, 20, 255);
56  }
57 }
RectTransform RectTransform
GUIFrame Content
A frame that contains the contents of the listbox. The frame itself is not rendered.
Definition: GUIListBox.cs:33
override void ClearChildren()
Definition: GUIListBox.cs:1243
static int GraphicsHeight
Definition: GameMain.cs:168
ParamsEditor(RectTransform rectT=null)
Definition: ParamsEditor.cs:50
IEnumerable< SerializableEntityEditor > FindEntityEditors()
Uses Linq queries. Don't use too frequently or reimplement.
GUIListBox CreateEditorBox(RectTransform rectT=null)
Definition: ParamsEditor.cs:31
static ParamsEditor Instance
Definition: ParamsEditor.cs:11
void SetPosition(Anchor anchor, Pivot? pivot=null)
IEnumerable< RectTransform > Children