Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ CreateBindingGroup()

UISortableElement Terraria.GameContent.UI.States.UIManageControls.CreateBindingGroup ( int elementIndex,
List< string > bindings,
InputMode currentInputMode )
inlineprivate

Definition at line 262 of file UIManageControls.cs.

263 {
264 UISortableElement uISortableElement = new UISortableElement(elementIndex);
265 uISortableElement.HAlign = 0.5f;
266 uISortableElement.Width.Set(0f, 1f);
267 uISortableElement.Height.Set(2000f, 0f);
268 UIPanel uIPanel = new UIPanel();
269 uIPanel.Width.Set(0f, 1f);
270 uIPanel.Height.Set(-16f, 1f);
271 uIPanel.VAlign = 1f;
272 uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
274 UIList uIList = new UIList();
275 uIList.OverflowHidden = false;
276 uIList.Width.Set(0f, 1f);
277 uIList.Height.Set(-8f, 1f);
278 uIList.VAlign = 1f;
279 uIList.ListPadding = 5f;
280 uIPanel.Append(uIList);
281 _ = uIPanel.BackgroundColor;
282 switch (elementIndex)
283 {
284 case 0:
285 uIPanel.BackgroundColor = Color.Lerp(uIPanel.BackgroundColor, Color.Green, 0.18f);
286 break;
287 case 1:
288 uIPanel.BackgroundColor = Color.Lerp(uIPanel.BackgroundColor, Color.Goldenrod, 0.18f);
289 break;
290 case 2:
291 uIPanel.BackgroundColor = Color.Lerp(uIPanel.BackgroundColor, Color.HotPink, 0.18f);
292 break;
293 case 3:
294 uIPanel.BackgroundColor = Color.Lerp(uIPanel.BackgroundColor, Color.Indigo, 0.18f);
295 break;
296 case 4:
297 uIPanel.BackgroundColor = Color.Lerp(uIPanel.BackgroundColor, Color.Turquoise, 0.18f);
298 break;
299 }
300 CreateElementGroup(uIList, bindings, currentInputMode, uIPanel.BackgroundColor);
301 uIPanel.BackgroundColor = uIPanel.BackgroundColor.MultiplyRGBA(new Color(111, 111, 111));
303 switch (elementIndex)
304 {
305 case 0:
306 text = ((currentInputMode == InputMode.Keyboard || currentInputMode == InputMode.XBoxGamepad) ? Lang.menu[164] : Lang.menu[243]);
307 break;
308 case 1:
309 text = Lang.menu[165];
310 break;
311 case 2:
312 text = Lang.menu[166];
313 break;
314 case 3:
315 text = Lang.menu[167];
316 break;
317 case 4:
318 text = Lang.menu[198];
319 break;
320 }
322 {
323 VAlign = 0f,
324 HAlign = 0.5f
325 };
326 uISortableElement.Append(element);
327 uISortableElement.Recalculate();
328 float totalHeight = uIList.GetTotalHeight();
329 uISortableElement.Width.Set(0f, 1f);
330 uISortableElement.Height.Set(totalHeight + 30f + 16f, 0f);
331 return uISortableElement;
332 }
void CreateElementGroup(UIList parent, List< string > bindings, InputMode currentInputMode, Color color)
static readonly LocalizedText Empty
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491

References Microsoft.Xna.Framework.Graphics.Color, Terraria.GameContent.UI.States.UIManageControls.CreateElementGroup(), System.elementIndex, Terraria.Localization.LocalizedText.Empty, Microsoft.Xna.Framework.Color.Goldenrod, Microsoft.Xna.Framework.Color.Green, Terraria.UI.UIElement.HAlign, Microsoft.Xna.Framework.Color.HotPink, Microsoft.Xna.Framework.Color.Indigo, Microsoft.Xna.Framework.Color.Lerp(), Terraria.Lang.menu, System.text, Microsoft.Xna.Framework.Color.Turquoise, and Terraria.UI.UIElement.VAlign.

Referenced by Terraria.GameContent.UI.States.UIManageControls.AssembleBindPanels().