/// <summary> /// Create a new <see cref="Keybinding"/> from a network model. /// </summary> public Keybinding(ulong owner, NetworkBinding networkBinding) { Owner = owner; InputActionId = networkBinding.InputActionId; DeviceEnum00 = networkBinding.DeviceEnum00; DeviceEnum01 = networkBinding.DeviceEnum01; DeviceEnum02 = networkBinding.DeviceEnum02; Code00 = networkBinding.Code00; Code01 = networkBinding.Code01; Code02 = networkBinding.Code02; MetaKeys00 = networkBinding.MetaKeys00; MetaKeys01 = networkBinding.MetaKeys01; MetaKeys02 = networkBinding.MetaKeys02; EventTypeEnum00 = networkBinding.EventTypeEnum00; EventTypeEnum01 = networkBinding.EventTypeEnum01; EventTypeEnum02 = networkBinding.EventTypeEnum02; saveMask = BindingSaveMask.Create; }
private NetworkBinding BuildNetworkBinding(Keybinding binding) { var networkBinding = new NetworkBinding { InputActionId = binding.InputActionId, DeviceEnum00 = binding.DeviceEnum00, DeviceEnum01 = binding.DeviceEnum01, DeviceEnum02 = binding.DeviceEnum02, Code00 = binding.Code00, Code01 = binding.Code01, Code02 = binding.Code02, MetaKeys00 = binding.MetaKeys00, MetaKeys01 = binding.MetaKeys01, MetaKeys02 = binding.MetaKeys02, EventTypeEnum00 = binding.EventTypeEnum00, EventTypeEnum01 = binding.EventTypeEnum01, EventTypeEnum02 = binding.EventTypeEnum02 }; return(networkBinding); }
/// <summary> /// Update <see cref="Keybinding"/> with information from supplied <see cref="NetworkBinding"/> from client. /// </summary> public void Update(NetworkBinding networkBinding) { if (DeviceEnum00 != networkBinding.DeviceEnum00) { DeviceEnum00 = networkBinding.DeviceEnum00; saveMask |= BindingSaveMask.DeviceEnum00; } if (DeviceEnum01 != networkBinding.DeviceEnum01) { DeviceEnum01 = networkBinding.DeviceEnum01; saveMask |= BindingSaveMask.DeviceEnum01; } if (DeviceEnum02 != networkBinding.DeviceEnum02) { DeviceEnum02 = networkBinding.DeviceEnum02; saveMask |= BindingSaveMask.DeviceEnum02; } if (Code00 != networkBinding.Code00) { Code00 = networkBinding.Code00; saveMask |= BindingSaveMask.Code00; } if (Code01 != networkBinding.Code01) { Code01 = networkBinding.Code01; saveMask |= BindingSaveMask.Code01; } if (Code02 != networkBinding.Code02) { Code02 = networkBinding.Code02; saveMask |= BindingSaveMask.Code02; } if (MetaKeys00 != networkBinding.MetaKeys00) { MetaKeys00 = networkBinding.MetaKeys00; saveMask |= BindingSaveMask.MetaKeys00; } if (MetaKeys01 != networkBinding.MetaKeys01) { MetaKeys01 = networkBinding.MetaKeys01; saveMask |= BindingSaveMask.MetaKeys01; } if (MetaKeys02 != networkBinding.MetaKeys02) { MetaKeys02 = networkBinding.MetaKeys02; saveMask |= BindingSaveMask.MetaKeys02; } if (EventTypeEnum00 != networkBinding.EventTypeEnum00) { EventTypeEnum00 = networkBinding.EventTypeEnum00; saveMask |= BindingSaveMask.EventTypeEnum00; } if (EventTypeEnum01 != networkBinding.EventTypeEnum01) { EventTypeEnum01 = networkBinding.EventTypeEnum01; saveMask |= BindingSaveMask.EventTypeEnum01; } if (EventTypeEnum02 != networkBinding.EventTypeEnum02) { EventTypeEnum02 = networkBinding.EventTypeEnum02; saveMask |= BindingSaveMask.EventTypeEnum02; } }