refactor: converted vkeycode enum into a class
This commit is contained in:
		
							parent
							
								
									e3f6db7ae5
								
							
						
					
					
						commit
						68d3d8065e
					
				
					 19 changed files with 123 additions and 54 deletions
				
			
		| 
						 | 
				
			
			@ -3,6 +3,7 @@ using System.Linq;
 | 
			
		|||
 | 
			
		||||
namespace Domain.Input {
 | 
			
		||||
	public class AObertaReader : InputReader {
 | 
			
		||||
		public AObertaReader(KeyHistory history) : base(history, new List<int>{ (int)VKeyCode.AccentOpen, (int)VKeyCode.A }, (int)VKeyCode.Shift, false) { }
 | 
			
		||||
		public AObertaReader(KeyHistory history) : base(history, new List<int> { VKeyCode.AccentOpen, VKeyCode.A },
 | 
			
		||||
			VKeyCode.Shift, false) { }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -2,6 +2,6 @@
 | 
			
		|||
 | 
			
		||||
namespace Domain.Input {
 | 
			
		||||
	public class CedillaReader : InputReader {
 | 
			
		||||
		public CedillaReader(KeyHistory history) : base(history, new List<int>{ (int)VKeyCode.Cedilla }) { }
 | 
			
		||||
		public CedillaReader(KeyHistory history) : base(history, new List<int> { VKeyCode.Cedilla }) { }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,7 @@ using System.Linq;
 | 
			
		|||
 | 
			
		||||
namespace Domain.Input {
 | 
			
		||||
	public class EObertaReader : InputReader {
 | 
			
		||||
		public EObertaReader(KeyHistory history) : base(history, new List<int>{ (int)VKeyCode.AccentOpen, (int)VKeyCode.E }, (int)VKeyCode.Shift, false) { }
 | 
			
		||||
		public EObertaReader(KeyHistory history) : base(history, new List<int> { VKeyCode.AccentOpen, VKeyCode.E },
 | 
			
		||||
			VKeyCode.Shift, false) { }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,7 @@ using System.Linq;
 | 
			
		|||
 | 
			
		||||
namespace Domain.Input {
 | 
			
		||||
	public class GeminadaReader : InputReader {
 | 
			
		||||
		public GeminadaReader(KeyHistory history) : base(history, new List<int>{ (int)VKeyCode.L, (int)VKeyCode.Interpunct, (int)VKeyCode.L }) { }
 | 
			
		||||
		public GeminadaReader(KeyHistory history) : base(history,
 | 
			
		||||
			new List<int> { VKeyCode.L, VKeyCode.Interpunct, VKeyCode.L }) { }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,7 @@ using System.Linq;
 | 
			
		|||
 | 
			
		||||
namespace Domain.Input {
 | 
			
		||||
	public class IDieresiReader : InputReader {
 | 
			
		||||
		public IDieresiReader(KeyHistory history) : base(history, new List<int>{ (int)VKeyCode.AccentClosed, (int)VKeyCode.I }, (int)VKeyCode.Shift, true) { }
 | 
			
		||||
		public IDieresiReader(KeyHistory history) : base(history, new List<int> { VKeyCode.AccentClosed, VKeyCode.I },
 | 
			
		||||
			VKeyCode.Shift, true) { }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,6 @@ using System.Linq;
 | 
			
		|||
 | 
			
		||||
namespace Domain.Input {
 | 
			
		||||
	public class IxReader : InputReader {
 | 
			
		||||
		public IxReader(KeyHistory history) : base(history, new List<int>{ (int)VKeyCode.I, (int)VKeyCode.X }) { }
 | 
			
		||||
		public IxReader(KeyHistory history) : base(history, new List<int> { VKeyCode.I, VKeyCode.X }) { }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,6 @@ using System.Linq;
 | 
			
		|||
 | 
			
		||||
namespace Domain.Input {
 | 
			
		||||
	public class LlReader : InputReader {
 | 
			
		||||
		public LlReader(KeyHistory history) : base(history, new List<int>{ (int)VKeyCode.L, (int)VKeyCode.L }) { }
 | 
			
		||||
		public LlReader(KeyHistory history) : base(history, new List<int> { VKeyCode.L, VKeyCode.L }) { }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,6 @@ using System.Linq;
 | 
			
		|||
 | 
			
		||||
namespace Domain.Input {
 | 
			
		||||
	public class NyReader : InputReader {
 | 
			
		||||
		public NyReader(KeyHistory history) : base(history, new List<int>{ (int)VKeyCode.N, (int)VKeyCode.Y }) { }
 | 
			
		||||
		public NyReader(KeyHistory history) : base(history, new List<int> { VKeyCode.N, VKeyCode.Y }) { }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,7 @@ using System.Linq;
 | 
			
		|||
 | 
			
		||||
namespace Domain.Input {
 | 
			
		||||
	public class OObertaReader : InputReader {
 | 
			
		||||
		public OObertaReader(KeyHistory history) : base(history, new List<int>{ (int)VKeyCode.AccentOpen, (int)VKeyCode.O }, (int)VKeyCode.Shift, false) { }
 | 
			
		||||
		public OObertaReader(KeyHistory history) : base(history, new List<int> { VKeyCode.AccentOpen, VKeyCode.O },
 | 
			
		||||
			VKeyCode.Shift, false) { }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,6 @@ using System.Linq;
 | 
			
		|||
 | 
			
		||||
namespace Domain.Input {
 | 
			
		||||
	public class SsReader : InputReader {
 | 
			
		||||
		public SsReader(KeyHistory history) : base(history, new List<int>{ (int)VKeyCode.S, (int)VKeyCode.S }) { }
 | 
			
		||||
		public SsReader(KeyHistory history) : base(history, new List<int> { VKeyCode.S, VKeyCode.S }) { }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,6 @@ using System.Linq;
 | 
			
		|||
 | 
			
		||||
namespace Domain.Input {
 | 
			
		||||
	public class TgReader : InputReader {
 | 
			
		||||
		public TgReader(KeyHistory history) : base(history, new List<int>{ (int)VKeyCode.T, (int)VKeyCode.G }) { }
 | 
			
		||||
		public TgReader(KeyHistory history) : base(history, new List<int> { VKeyCode.T, VKeyCode.G }) { }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,6 @@ using System.Linq;
 | 
			
		|||
 | 
			
		||||
namespace Domain.Input {
 | 
			
		||||
	public class TjReader : InputReader {
 | 
			
		||||
		public TjReader(KeyHistory history) : base(history, new List<int>{ (int)VKeyCode.T, (int)VKeyCode.J }) { }
 | 
			
		||||
		public TjReader(KeyHistory history) : base(history, new List<int> { VKeyCode.T, VKeyCode.J }) { }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,6 @@ using System.Linq;
 | 
			
		|||
 | 
			
		||||
namespace Domain.Input {
 | 
			
		||||
	public class TxReader : InputReader {
 | 
			
		||||
		public TxReader(KeyHistory history) : base(history, new List<int>{ (int)VKeyCode.T, (int)VKeyCode.X }) { }
 | 
			
		||||
		public TxReader(KeyHistory history) : base(history, new List<int> { VKeyCode.T, VKeyCode.X }) { }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										42
									
								
								Assets/Scripts/Domain/Input/VKeyCode.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								Assets/Scripts/Domain/Input/VKeyCode.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,42 @@
 | 
			
		|||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using Extensions;
 | 
			
		||||
 | 
			
		||||
namespace Domain.Input {
 | 
			
		||||
	public class VKeyCode : SmartEnum<VKeyCode, int> {
 | 
			
		||||
		public static VKeyCode A => new("A", 0x41);
 | 
			
		||||
		public static VKeyCode B => new("B", 0x42);
 | 
			
		||||
		public static VKeyCode C => new("C", 0x43);
 | 
			
		||||
		public static VKeyCode D => new("D", 0x44);
 | 
			
		||||
		public static VKeyCode E => new("E", 0x45);
 | 
			
		||||
		public static VKeyCode F => new("F", 0x46);
 | 
			
		||||
		public static VKeyCode G => new("G", 0x47);
 | 
			
		||||
		public static VKeyCode H => new("H", 0x48);
 | 
			
		||||
		public static VKeyCode I => new("I", 0x49);
 | 
			
		||||
		public static VKeyCode J => new("J", 0x4A);
 | 
			
		||||
		public static VKeyCode K => new("K", 0x4B);
 | 
			
		||||
		public static VKeyCode L => new("L", 0x4C);
 | 
			
		||||
		public static VKeyCode M => new("M", 0x4D);
 | 
			
		||||
		public static VKeyCode N => new("N", 0x4E);
 | 
			
		||||
		public static VKeyCode O => new("O", 0x4F);
 | 
			
		||||
		public static VKeyCode P => new("P", 0x50);
 | 
			
		||||
		public static VKeyCode Q => new("Q", 0x51);
 | 
			
		||||
		public static VKeyCode R => new("R", 0x52);
 | 
			
		||||
		public static VKeyCode S => new("S", 0x53);
 | 
			
		||||
		public static VKeyCode T => new("T", 0x54);
 | 
			
		||||
		public static VKeyCode U => new("U", 0x55);
 | 
			
		||||
		public static VKeyCode V => new("V", 0x56);
 | 
			
		||||
		public static VKeyCode W => new("W", 0x57);
 | 
			
		||||
		public static VKeyCode X => new("X", 0x58);
 | 
			
		||||
		public static VKeyCode Y => new("Y", 0x59);
 | 
			
		||||
		public static VKeyCode Z => new("Z", 0x5A);
 | 
			
		||||
		public static VKeyCode Interpunct => new("Interpunct", 0x33);
 | 
			
		||||
		public static VKeyCode Cedilla => new("Cedilla", 0xBF);
 | 
			
		||||
		public static VKeyCode AccentOpen => new("Accent Open", 0xBA);
 | 
			
		||||
		public static VKeyCode AccentClosed => new("Accent Closed", 0xDE);
 | 
			
		||||
		public static VKeyCode Shift => new("Shift", 0x10);
 | 
			
		||||
 | 
			
		||||
		private VKeyCode(string name, int value) : base(name, value) { }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										3
									
								
								Assets/Scripts/Domain/Input/VKeyCode.cs.meta
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								Assets/Scripts/Domain/Input/VKeyCode.cs.meta
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
fileFormatVersion: 2
 | 
			
		||||
guid: 26d2a6386e9140e9a9afb79b32140e3b
 | 
			
		||||
timeCreated: 1713367740
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue