Exemple #1
0
        bool HandleLeftClick(ProductionItem item, ProductionIcon icon, int handleCount)
        {
            if (PickUpCompletedBuildingIcon(icon, item))
            {
                Game.Sound.Play(SoundType.UI, TabClick);
                return(true);
            }

            if (item != null && item.Paused)
            {
                // Resume a paused item
                Game.Sound.Play(SoundType.UI, TabClick);
                World.IssueOrder(Order.PauseProduction(CurrentQueue.Actor, icon.Name, false));
                return(true);
            }

            var buildable = CurrentQueue.BuildableItems().FirstOrDefault(a => a.Name == icon.Name);

            if (buildable != null)
            {
                // Queue a new item
                Game.Sound.Play(SoundType.UI, TabClick);
                string notification;
                var    canQueue = CurrentQueue.CanQueue(buildable, out notification);
                Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", notification, World.LocalPlayer.Faction.InternalName);

                if (canQueue)
                {
                    World.IssueOrder(Order.StartProduction(CurrentQueue.Actor, icon.Name, handleCount));
                    return(true);
                }
            }

            return(false);
        }
        bool HandleLeftClick(ProductionItem item, ProductionIcon icon, int handleCount, Modifiers modifiers)
        {
            if (PickUpCompletedBuildingIcon(icon, item))
            {
                Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Sounds", ClickSound, null);
                return(true);
            }

            if (item != null && item.Paused)
            {
                // Resume a paused item
                Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Sounds", ClickSound, null);
                Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, World.LocalPlayer.Faction.InternalName);
                World.IssueOrder(Order.PauseProduction(CurrentQueue.Actor, icon.Name, false));
                return(true);
            }

            var buildable = CurrentQueue.BuildableItems().FirstOrDefault(a => a.Name == icon.Name);

            if (buildable != null)
            {
                // Queue a new item
                Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Sounds", ClickSound, null);
                string notification;
                var    canQueue = CurrentQueue.CanQueue(buildable, out notification);

                if (!CurrentQueue.AllQueued().Any())
                {
                    Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", notification, World.LocalPlayer.Faction.InternalName);
                }

                if (canQueue)
                {
                    var queued = !modifiers.HasModifier(Modifiers.Ctrl);
                    World.IssueOrder(Order.StartProduction(CurrentQueue.Actor, icon.Name, handleCount, queued));
                    return(true);
                }
            }

            return(false);
        }