protected override void OnEnable() { this.publicState = ClientCurrentCharacterHelper.PublicState; ClientHotbarSelectedItemManager.Init(); this.clientInputContext = ClientInputContext.Start(nameof(ClientComponentWorldCameraZoomManager)) .HandleAll(() => { if (!IsUsingMouseWheelInputToScrollHotbar || WindowsManager.OpenedWindowsCount > 0) { return; } var delta = Input.MouseScrollDeltaValue; if (delta == 0) { return; } if (IsMouseWheelReversedDirection) { delta *= -1; } ClientHotbarSelectedItemManager.SelectNextSlot( indexDelta: (int)Math.Round( delta, MidpointRounding.AwayFromZero)); }); }
private static void ClientEnsureConstructionToolIsSelected() { var activeItem = ClientHotbarSelectedItemManager.SelectedItem; if (activeItem?.ProtoItem is IProtoItemToolToolbox) { // tool is selected return; } var itemTool = (from item in ClientHotbarSelectedItemManager.ContainerHotbar.Items let protoToolbox = item.ProtoItem as IProtoItemToolToolbox where protoToolbox != null // find best tool orderby protoToolbox.ConstructionSpeedMultiplier descending, item.ContainerSlotId ascending select item).FirstOrDefault(); if (itemTool == null) { throw new Exception("Cannot build - the required tool is not available in the hotbar"); } ClientHotbarSelectedItemManager.Select(itemTool); }
public override void Update(double deltaTime) { this.ProcessInputUpdate(); ClientHotbarSelectedItemManager.Update(); }