Exemplo n.º 1
0
 protected override void ClientItemHotbarSelectionChanged(ClientHotbarItemData data)
 {
     if (!data.IsSelected)
     {
         ConstructionPlacementSystem.ClientDisableConstructionPlacement();
     }
 }
Exemplo n.º 2
0
        protected override void ClientItemHotbarSelectionChanged(ClientHotbarItemData data)
        {
            var item = data.Item;

            if (data.IsSelected)
            {
                // ReSharper disable once CanExtractXamlLocalizableStringCSharp
                this.helperInputListener = ClientInputContext
                                           .Start("Current light item refill action listener")
                                           .HandleButtonDown(
                    GameButton.ItemReload,
                    ItemFuelRefillSystem.Instance.ClientTryStartAction);

                if (!data.IsByPlayer)
                {
                    // it's automatic selection (player just logged in)
                    if (!TimeOfDaySystem.ClientIsInitialized)
                    {
                        Logger.Warning(nameof(TimeOfDaySystem) + " is not initialized - cannot enable a hand lamp");
                        return;
                    }

                    // don't enable the light automatically if it's not night
                    var isLightRequired = TimeOfDaySystem.IsNight;
                    Logger.Info(string.Format("Light auto selection! Time: {0:hh\\:mm}, is light required: {1}",
                                              TimeSpan.FromHours(TimeOfDaySystem.CurrentTimeOfDayHours),
                                              isLightRequired));

                    if (!isLightRequired)
                    {
                        return;
                    }
                }

                if (data.PrivateState.FuelAmount > 0)
                {
                    // have fuel - turn on automatically
                    this.ClientTrySetActiveState(item, setIsActive: true);
                }
                else
                {
                    this.ClientShowOutOfFuelNotification();
                }
            }
            else
            {
                this.helperInputListener?.Stop();
                this.helperInputListener = null;

                // deactivate the item automatically on the client side
                GetPublicState(item).IsActive = false;
                Logger.Info($"Item light deselected, light turns off: {item}");
                // no need to sync with the server - it will automatically notice that the selected hotbar item has been changed
                //this.ClientTrySetActiveState(data.Item, setIsActive: false);
            }
        }
Exemplo n.º 3
0
        protected override void ClientItemHotbarSelectionChanged(ClientHotbarItemData data)
        {
            if (data.IsSelected &&
                this.ObjectExplosiveProto.IsActivatesRaidModeForLandClaim)
            {
                RaidingProtectionSystem.ClientShowNotificationRaidingNotAvailableIfNecessary();
            }

            ClientExplosivePlacerHelper.Setup(data.Item, data.IsSelected);
        }
Exemplo n.º 4
0
 protected override void ClientItemHotbarSelectionChanged(ClientHotbarItemData data)
 {
     if (data.IsSelected)
     {
         // ReSharper disable once CanExtractXamlLocalizableStringCSharp
         this.helperInputListener = ClientInputContext
                                    .Start("Current empty bottle item")
                                    .HandleButtonDown(
             GameButton.ItemReload,
             BottleRefillSystem.Instance.ClientTryStartAction);
     }
     else
     {
         this.helperInputListener?.Stop();
         this.helperInputListener = null;
     }
 }
Exemplo n.º 5
0
 protected override void ClientItemHotbarSelectionChanged(ClientHotbarItemData data)
 {
     if (data.IsSelected)
     {
         // ReSharper disable once CanExtractXamlLocalizableStringCSharp
         this.helperInputListener = ClientInputContext
                                    .Start("Current fishing rod item reloading")
                                    .HandleButtonDown(
                                        GameButton.ItemReload,
                                        FishingBaitReloadingSystem.ClientTrySwitchBaitType)
                                    .HandleButtonDown(
                                        GameButton.ItemSwitchMode,
                                        FishingBaitReloadingSystem.ClientTrySwitchBaitType);
     }
     else
     {
         this.helperInputListener?.Stop();
         this.helperInputListener = null;
     }
 }
Exemplo n.º 6
0
 protected virtual void ClientItemHotbarSelectionChanged(ClientHotbarItemData data)
 {
 }
Exemplo n.º 7
0
 protected override void ClientItemHotbarSelectionChanged(ClientHotbarItemData data)
 {
     ClientSeedPlacerHelper.Setup(data.Item, data.IsSelected);
 }