Skip to content

Commit bfb700a

Browse files
committed
Add alt, ctrl, shift input combination functions.
1 parent 858d014 commit bfb700a

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

Assets/JCSUnity/Scripts/Input/JCS_Input.cs

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,6 @@ public static bool AllJoystickKeysDown(
14931493
return true;
14941494
}
14951495

1496-
14971496
/// <summary>
14981497
/// Check all of these key are up.
14991498
///
@@ -1921,6 +1920,58 @@ public static bool GetKeyUpWithAltShift(KeyCode key)
19211920
}
19221921
#endregion
19231922

1923+
#region ALT_CTRL_SHIFT
1924+
1925+
/// <summary>
1926+
/// Check if the 'key', alt, shift and ctrl key is pressed.
1927+
/// </summary>
1928+
/// <param name="key"> key to check if pressed together. </param>
1929+
/// <returns>
1930+
/// true, key, alt, shift and ctrl key is all pressed.
1931+
/// false, either alt, shift, ctrl, or key is not pressed.
1932+
/// </returns>
1933+
public static bool GetKeyWithAltCtrlShift(KeyCode key)
1934+
{
1935+
if (!OneAltKey() || !OneShiftKey() || !OneCtrlKey())
1936+
return false;
1937+
1938+
return GetKey(key);
1939+
}
1940+
1941+
/// <summary>
1942+
/// Check if the 'key', alt, shift and ctrl key is down.
1943+
/// </summary>
1944+
/// <param name="key"> key to check if down together. </param>
1945+
/// <returns>
1946+
/// true, key, alt, shift and ctrl key is all down.
1947+
/// false, either alt, shift, ctrl, or key is not down.
1948+
/// </returns>
1949+
public static bool GetKeyDownWithAltCtrlShift(KeyCode key)
1950+
{
1951+
if (!OneAltKey() || !OneShiftKey() || !OneCtrlKey())
1952+
return false;
1953+
1954+
return GetKeyDown(key);
1955+
}
1956+
1957+
/// <summary>
1958+
/// Check if the 'key', alt, shift and ctrl key is up.
1959+
/// </summary>
1960+
/// <param name="key"> key to check if down together. </param>
1961+
/// <returns>
1962+
/// true, key, alt, shift and ctrl key is all up.
1963+
/// false, either alt, shift, ctrl, or key is not up.
1964+
/// </returns>
1965+
public static bool GetKeyUpWithAltCtrlShift(KeyCode key)
1966+
{
1967+
if (!OneAltKey() || !OneShiftKey() || !OneCtrlKey())
1968+
return false;
1969+
1970+
return GetKeyUp(key);
1971+
}
1972+
1973+
#endregion
1974+
19241975
/// <summary>
19251976
/// Get key with certain combination.
19261977
/// </summary>
@@ -1946,6 +1997,8 @@ public static bool GetKeyWith(JCS_KeyCombination comb, KeyCode key)
19461997
return GetKeyWithAltShift(key);
19471998
case JCS_KeyCombination.CTRL_SHIFT:
19481999
return GetKeyWithCtrlShift(key);
2000+
case JCS_KeyCombination.ALT_CTRL_SHIFT:
2001+
return GetKeyWithAltCtrlShift(key);
19492002
}
19502003

19512004
// Just return normal get key.
@@ -1977,6 +2030,8 @@ public static bool GetKeyDownWith(JCS_KeyCombination comb, KeyCode key)
19772030
return GetKeyDownWithAltShift(key);
19782031
case JCS_KeyCombination.CTRL_SHIFT:
19792032
return GetKeyDownWithCtrlShift(key);
2033+
case JCS_KeyCombination.ALT_CTRL_SHIFT:
2034+
return GetKeyDownWithAltCtrlShift(key);
19802035
}
19812036

19822037
// Just return normal get key.
@@ -2008,6 +2063,8 @@ public static bool GetKeyUpWith(JCS_KeyCombination comb, KeyCode key)
20082063
return GetKeyUpWithAltShift(key);
20092064
case JCS_KeyCombination.CTRL_SHIFT:
20102065
return GetKeyUpWithCtrlShift(key);
2066+
case JCS_KeyCombination.ALT_CTRL_SHIFT:
2067+
return GetKeyUpWithAltCtrlShift(key);
20112068
}
20122069

20132070
// Just return normal get key.

0 commit comments

Comments
 (0)