Fix input source description.

This commit is contained in:
2022-10-08 16:01:58 +08:00
parent e7e4b36b4c
commit 83fdf3bbeb
4 changed files with 9 additions and 6 deletions

View File

@@ -39,6 +39,9 @@ namespace Cryville.Common.Unity.Input {
public override int GetHashCode() {
return Handler.GetHashCode() ^ Type;
}
public override string ToString() {
return string.Format("{0}:{1}", ReflectionHelper.GetSimpleName(Handler.GetType()), Handler.GetTypeName(Type));
}
public static bool operator ==(InputSource lhs, InputSource rhs) {
return lhs.Equals(rhs);
}

View File

@@ -85,10 +85,10 @@ namespace Cryville.Common.Unity.Input {
public class UnityMouseButtonReceiver : UnityKeyReceiver<UnityMouseButtonReceiver> {
public override string GetKeyName(int type) {
switch (type) {
case 0: return "Left";
case 1: return "Right";
case 2: return "Middle";
default: return string.Format("Button {0}", type);
case 0: return "Mouse Left";
case 1: return "Mouse Right";
case 2: return "Mouse Middle";
default: return string.Format("Mouse Button {0}", type);
}
}
void OnGUI() {

View File

@@ -39,7 +39,7 @@ namespace Cryville.Common.Unity.Input {
public override string GetTypeName(int type) {
switch (type) {
case 0: return "Unity Mouse";
case 0: return "Mouse Position";
default: throw new ArgumentOutOfRangeException(nameof(type));
}
}

View File

@@ -39,7 +39,7 @@ namespace Cryville.Common.Unity.Input {
public override string GetTypeName(int type) {
switch (type) {
case 0: return "Unity Touch";
case 0: return "Touch";
default: throw new ArgumentOutOfRangeException(nameof(type));
}
}