Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ KeyboardInput()

static bool Terraria.GameInput.PlayerInput.KeyboardInput ( )
inlinestaticprivate

Definition at line 1213 of file PlayerInput.cs.

1214 {
1215 bool flag = false;
1216 bool flag2 = false;
1219 if (pressedKeys.Count == 0 && MouseKeys.Count == 0)
1220 {
1221 Main.blockKey = Keys.None.ToString();
1222 return false;
1223 }
1224 for (int i = 0; i < pressedKeys.Count; i++)
1225 {
1226 if (pressedKeys[i] == Keys.LeftShift || pressedKeys[i] == Keys.RightShift)
1227 {
1228 flag = true;
1229 }
1230 else if (pressedKeys[i] == Keys.LeftAlt || pressedKeys[i] == Keys.RightAlt)
1231 {
1232 flag2 = true;
1233 }
1234 Main.ChromaPainter.PressKey(pressedKeys[i]);
1235 }
1236 if (Main.blockKey != Keys.None.ToString())
1237 {
1238 bool flag3 = false;
1239 for (int j = 0; j < pressedKeys.Count; j++)
1240 {
1241 if (pressedKeys[j].ToString() == Main.blockKey)
1242 {
1243 pressedKeys[j] = Keys.None;
1244 flag3 = true;
1245 }
1246 }
1247 if (!flag3)
1248 {
1249 Main.blockKey = Keys.None.ToString();
1250 }
1251 }
1252 KeyConfiguration keyConfiguration = CurrentProfile.InputModes[InputMode.Keyboard];
1253 if (Main.gameMenu && !WritingText)
1254 {
1255 keyConfiguration = CurrentProfile.InputModes[InputMode.KeyboardUI];
1256 }
1258 for (int k = 0; k < pressedKeys.Count; k++)
1259 {
1260 list.Add(pressedKeys[k].ToString());
1261 }
1262 if (WritingText)
1263 {
1264 list.Clear();
1265 }
1266 int count = list.Count;
1267 list.AddRange(MouseKeys);
1268 bool flag4 = false;
1269 for (int l = 0; l < list.Count; l++)
1270 {
1271 if (l < count && pressedKeys[l] == Keys.None)
1272 {
1273 continue;
1274 }
1275 string newKey = list[l];
1276 if (!(list[l] == Keys.Tab.ToString()) || !((flag && SocialAPI.Mode == SocialMode.Steam) || flag2))
1277 {
1279 {
1280 return false;
1281 }
1282 _ = Main.oldKeyState;
1283 if (l >= count || !Main.oldKeyState.IsKeyDown(pressedKeys[l]))
1284 {
1285 keyConfiguration.Processkey(Triggers.Current, newKey, InputMode.Keyboard);
1286 }
1287 else
1288 {
1289 keyConfiguration.CopyKeyState(Triggers.Old, Triggers.Current, newKey);
1290 }
1291 if (l >= count || pressedKeys[l] != 0)
1292 {
1293 flag4 = true;
1294 }
1295 }
1296 }
1297 if (flag4)
1298 {
1299 CurrentInputMode = InputMode.Keyboard;
1300 }
1301 return flag4;
1302 }
static void DebugKeys(List< Keys > keys)
static TriggersPack Triggers
static bool CheckRebindingProcessKeyboard(string newKey)
static List< Keys > GetPressedKeys()
static List< string > MouseKeys
static InputMode CurrentInputMode
static PlayerInputProfile CurrentProfile
static SocialMode Mode
Definition SocialAPI.cs:32

References Terraria.Main.blockKey, Terraria.GameInput.PlayerInput.CheckRebindingProcessKeyboard(), Terraria.Main.ChromaPainter, System.Linq.count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, Terraria.GameInput.PlayerInput.CurrentInputMode, Terraria.GameInput.PlayerInput.CurrentProfile, Terraria.GameInput.PlayerInput.DebugKeys(), Terraria.Main.gameMenu, Terraria.GameInput.PlayerInput.GetPressedKeys(), System.list, Terraria.Social.SocialAPI.Mode, Terraria.GameInput.PlayerInput.MouseKeys, Terraria.Main.oldKeyState, System.ToString, Terraria.GameInput.PlayerInput.Triggers, and Terraria.GameInput.PlayerInput.WritingText.

Referenced by Terraria.GameInput.PlayerInput.UpdateInput().