(4b2369616) Don't register hotkeys, character controls or other input when the character creation interface is open.

This commit is contained in:
Joonas Rikkonen
2019-04-15 11:59:53 +03:00
parent d6acb8bf09
commit 629993f38d
@@ -148,7 +148,7 @@ namespace Barotrauma
animationResetRequiresForceLoading = false; animationResetRequiresForceLoading = false;
isExtrudingJoint = false; isExtrudingJoint = false;
isDrawingJoint = false; isDrawingJoint = false;
Wizard.Instance = null; Wizard.instance = null;
} }
private void Reset() private void Reset()
@@ -209,7 +209,7 @@ namespace Barotrauma
{ {
//base.AddToGUIUpdateList(); //base.AddToGUIUpdateList();
rightPanel.AddToGUIUpdateList(); rightPanel.AddToGUIUpdateList();
Wizard.Instance.AddToGUIUpdateList(); Wizard.instance?.AddToGUIUpdateList();
if (displayBackgroundColor) if (displayBackgroundColor)
{ {
backgroundColorPanel.AddToGUIUpdateList(); backgroundColorPanel.AddToGUIUpdateList();
@@ -241,7 +241,7 @@ namespace Barotrauma
base.Update(deltaTime); base.Update(deltaTime);
spriteSheetRect = CalculateSpritesheetRectangle(); spriteSheetRect = CalculateSpritesheetRectangle();
// Handle shortcut keys // Handle shortcut keys
if (GUI.KeyboardDispatcher.Subscriber == null) if (GUI.KeyboardDispatcher.Subscriber == null && Wizard.instance == null)
{ {
if (PlayerInput.KeyDown(Keys.LeftControl)) if (PlayerInput.KeyDown(Keys.LeftControl))
{ {
@@ -430,7 +430,7 @@ namespace Barotrauma
} }
} }
} }
if (!isFreezed) if (!isFreezed && Wizard.instance == null)
{ {
if (character.AnimController.Invalid) if (character.AnimController.Invalid)
{ {
@@ -4340,7 +4340,7 @@ namespace Barotrauma
private List<XElement> jointXElements = new List<XElement>(); private List<XElement> jointXElements = new List<XElement>();
private List<GUIComponent> jointGUIElements = new List<GUIComponent>(); private List<GUIComponent> jointGUIElements = new List<GUIComponent>();
private static Wizard instance; public static Wizard instance;
public static Wizard Instance public static Wizard Instance
{ {
get get
@@ -4351,10 +4351,6 @@ namespace Barotrauma
} }
return instance; return instance;
} }
set
{
instance = value;
}
} }
public enum Tab { None, Character, Ragdoll } public enum Tab { None, Character, Ragdoll }
@@ -4482,7 +4478,7 @@ namespace Barotrauma
// Cancel // Cancel
box.Buttons[0].OnClicked += (b, d) => box.Buttons[0].OnClicked += (b, d) =>
{ {
Instance.SelectTab(Tab.None); Wizard.Instance.SelectTab(Tab.None);
return true; return true;
}; };
// Next // Next
@@ -4494,7 +4490,7 @@ namespace Barotrauma
texturePathElement.Flash(Color.Red); texturePathElement.Flash(Color.Red);
return false; return false;
} }
Instance.SelectTab(Tab.Ragdoll); Wizard.Instance.SelectTab(Tab.Ragdoll);
return true; return true;
}; };
return box; return box;
@@ -4635,7 +4631,7 @@ namespace Barotrauma
// Previous // Previous
box.Buttons[0].OnClicked += (b, d) => box.Buttons[0].OnClicked += (b, d) =>
{ {
Instance.SelectTab(Tab.Character); Wizard.Instance.SelectTab(Tab.Character);
return true; return true;
}; };
// Parse and create // Parse and create
@@ -4726,7 +4722,7 @@ namespace Barotrauma
{ {
GUI.AddMessage(GetCharacterEditorTranslation("CharacterCreated").Replace("[name]", Name), Color.Green, font: GUI.Font); GUI.AddMessage(GetCharacterEditorTranslation("CharacterCreated").Replace("[name]", Name), Color.Green, font: GUI.Font);
} }
Instance.SelectTab(Tab.None); Wizard.Instance.SelectTab(Tab.None);
return true; return true;
}; };
return box; return box;