2 using Microsoft.Xna.Framework.Graphics;
3 using System.ComponentModel;
7 partial class Controller : ItemComponent
9 private bool chatBoxOriginalState;
10 private bool isHUDsHidden;
14 if (focusTarget !=
null && character.
ViewTarget == focusTarget)
20 ic.
DrawHUD(spriteBatch, character);
26 partial
void HideHUDs(
bool value)
28 if (isHUDsHidden == value) {
return; }
32 ToggleChatBox(
false, storeOriginalState:
true);
37 ToggleChatBox(chatBoxOriginalState, storeOriginalState:
false);
42 private void ToggleChatBox(
bool value,
bool storeOriginalState)
44 var crewManager = GameMain.GameSession?.CrewManager;
45 if (crewManager ==
null) {
return; }
47 if (crewManager.IsSinglePlayer)
49 if (crewManager.ChatBox !=
null)
51 if (storeOriginalState)
53 chatBoxOriginalState = crewManager.ChatBox.ToggleOpen;
55 crewManager.ChatBox.ToggleOpen = value;
58 else if (GameMain.Client !=
null)
60 if (storeOriginalState)
62 chatBoxOriginalState = GameMain.Client.ChatBox.ToggleOpen;
64 GameMain.Client.ChatBox.ToggleOpen = value;
71 base.CreateEditingHUD(editor);
73 foreach (LimbPos limbPos
in limbPositions)
75 PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(limbPos);
77 PropertyDescriptor limbPosProperty = properties.Find(
"Position",
false);
78 editor.CreateVector2Field(limbPos,
new SerializableProperty(limbPosProperty), limbPos.Position, limbPos.LimbType.ToString(),
"");
static Entity FindEntityByID(ushort ID)
Find an entity based on the ID
static GameSession?? GameSession
List< ItemComponent > Components
override void DrawHUD(SpriteBatch spriteBatch, Character character)
void ClientEventRead(IReadMessage msg, float sendingTime)
The base class for components holding the different functionalities of the item
virtual void CreateEditingHUD(SerializableEntityEditor editor)
virtual bool ShouldDrawHUD(Character character)
virtual void DrawHUD(SpriteBatch spriteBatch, Character character)