本文整理汇总了C#中Key类的典型用法代码示例。如果您正苦于以下问题:C# Key类的具体用法?C# Key怎么用?C# Key使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Key类属于命名空间,在下文中一共展示了Key类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ControlHandle
public override void ControlHandle(Key k)
{
switch (k)
{
case Key.Up:
if (option > 0) option--;
if (topRow > option) topRow--;
break;
case Key.Down:
if (option < Materiatory.MATERIATORY_SIZE - 1) option++;
if (topRow < option - rows + 1) topRow++;
break;
case Key.X:
if (trashing)
{
MenuState.MateriaScreen.ChangeControl(MenuState.MateriaArrange);
}
else
{
MenuState.MateriaScreen.ChangeToDefaultControl();
}
trashing = false;
break;
case Key.Circle:
if (Trashing)
{
MenuState.MateriaScreen.ChangeControl(MenuState.MateriaPrompt);
break;
}
MateriaOrb neworb = MenuState.Party.Materiatory.Get(option);
MateriaOrb oldorb;
switch (MenuState.MateriaTop.OptionY)
{
case 0:
oldorb = MenuState.Party.Selected.Weapon.Slots[MenuState.MateriaTop.OptionX];
if (oldorb != null)
oldorb.Detach(MenuState.Party.Selected);
MenuState.Party.Materiatory.Put(oldorb, option);
if (neworb != null)
neworb.Attach(MenuState.Party.Selected);
MenuState.Party.Selected.Weapon.AttachMateria(neworb, MenuState.MateriaTop.OptionX);
MenuState.MateriaScreen.ChangeToDefaultControl();
break;
case 1:
oldorb = MenuState.Party.Selected.Armor.Slots[MenuState.MateriaTop.OptionX];
if (oldorb != null)
oldorb.Detach(MenuState.Party.Selected);
MenuState.Party.Materiatory.Put(oldorb, option);
if (neworb != null)
neworb.Attach(MenuState.Party.Selected);
MenuState.Party.Selected.Armor.AttachMateria(neworb, MenuState.MateriaTop.OptionX);
MenuState.MateriaScreen.ChangeToDefaultControl();
break;
default: break;
}
break;
default:
break;
}
}
开发者ID:skinitimski,项目名称:Reverence,代码行数:60,代码来源:List.cs
示例2: WasKeyReleased
public bool WasKeyReleased(Key key)
{
var previouseMouseButtonState = _previousKeyboardState[key];
var currentMouseButtonState = _currentKeyboardState[key];
return previouseMouseButtonState && !currentMouseButtonState;
}
开发者ID:HaKDMoDz,项目名称:ProceduralGeneration,代码行数:7,代码来源:KeyboardInputProcessor.cs
示例3: RefreshData
void RefreshData()
{
_Key = null;
_Group = null;
groupKey.Visible = false;
}
开发者ID:gpanayir,项目名称:sffwk,代码行数:7,代码来源:UCKey.cs
示例4: CreateKeyEventArgs
protected static KeyEventArgs CreateKeyEventArgs(
Key key,
ModifierKeys modKeys = ModifierKeys.None)
{
var device = new MockKeyboardDevice(InputManager.Current) { ModifierKeysImpl = modKeys };
return device.CreateKeyEventArgs(key, modKeys);
}
开发者ID:Kazark,项目名称:VsVim,代码行数:7,代码来源:VimKeyProcessorTest.cs
示例5: ColumnName
public void ColumnName()
{
var x = new Key();
Assert.IsNull(x.ColumnFamily);
Assert.IsNull(x.ColumnQualifier);
Assert.IsNull(x.Column);
x = new Key { ColumnFamily = "CF" };
Assert.AreEqual("CF", x.ColumnFamily);
Assert.IsNull(x.ColumnQualifier);
Assert.AreEqual("CF", x.Column);
x = new Key { ColumnFamily = "CF", ColumnQualifier = "CQ" };
Assert.AreEqual("CF", x.ColumnFamily);
Assert.AreEqual("CQ", x.ColumnQualifier);
Assert.AreEqual("CF:CQ", x.Column);
x = new Key { Column = "CF" };
Assert.AreEqual("CF", x.ColumnFamily);
Assert.IsNull(x.ColumnQualifier);
Assert.AreEqual("CF", x.Column);
x = new Key { Column = "CF:CQ" };
Assert.AreEqual("CF", x.ColumnFamily);
Assert.AreEqual("CQ", x.ColumnQualifier);
Assert.AreEqual("CF:CQ", x.Column);
}
开发者ID:andysoftdev,项目名称:ht4n,代码行数:27,代码来源:TestKey.cs
示例6: KeyUp
public void KeyUp(Key key)
{
if (key == Key.Space)
{
SpaceCraft.SetThrottle(0);
SpaceCraft.Stage();
}
if (key == Key.X)
{
SpaceCraft.SetThrottle(0);
}
if (key == Key.Z)
{
SpaceCraft.SetThrottle(100);
}
if (key == Key.Q && !IsRetrograde)
{
IsPrograde = !IsPrograde;
}
if (key == Key.W && !IsPrograde)
{
IsRetrograde = !IsRetrograde;
}
}
开发者ID:rdancer,项目名称:SpaceSim,代码行数:29,代码来源:SimpleFlightController.cs
示例7: KeyboardState
public KeyboardState( params Key [] keys )
: this()
{
PressedKeys = new Key [ keys.Length ];
for ( int i = 0; i < keys.Length; i++ )
PressedKeys [ i ] = keys [ i ];
}
开发者ID:Daramkun,项目名称:Misty,代码行数:7,代码来源:KeyboardState.cs
示例8: TryGetToken
public override bool TryGetToken(EndpointAddress target, EndpointAddress issuer, out GenericXmlSecurityToken cachedToken)
{
if (target == null)
{
throw new ArgumentNullException("target");
}
cachedToken = null;
lock (thisLock)
{
GenericXmlSecurityToken tmp;
Key key = new Key(target.Uri, issuer == null ? null : issuer.Uri);
if (this.cache.TryGetValue(key, out tmp))
{
// if the cached token is going to expire soon, remove it from the cache and return a cache miss
if (tmp.ValidTo < DateTime.UtcNow + TimeSpan.FromMinutes(1))
{
this.cache.Remove(key);
OnTokenRemoved(key);
}
else
{
cachedToken = tmp;
}
}
}
return (cachedToken != null);
}
开发者ID:ssickles,项目名称:archive,代码行数:27,代码来源:IssuedTokenCache.cs
示例9: IconButton
public IconButton(IGameWindow window, Camera<OrthographicProjection> camera, Vector2 position, IRenderable renderable, Key? hotkey = null)
: base(window, camera, position)
{
Renderable = renderable;
IsSelected = false;
Hotkey = hotkey;
}
开发者ID:treytomes,项目名称:ASCIIWorld2,代码行数:7,代码来源:IconButton.cs
示例10: DomainEvent
public DomainEvent()
{
//AggregateRootId = aggregateRootId;
//EventVersion = version;
EventState = EventState.Sequence;
Key = new Key { KeyName = this.GetType().Name };
}
开发者ID:ryzam,项目名称:Vaccine-CQRS,代码行数:7,代码来源:DomainEvent.cs
示例11: NesVSUnisystemDIPKeyboardConnection
public NesVSUnisystemDIPKeyboardConnection(IntPtr handle, IInputSettingsVSUnisystemDIP settings)
{
DirectInput di = new DirectInput();
keyboard = new Keyboard(di);
keyboard.SetCooperativeLevel(handle, CooperativeLevel.Nonexclusive | CooperativeLevel.Foreground);
if (settings.CreditServiceButton != "")
CreditServiceButton = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.CreditServiceButton);
if (settings.DIPSwitch1 != "")
DIPSwitch1 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch1);
if (settings.DIPSwitch2 != "")
DIPSwitch2 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch2);
if (settings.DIPSwitch3 != "")
DIPSwitch3 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch3);
if (settings.DIPSwitch4 != "")
DIPSwitch4 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch4);
if (settings.DIPSwitch5 != "")
DIPSwitch5 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch5);
if (settings.DIPSwitch6 != "")
DIPSwitch6 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch6);
if (settings.DIPSwitch7 != "")
DIPSwitch7 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch7);
if (settings.DIPSwitch8 != "")
DIPSwitch8 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch8);
if (settings.CreditLeftCoinSlot != "")
CreditLeftCoinSlot = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.CreditLeftCoinSlot);
if (settings.CreditRightCoinSlot != "")
CreditRightCoinSlot = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.CreditRightCoinSlot);
NesEmu.EMUShutdown += NesEmu_EMUShutdown;
}
开发者ID:Blizz9,项目名称:FanCut,代码行数:30,代码来源:NesVSUnisystemDIPKeyboardConnection.cs
示例12: KeyEventArgs
public KeyEventArgs (KeyboardDevice keyboard, PresentationSource inputSource,
int timestamp, Key key)
: base (keyboard, timestamp)
{
this.inputSource = inputSource;
this.key = key;
}
开发者ID:alesliehughes,项目名称:olive,代码行数:7,代码来源:KeyEventArgs.cs
示例13: The_Corresponding_Relationship_Should_Also_Have_The_Column_Removed
public void The_Corresponding_Relationship_Should_Also_Have_The_Column_Removed()
{
// Create database and relationships
Database db = RelationshipDatabaseLoader.GetDb();
Relationship relationship = db.Tables[1].Relationships[0];
Assert.That(relationship.PrimaryKey, Is.SameAs(db.Tables[0].Keys[0]));
Assert.That(relationship.ForeignKey, Is.SameAs(db.Tables[1].Keys[0]));
Assert.That(relationship.PrimaryKey.Columns[0].Name, Is.EqualTo("Column1"));
Assert.That(relationship.PrimaryKey.Columns[1].Name, Is.EqualTo("Column2"));
IKey originalKey = db.Tables[1].Keys[0];
IKey newKey = new Key(originalKey.Name, originalKey.Keytype);
newKey.Parent = new Table("Table2");
newKey.Parent.AddColumn(new Column("Column2"));
newKey.Description = "new description";
newKey.AddColumn("Column2");
KeyChangeOperation op = new KeyChangeOperation(db.Tables[1].Keys[0], newKey);
op.RunOperation();
op.RunSecondStep();
// Make sure the relationship is still the same, and has the same references.
Relationship relationship2 = db.Tables[1].Relationships[0];
Assert.That(relationship2, Is.SameAs(relationship));
Assert.That(relationship2.PrimaryKey, Is.SameAs(db.Tables[0].Keys[0]));
Assert.That(relationship2.ForeignKey, Is.SameAs(db.Tables[1].Keys[0]));
Assert.That(relationship2.PrimaryKey.Columns, Has.Count(2));
Assert.That(relationship2.ForeignKey.Columns, Has.Count(1));
Assert.That(relationship2.ForeignKey.Columns[0].Name, Is.EqualTo("Column2"));
}
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:32,代码来源:Specs_For_Merging_Databases_Relationships.cs
示例14: PlayerViewModel
public PlayerViewModel(string name, Key key, int allowedShots)
{
Name = name;
Key = key;
AllowedShots = allowedShots;
scores = new Dictionary<string, int>();
}
开发者ID:anyhotcountry,项目名称:YouthClubApp,代码行数:7,代码来源:PlayerViewModel.cs
示例15: AThresholdGesture
/// <summary>
///
/// </summary>
/// <param name="jointType"></param>
/// <param name="threshold"></param>
/// <param name="comparator"></param>
/// <param name="name"></param>
/// <param name="key"></param>
protected AThresholdGesture(JointType jointType, double threshold, ThresholdComparator comparator, string name, Key key)
: base(name, key)
{
this.jointType = jointType;
this.threshold = threshold;
this.comparator = comparator;
}
开发者ID:zeromeus,项目名称:gest_tracker,代码行数:15,代码来源:AThresholdGesture.cs
示例16: CacheEntry
public CacheEntry(Key key, QrFactorization qrFactorization)
{
Key = key;
QrFactorization = qrFactorization;
MatrixCrossproduct = ImmutableMatrix.OfMatrix(ComputeMatrixCrossproduct(key.Matrix, qrFactorization.IndependentColumnIndexes));
MatrixCrossproductInverse = ImmutableMatrix.OfMatrix(MatrixCrossproduct.Inverse());
}
开发者ID:AlexandreBurel,项目名称:pwiz-mzdb,代码行数:7,代码来源:QrFactorizationCache.cs
示例17: StoreDataCommand
public StoreDataCommand(Key key, object objectToBeStored, DateTime expiry)
: base(key)
{
this.expiry = expiry;
if (objectToBeStored is int)
{
this.objType = StoredObjectType.IntCounter;
dataToBeStored = Encoding.UTF8.GetBytes(objectToBeStored.ToString());
}
else if (objectToBeStored is uint)
{
this.objType = StoredObjectType.UIntCounter;
dataToBeStored = Encoding.UTF8.GetBytes(objectToBeStored.ToString());
}
else if (objectToBeStored is long)
{
this.objType = StoredObjectType.LongCounter;
dataToBeStored = Encoding.UTF8.GetBytes(objectToBeStored.ToString());
}
else
{
this.objType = StoredObjectType.SerializableObject;
using (MemoryStream ms = new MemoryStream())
{
new BinaryFormatter().Serialize(ms, objectToBeStored);
dataToBeStored = new byte[ms.Length];
Array.Copy(ms.GetBuffer(), dataToBeStored, dataToBeStored.Length);
}
}
}
开发者ID:davelondon,项目名称:dontstayin,代码行数:30,代码来源:StoreDataCommand.cs
示例18: OnKeyPressed
protected override bool OnKeyPressed(Key key, char? character, bool repeat)
{
if (Shortcut == null || repeat || Shortcut != key)
return false;
Clicked.Raise();
return true;
}
开发者ID:ndech,项目名称:Alpha,代码行数:7,代码来源:IconButton.cs
示例19: GetCharFromKey
public static char GetCharFromKey(Key key)
{
char ch = ' ';
int virtualKey = KeyInterop.VirtualKeyFromKey(key);
byte[] keyboardState = new byte[256];
GetKeyboardState(keyboardState);
uint scanCode = MapVirtualKey((uint)virtualKey, MapType.MAPVK_VK_TO_VSC);
StringBuilder stringBuilder = new StringBuilder(2);
int result = ToUnicode((uint)virtualKey, scanCode, keyboardState, stringBuilder, stringBuilder.Capacity, 0);
switch (result)
{
case -1:
break;
case 0:
break;
case 1:
{
ch = stringBuilder[0];
break;
}
default:
{
ch = stringBuilder[0];
break;
}
}
return ch;
}
开发者ID:ssboisen,项目名称:presentations,代码行数:31,代码来源:CharUtil.cs
示例20: SceneGameOver
public SceneGameOver()
{
sceneType = SceneType.GameOver;
_menuItems = new MenuItem[]
{
new MenuItem(Key.R, Properties.Resources.MenuItem_RetryStage),
new MenuItem(Key.M, Properties.Resources.MenuItem_MapSelect),
new MenuItem(Key.T, Properties.Resources.MenuItem_ReturnTitle)
};
_keys = new Key[]
{
Key.UpArrow, Key.DownArrow, Key.Return, Key.Escape,
Key.M, Key.R, Key.T
};
_cursor = ResourceManager.GetColoredCursorGraphic(_foreColor);
_overImgSurface = ResourceManager.LoadSurface(Constants.Filename_GameoverImage);
ImageUtil.SetColor(_overImgSurface, _foreColor);
_menuSurfaces = new SurfaceCollection();
_menuRects = new Rectangle[_menuItems.Length];
ImageUtil.CreateStrMenu(_menuItems, _foreColor, ref _menuSurfaces, ref _menuRects, Constants.ScreenWidth);
}
开发者ID:davinx,项目名称:PitchPitch,代码行数:26,代码来源:SceneGameOver.cs
注:本文中的Key类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论