public void Change(Packet iPacket) { int mode = iPacket.ReadInt(); int count = iPacket.ReadInt(); switch (mode) { case 0: if (count == 0) { return; } for (int i = 0; i < count; i++) { KeyMapConstants.KeymapKey key = (KeyMapConstants.KeymapKey)iPacket.ReadInt(); KeyMapConstants.KeymapType type = (KeyMapConstants.KeymapType)iPacket.ReadByte(); KeyMapConstants.KeymapAction action = (KeyMapConstants.KeymapAction)iPacket.ReadInt(); if (Contains(key)) { if (type == KeyMapConstants.KeymapType.None) { Remove(key); } else { this[key].Type = type; this[key].Action = action; } } else { Add(new Shortcut(key, action, type)); } } break; case 1: break; case 2: break; } }
public Shortcut(KeyMapConstants.KeymapKey key, KeyMapConstants.KeymapAction action, KeyMapConstants.KeymapType type = KeyMapConstants.KeymapType.None) { Key = key; Type = type == KeyMapConstants.KeymapType.None ? GetTypeFromAction(action) : type; Action = action; }