コード例 #1
0
 public AccountsFactory(IAccountsRepository accountsRepository, IInputHelper inputHelper,
                        IConsoleHelper consoleHelper)
 {
     _accountsRepository = accountsRepository;
     _inputHelper        = inputHelper;
     _consoleHelper      = consoleHelper;
 }
コード例 #2
0
        internal override void OnInitialization()
        {
            base.OnInitialization();

            _helper = Helper as IInputHelper;
            _helper.LoadDevice(InputDeviceType);
        }
コード例 #3
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="config">The data layer settings.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        /// <param name="input">The API for checking input state.</param>
        /// <param name="monitor">Writes messages to the SMAPI log.</param>
        public SprinklerLayer(LayerConfig config, ModIntegrations mods, IInputHelper input, IMonitor monitor)
            : base(I18n.Sprinklers_Name(), config, input, monitor)
        {
            // init
            this.Mods   = mods;
            this.Legend = new[]
            {
                this.Wet = new LegendEntry(I18n.Keys.Sprinklers_Covered, Color.Green),
                this.Dry = new LegendEntry(I18n.Keys.Sprinklers_DryCrops, Color.Red)
            };

            // get static sprinkler coverage
            this.StaticTilesBySprinklerID = this.GetStaticSprinklerTiles(mods);

            // get max sprinkler radius
            this.MaxRadius = this.StaticTilesBySprinklerID.Max(p => this.GetMaxRadius(p.Value));
            if (mods.BetterSprinklers.IsLoaded)
            {
                this.MaxRadius = Math.Max(this.MaxRadius, mods.BetterSprinklers.MaxRadius);
            }
            if (mods.LineSprinklers.IsLoaded)
            {
                this.MaxRadius = Math.Max(this.MaxRadius, mods.LineSprinklers.MaxRadius);
            }
        }
コード例 #4
0
        internal override void OnInitialization()
        {
            base.OnInitialization();

            _helper = Helper as IInputHelper;

            //加载输入设备
            Type type = ReflectionToolkit.GetTypeInRunTimeAssemblies(InputDeviceType);

            if (type != null)
            {
                if (type.IsSubclassOf(typeof(InputDeviceBase)))
                {
                    _inputDevice = Activator.CreateInstance(type) as InputDeviceBase;
                }
                else
                {
                    throw new HTFrameworkException(HTFrameworkModule.Input, "加载输入设备失败:输入设备类 " + InputDeviceType + " 必须继承至输入设备基类:InputDeviceBase!");
                }
            }
            else
            {
                throw new HTFrameworkException(HTFrameworkModule.Input, "加载输入设备失败:丢失输入设备类 " + InputDeviceType + "!");
            }
        }
コード例 #5
0
 public NpcCheckActionPatch(CompanionManager manager, IInputHelper input, Config config)
 {
     this.Manager = manager;
     this.Input   = input;
     this.Config  = config;
     Instance     = this;
 }
コード例 #6
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="events">The SMAPI events available for mods.</param>
 /// <param name="inputHelper">An API for checking and changing input state.</param>
 /// <param name="contentHelper">The content helper from which to read textures.</param>
 /// <param name="reflection">Simplifies access to private code.</param>
 public DebugOverlay(IModEvents events, IInputHelper inputHelper, IGameContentHelper contentHelper, IReflectionHelper reflection)
     : base(events, inputHelper, reflection)
 {
     this.Content      = contentHelper;
     this.TextureNames = this.GetTextureNames(contentHelper).OrderByHuman(p => p.Name).ToArray();
     this.NextTexture();
 }
コード例 #7
0
ファイル: MapperTests.cs プロジェクト: rabail/InventoryApi
        public void Setup()
        {
            schedule = new InventoryModel
            {
                AllowedArrivalDays = new InventoryModel.Schedule
                {
                    Sunday    = true,
                    Monday    = true,
                    Tuesday   = true,
                    Wednesday = true,
                    Thursday  = true,
                    Friday    = true,
                    Saturday  = true
                },
                AllowedDepartureDays = new InventoryModel.Schedule
                {
                    Sunday    = true,
                    Monday    = true,
                    Tuesday   = true,
                    Wednesday = true,
                    Thursday  = true,
                    Friday    = true,
                    Saturday  = true
                }
            };

            helper = Substitute.For <IInputHelper>();
            helper.GetInputAsString().Returns(schedule);
        }
コード例 #8
0
        /*********
        ** Public methods
        *********/

        /// <inheritdoc />
        public override void Entry(IModHelper helper)
        {
            ReflectionHelper = helper.Reflection;
            EventsHelper     = helper.Events;
            InputHelper      = helper.Input;

            Config = helper.ReadConfig <ModConfig>();
            if (Config.Check(Monitor))
            {
                helper.WriteConfig(Config);
            }

            SetupTasks();

            helper.Events.GameLoop.ReturnedToTitle += GameLoop_ReturnedToTitle;
            helper.Events.GameLoop.SaveLoaded      += GameLoop_SaveLoaded;
            helper.Events.GameLoop.DayStarted      += GameLoop_DayStarted;

            // In-game Events
            helper.Events.Input.ButtonPressed += Input_ButtonPressed;
            helper.Events.Display.MenuChanged += Display_MenuChanged;
            SettingsMenu.ReportConfigChanged  += SettingsMenu_ReportConfigChanged;

            // Draw Events
            helper.Events.Display.RenderingHud += Display_RenderingHud;
        }
コード例 #9
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="events">The SMAPI events available for mods.</param>
 /// <param name="inputHelper">An API for checking and changing input state.</param>
 /// <param name="reflection">Simplifies access to private code.</param>
 /// <param name="locationKey">The unique key for the current location.</param>
 /// <param name="machineData">The machine groups to display.</param>
 /// <param name="junimoGroup">The machine group for machines connected to Junimo chests.</param>
 public OverlayMenu(IModEvents events, IInputHelper inputHelper, IReflectionHelper reflection, string locationKey, MachineDataForLocation?machineData, JunimoMachineGroup junimoGroup)
     : base(events, inputHelper, reflection)
 {
     this.LocationKey = locationKey;
     this.MachineData = machineData;
     this.JunimoGroup = junimoGroup;
 }
コード例 #10
0
ファイル: ModEntry.cs プロジェクト: somnomania/smapi-mod-dump
        /***************************
        ** Mod Injection Methods **
        ***************************/

        /// <summary>The mod entry point, called after the mod is first loaded.</summary>
        /// <param name="helper">Provides simplified APIs for writing mods.</param>
        public override void Entry(IModHelper helper)
        {
            try
            {
                myMonitor = this.Monitor;
                input     = helper.Input;

                ItemHints.str         = helper.Translation;
                ItemHints.modRegistry = helper.ModRegistry;
                ItemHints.Config      = helper.ReadConfig <ModConfig>();

                HarmonyInstance harmonyInstance = HarmonyInstance.Create(this.ModManifest.UniqueID);

                patchPostfix(harmonyInstance, typeof(JunimoNoteMenu), "setUpBundleSpecificPage",
                             typeof(ModEntry), nameof(ModEntry.Postfix_setUpBundleSpecificPage));

                patchPostfix(harmonyInstance, typeof(JunimoNoteMenu), "gameWindowSizeChanged",
                             typeof(ModEntry), nameof(ModEntry.Postfix_gameWindowSizeChanged));

                patchPostfix(harmonyInstance, typeof(JunimoNoteMenu), "draw",
                             typeof(ModEntry), nameof(ModEntry.Postfix_draw),
                             new Type[] { typeof(SpriteBatch) });
            }
            catch (Exception e)
            {
                Log("Error in mod setup: " + e.Message + Environment.NewLine + e.StackTrace);
            }
        }
コード例 #11
0
ファイル: BaseOverlay.cs プロジェクト: davidcw6/StardewValley
        /*********
        ** Protected methods
        *********/
        /****
        ** Implementation
        ****/
        /// <summary>Construct an instance.</summary>
        /// <param name="events">The SMAPI events available for mods.</param>
        /// <param name="inputHelper">An API for checking and changing input state.</param>
        /// <param name="reflection">Simplifies access to private code.</param>
        /// <param name="keepAlive">Indicates whether to keep the overlay active. If <c>null</c>, the overlay is kept until explicitly disposed.</param>
        /// <param name="assumeUiMode">The UI mode to use for pixel coordinates in <see cref="ReceiveLeftClick"/> and <see cref="ReceiveCursorHover"/>, or <c>null</c> to use the current UI mode at the time the event is raised.</param>
        protected BaseOverlay(IModEvents events, IInputHelper inputHelper, Func <bool> keepAlive = null, bool?assumeUiMode = true)
        {
            this.Events         = events;
            this.InputHelper    = inputHelper;
            this.KeepAliveCheck = keepAlive;
            this.LastViewport   = new Rectangle(Game1.uiViewport.X, Game1.uiViewport.Y, Game1.uiViewport.Width, Game1.uiViewport.Height);
            this.ScreenId       = Context.ScreenId;
            this.AssumeUiMode   = assumeUiMode;

            events.GameLoop.UpdateTicked += this.OnUpdateTicked;

            if (this.IsMethodOverridden(nameof(this.DrawUi)))
            {
                events.Display.Rendered += this.OnRendered;
            }
            if (this.IsMethodOverridden(nameof(this.DrawWorld)))
            {
                events.Display.RenderedWorld += this.OnRenderedWorld;
            }
            if (this.IsMethodOverridden(nameof(this.ReceiveButtonPress)) || this.IsMethodOverridden(nameof(this.ReceiveLeftClick)))
            {
                events.Input.ButtonPressed += this.OnButtonPressed;
            }
            if (this.IsMethodOverridden(nameof(this.ReceiveCursorHover)))
            {
                events.Input.CursorMoved += this.OnCursorMoved;
            }
            if (this.IsMethodOverridden(nameof(this.ReceiveScrollWheelAction)))
            {
                events.Input.MouseWheelScrolled += this.OnMouseWheelScrolled;
            }
        }
コード例 #12
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="events">The SMAPI events available for mods.</param>
 /// <param name="inputHelper">An API for checking and changing input state.</param>
 /// <param name="contentHelper">The content helper from which to read textures.</param>
 public DebugOverlay(IModEvents events, IInputHelper inputHelper, IContentHelper contentHelper)
     : base(events, inputHelper)
 {
     this.Content      = contentHelper;
     this.TextureNames = this.GetTextureNames(contentHelper).OrderByIgnoreCase(p => p).ToArray();
     this.NextTexture();
 }
コード例 #13
0
 /*********
 ** Public fields
 *********/
 /// <summary>Get a parsed representation of the configured controls.</summary>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">The monitor through which to log an error if a button value is invalid.</param>
 public ModConfigKeys ParseControls(IInputHelper input, IMonitor monitor)
 {
     return(new ModConfigKeys(
                shiftToPrevious: CommonHelper.ParseButtons(this.ShiftToPrevious, input, monitor, nameof(this.ShiftToPrevious)),
                shiftToNext: CommonHelper.ParseButtons(this.ShiftToNext, input, monitor, nameof(this.ShiftToNext))
                ));
 }
コード例 #14
0
ファイル: Magic.cs プロジェクト: Pathoschild/smapi-mod-dump
        /*********
        ** Public methods
        *********/
        public static void Init(IModEvents events, IInputHelper inputHelper, IModRegistry modRegistry, Func <long> getNewId)
        {
            Magic.InputHelper = inputHelper;

            Magic.LoadAssets();

            SpellManager.Init(getNewId);

            events.GameLoop.UpdateTicked += Magic.OnUpdateTicked;

            events.Input.ButtonPressed  += Magic.OnButtonPressed;
            events.Input.ButtonReleased += Magic.OnButtonReleased;

            events.GameLoop.TimeChanged += Magic.OnTimeChanged;
            events.Player.Warped        += Magic.OnWarped;

            SpaceEvents.OnItemEaten     += Magic.OnItemEaten;
            SpaceEvents.ActionActivated += Magic.ActionTriggered;
            Networking.RegisterMessageHandler(Magic.MsgCast, Magic.OnNetworkCast);

            events.Display.RenderingHud += Magic.OnRenderingHud;
            events.Display.RenderedHud  += Magic.OnRenderedHud;

            Magic.OnAnalyzeCast += (sender, e) => Mod.Instance.Api.InvokeOnAnalyzeCast(sender as Farmer);

            SpaceCore.Skills.RegisterSkill(Magic.Skill = new Skill());
        }
コード例 #15
0
ファイル: ModEntry.cs プロジェクト: tyyyh2/StardewMods
        /// <summary>Get the enabled data layers.</summary>
        /// <param name="config">The mod configuration.</param>
        /// <param name="input">The API for checking input state.</param>
        /// <param name="translation">Provides translations for the mod.</param>
        /// <param name="mods">Handles access to the supported mod integrations.</param>
        private IEnumerable <ILayer> GetLayers(ModConfig config, IInputHelper input, ITranslationHelper translation, ModIntegrations mods)
        {
            ModConfig.LayerConfigs layers = config.Layers;

            if (layers.Accessible.IsEnabled())
            {
                yield return(new AccessibleLayer(translation, layers.Accessible, input, this.Monitor));
            }
            if (layers.Buildable.IsEnabled())
            {
                yield return(new BuildableLayer(translation, layers.Buildable, input, this.Monitor));
            }
            if (layers.CoverageForBeeHouses.IsEnabled())
            {
                yield return(new BeeHouseLayer(translation, layers.CoverageForBeeHouses, input, this.Monitor));
            }
            if (layers.CoverageForScarecrows.IsEnabled())
            {
                yield return(new ScarecrowLayer(translation, layers.CoverageForScarecrows, mods, input, this.Monitor));
            }
            if (layers.CoverageForSprinklers.IsEnabled())
            {
                yield return(new SprinklerLayer(translation, layers.CoverageForSprinklers, mods, input, this.Monitor));
            }
            if (layers.CoverageForJunimoHuts.IsEnabled())
            {
                yield return(new JunimoHutLayer(translation, layers.CoverageForJunimoHuts, mods, input, this.Monitor));
            }
            if (layers.CropWater.IsEnabled())
            {
                yield return(new CropWaterLayer(translation, layers.CropWater, input, this.Monitor));
            }
            if (layers.CropPaddyWater.IsEnabled())
            {
                yield return(new CropPaddyWaterLayer(translation, layers.CropPaddyWater, input, this.Monitor));
            }
            if (layers.CropFertilizer.IsEnabled())
            {
                yield return(new CropFertilizerLayer(translation, layers.CropFertilizer, input, this.Monitor));
            }
            if (layers.CropHarvest.IsEnabled())
            {
                yield return(new CropHarvestLayer(translation, layers.CropHarvest, input, this.Monitor));
            }
            if (layers.Machines.IsEnabled() && mods.Automate.IsLoaded)
            {
                yield return(new MachineLayer(translation, layers.Machines, mods, input, this.Monitor));
            }
            if (layers.Tillable.IsEnabled())
            {
                yield return(new TillableLayer(translation, layers.Tillable, input, this.Monitor));
            }

            // add separate grid layer if grid isn't enabled for all layers
            if (!config.ShowGrid && layers.TileGrid.IsEnabled())
            {
                yield return(new GridLayer(translation, layers.TileGrid, input, this.Monitor));
            }
        }
コード例 #16
0
 /*********
 ** Public fields
 *********/
 /// <summary>Get a parsed representation of the configured controls.</summary>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">The monitor through which to log an error if a button value is invalid.</param>
 public ModConfigKeys ParseControls(IInputHelper input, IMonitor monitor)
 {
     return(new ModConfigKeys(
                toggleLayer: CommonHelper.ParseButtons(this.ToggleLayer, input, monitor, nameof(this.ToggleLayer)),
                prevLayer: CommonHelper.ParseButtons(this.PrevLayer, input, monitor, nameof(this.PrevLayer)),
                nextLayer: CommonHelper.ParseButtons(this.NextLayer, input, monitor, nameof(this.NextLayer))
                ));
 }
コード例 #17
0
 public WidgetHost(IModEvents events, IInputHelper input)
     : base(events, input)
 {
     RootWidget = new Widget {
         Width = Game1.viewport.Width, Height = Game1.viewport.Height
     };
     TooltipManager = new TooltipManager();
 }
コード例 #18
0
 /*********
 ** Public fields
 *********/
 /// <summary>Get a parsed representation of the configured controls.</summary>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">The monitor through which to log an error if a button value is invalid.</param>
 public ModConfigKeys ParseControls(IInputHelper input, IMonitor monitor)
 {
     return(new ModConfigKeys(
                toggleDebug: CommonHelper.ParseButtons(this.ToggleDebug, input, monitor, nameof(this.ToggleDebug)),
                debugPrevTexture: CommonHelper.ParseButtons(this.DebugPrevTexture, input, monitor, nameof(this.DebugPrevTexture)),
                debugNextTexture: CommonHelper.ParseButtons(this.DebugNextTexture, input, monitor, nameof(this.DebugNextTexture))
                ));
 }
コード例 #19
0
        public void Setup()
        {
            _tableTop    = new TableTop();
            _toyRobot    = new ToyRobot();
            _inputHelper = new InputHelper();

            _robotSimulator = new RobotSimulator(_toyRobot, _tableTop, _inputHelper);
        }
コード例 #20
0
 public static void OverwriteState(this IInputHelper input, SButton button, string message = null)
 {
     if (message != null)
     {
         Game1.showRedMessage(message);
     }
     input.Suppress(button);
 }
コード例 #21
0
 /*********
 ** Public fields
 *********/
 /// <summary>Get a parsed representation of the configured controls.</summary>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">The monitor through which to log an error if a button value is invalid.</param>
 public ModConfigKeys ParseControls(IInputHelper input, IMonitor monitor)
 {
     return(new ModConfigKeys(
                summonTractor: CommonHelper.ParseButtons(this.SummonTractor, input, monitor, nameof(this.SummonTractor)),
                dismissTractor: CommonHelper.ParseButtons(this.DismissTractor, input, monitor, nameof(this.DismissTractor)),
                holdToActivate: CommonHelper.ParseButtons(this.HoldToActivate, input, monitor, nameof(this.HoldToActivate))
                ));
 }
コード例 #22
0
ファイル: Scene.cs プロジェクト: pzaps/CrossGFX
        public void SubscribeToEvents(IInputHelper inputHelper)
        {
            inputHelper.MouseButtonPressed += inputHelper_MouseButtonPressed;
            inputHelper.MouseButtonReleased += inputHelper_MouseButtonReleased;
            inputHelper.MouseMoved += inputHelper_MouseMoved;

            inputHelper.KeyPressed += inputHelper_KeyPressed;
            inputHelper.KeyReleased += inputHelper_KeyReleased;
        }
コード例 #23
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="translations">Provides translations in stored in the mod folder's i18n folder.</param>
 /// <param name="config">The data layer settings.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public CropWaterLayer(ITranslationHelper translations, LayerConfig config, IInputHelper input, IMonitor monitor)
     : base(translations.Get("crop-water.name"), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Watered = new LegendEntry(translations, "crop-water.watered", Color.Green),
         this.Dry     = new LegendEntry(translations, "crop-water.dry", Color.Red)
     };
 }
コード例 #24
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public CropWaterLayer(LayerConfig config, IInputHelper input, IMonitor monitor)
     : base(I18n.CropWater_Name(), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Watered = new LegendEntry(I18n.Keys.CropWater_Watered, Color.Green),
         this.Dry     = new LegendEntry(I18n.Keys.CropWater_Dry, Color.Red)
     };
 }
コード例 #25
0
ファイル: Choice.cs プロジェクト: NumAniCloud/MaterGame
 private ChoiceController( IInputHelper device, MeanOfKey nextKey, MeanOfKey previousKey, MeanOfKey decideKey, MeanOfKey? cancelKey )
     : this()
 {
     this.InputDevice = device;
     this.NextKey = nextKey;
     this.PreviousKey = previousKey;
     this.DecideKey = decideKey;
     this.CancelKey = cancelKey;
 }
コード例 #26
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public CropPaddyWaterLayer(LayerConfig config, IInputHelper input, IMonitor monitor)
     : base(I18n.CropPaddyWater_Name(), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.InRange    = new LegendEntry(I18n.Keys.CropPaddyWater_InRange, Color.Green),
         this.NotInRange = new LegendEntry(I18n.Keys.CropPaddyWater_NotInRange, Color.Red)
     };
 }
コード例 #27
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public CropFertilizerLayer(LayerConfig config, IInputHelper input, IMonitor monitor)
     : base(I18n.CropFertilizer_Name(), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Fertilizer    = new LegendEntry(I18n.Keys.CropFertilizer_Fertilizer, Color.Green),
         this.RetainingSoil = new LegendEntry(I18n.Keys.CropFertilizer_RetainingSoil, Color.Blue),
         this.SpeedGro      = new LegendEntry(I18n.Keys.CropFertilizer_SpeedGro, Color.Magenta)
     };
 }
コード例 #28
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 /// <param name="mods">Handles access to the supported mod integrations.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public ScarecrowLayer(LayerConfig config, ModIntegrations mods, IInputHelper input, IMonitor monitor)
     : base(I18n.Scarecrows_Name(), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Covered = new LegendEntry(I18n.Keys.Scarecrows_Protected, Color.Green),
         this.Exposed = new LegendEntry(I18n.Keys.Scarecrows_Exposed, Color.Red)
     };
     this.ModObjectIds = this.GetModScarecrowIDs(mods).ToArray();
 }
コード例 #29
0
        /****
        ** Input handling
        ****/
        /// <summary>Parse a button configuration string into a buttons array.</summary>
        /// <param name="raw">The raw config string.</param>
        /// <param name="input">The API for checking input state.</param>
        /// <param name="onInvalidButton">A callback invoked when a button value can't be parsed.</param>
        public static KeyBinding ParseButtons(string raw, IInputHelper input, Action <string> onInvalidButton)
        {
            KeyBinding binding = new KeyBinding(raw, input.GetState, out string[] errors);

            if (errors.Any())
            {
                onInvalidButton.Invoke(errors[0]);
            }
            return(binding);
        }
コード例 #30
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="translations">Provides translations in stored in the mod folder's i18n folder.</param>
 /// <param name="config">The data layer settings.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public CropHarvestLayer(ITranslationHelper translations, LayerConfig config, IInputHelper input, IMonitor monitor)
     : base(translations.Get("crop-harvest.name"), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Ready         = new LegendEntry(translations, "crop-harvest.ready", Color.Green),
         this.NotReady      = new LegendEntry(translations, "crop-harvest.not-ready", Color.Black),
         this.NotEnoughTime = new LegendEntry(translations, "crop-harvest.not-enough-time", Color.Red)
     };
 }
コード例 #31
0
 /*********
 ** Public fields
 *********/
 /// <summary>Get a parsed representation of the configured controls.</summary>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">The monitor through which to log an error if a button value is invalid.</param>
 public ModConfigKeys ParseControls(IInputHelper input, IMonitor monitor)
 {
     return(new ModConfigKeys(
                toggleLookup: CommonHelper.ParseButtons(this.ToggleLookup, input, monitor, nameof(this.ToggleLookup)),
                toggleSearch: CommonHelper.ParseButtons(this.ToggleSearch, input, monitor, nameof(this.ToggleSearch)),
                scrollUp: CommonHelper.ParseButtons(this.ScrollUp, input, monitor, nameof(this.ScrollUp)),
                scrollDown: CommonHelper.ParseButtons(this.ScrollDown, input, monitor, nameof(this.ScrollDown)),
                toggleDebug: CommonHelper.ParseButtons(this.ToggleDebug, input, monitor, nameof(this.ToggleDebug))
                ));
 }
コード例 #32
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The data layer settings.</param>
 /// <param name="input">The API for checking input state.</param>
 /// <param name="monitor">Writes messages to the SMAPI log.</param>
 public CropHarvestLayer(LayerConfig config, IInputHelper input, IMonitor monitor)
     : base(I18n.CropHarvest_Name(), config, input, monitor)
 {
     this.Legend = new[]
     {
         this.Ready         = new LegendEntry(I18n.Keys.CropHarvest_Ready, Color.Green),
         this.NotReady      = new LegendEntry(I18n.Keys.CropHarvest_NotReady, Color.Black),
         this.NotEnoughTime = new LegendEntry(I18n.Keys.CropHarvest_NotEnoughTime, Color.Red)
     };
 }
コード例 #33
0
ファイル: Choice.cs プロジェクト: NumAniCloud/MaterGame
 public ChoiceController( IInputHelper device, MeanOfKey nextKey, MeanOfKey previousKey, MeanOfKey decideKey, MeanOfKey cancelKey )
     : this(device, nextKey, previousKey, decideKey, (MeanOfKey?)cancelKey)
 {
 }
コード例 #34
0
ファイル: TextBox.cs プロジェクト: pzaps/CrossGFX
        public static string GetCharString(Input.KeyEventArgs e, IInputHelper inputHelper)
        {
            switch (e.Code) {
                case Key.Space: {
                        return " ";
                    }
            }
            if (inputHelper.KeyData.IsShiftDown()) {

                if ((int)e.Code >= 0 && (int)e.Code <= 25) {
                    return e.Code.ToString().ToUpper();
                }

                switch (e.Code) {
                    #region Numbers
                    case Key.Num1:
                        return "!";
                    case Key.Num2:
                        return "@";
                    case Key.Num3:
                        return "#";
                    case Key.Num4:
                        return "$";
                    case Key.Num5:
                        return "%";
                    case Key.Num6:
                        return "^";
                    case Key.Num7:
                        return "&";
                    case Key.Num8:
                        return "*";
                    case Key.Num9:
                        return "(";
                    case Key.Num0:
                        return ")";
                    #endregion
                    #region Symbols
                    case Key.Tilde:
                        return "~";
                    case Key.Dash:
                        return "_";
                    case Key.Equal:
                        return "+";
                    case Key.LBracket:
                        return "{";
                    case Key.RBracket:
                        return "}";
                    case Key.BackSlash:
                        return "|";
                    case Key.SemiColon:
                        return ":";
                    case Key.Quote:
                        return "\"";
                    case Key.Comma:
                        return "<";
                    case Key.Period:
                        return ">";
                    case Key.Slash:
                        return "?";
                    #endregion
                }
            } else {

                if ((int)e.Code >= 0 && (int)e.Code <= 25) {
                    return e.Code.ToString().ToLower();
                }

                switch (e.Code) {
                    #region Numbers
                    case Key.Num1:
                        return "1";
                    case Key.Num2:
                        return "2";
                    case Key.Num3:
                        return "3";
                    case Key.Num4:
                        return "4";
                    case Key.Num5:
                        return "5";
                    case Key.Num6:
                        return "6";
                    case Key.Num7:
                        return "7";
                    case Key.Num8:
                        return "8";
                    case Key.Num9:
                        return "9";
                    case Key.Num0:
                        return "0";
                    #endregion
                    #region Symbols
                    case Key.Tilde:
                        return "`";
                    case Key.Dash:
                        return "-";
                    case Key.Equal:
                        return "+";
                    case Key.LBracket:
                        return "[";
                    case Key.RBracket:
                        return "]";
                    case Key.BackSlash:
                        return "\\";
                    case Key.SemiColon:
                        return ";";
                    case Key.Quote:
                        return "\'";
                    case Key.Comma:
                        return ",";
                    case Key.Period:
                        return ".";
                    case Key.Slash:
                        return "/";
                    #endregion
                }
            }

            return "";
        }