Ejemplo n.º 1
0
 private static void Input_MouseWheelScrolled(object sender, StardewModdingAPI.Events.MouseWheelScrolledEventArgs e)
 {
     if (ModEntry.screenRect.Contains(Game1.getMousePosition()))
     {
         AddYOffset(e.Delta);
     }
 }
Ejemplo n.º 2
0
        private void Input_MouseWheelScrolled(object sender, StardewModdingAPI.Events.MouseWheelScrolledEventArgs e)
        {
            if (!Config.EnableMod || !Context.IsPlayerFree || !Helper.Input.IsDown(Config.IndexModKey) || Game1.soundBank == null || !Game1.currentLocation.objects.TryGetValue(Game1.currentCursorTile, out Object obj) || !obj.Name.Equals("Drum Block"))
            {
                return;
            }

            int newIndex;

            if (e.Delta > 0)
            {
                newIndex = (obj.preservedParentSheetIndex.Value + 1) % 7;
            }
            else if (e.Delta < 0)
            {
                newIndex = obj.preservedParentSheetIndex.Value >= 1 ? obj.preservedParentSheetIndex.Value - 1 : 6;
            }
            else
            {
                return;
            }
            Monitor.Log($"Setting index to {newIndex}");
            Game1.currentLocation.objects[Game1.currentCursorTile].preservedParentSheetIndex.Value = newIndex;
            Config.CurrentPitch = newIndex;
            Game1.currentLocation.objects[Game1.currentCursorTile].internalSound?.Stop(AudioStopOptions.Immediate);
            Game1.currentLocation.objects[Game1.currentCursorTile].farmerAdjacentAction(Game1.currentLocation);
        }
Ejemplo n.º 3
0
        private void Input_MouseWheelScrolled(object sender, StardewModdingAPI.Events.MouseWheelScrolledEventArgs e)
        {
            if (!Config.EnableMod || !Context.IsPlayerFree || Config.ToneList.Length == 0 || (!Helper.Input.IsDown(Config.ToneModKey) && !Helper.Input.IsDown(Config.PitchModKey)) || Game1.soundBank == null || !Game1.currentLocation.objects.TryGetValue(Game1.currentCursorTile, out Object obj) || !obj.Name.Equals("Flute Block"))
            {
                return;
            }

            if (Helper.Input.IsDown(Config.PitchModKey))
            {
                int newPitch;
                if (e.Delta > 0)
                {
                    newPitch = (obj.preservedParentSheetIndex.Value + Config.PitchStep) % 2400;
                }
                else if (e.Delta < 0)
                {
                    newPitch = obj.preservedParentSheetIndex.Value >= Config.PitchStep ? obj.preservedParentSheetIndex.Value - Config.PitchStep : 2400 - Config.PitchStep;
                }
                else
                {
                    return;
                }
                Monitor.Log($"Setting pitch to {newPitch}");
                Game1.currentLocation.objects[Game1.currentCursorTile].preservedParentSheetIndex.Value = newPitch;
                Config.CurrentPitch = newPitch;
                Game1.currentLocation.objects[Game1.currentCursorTile].internalSound?.Stop(AudioStopOptions.Immediate);
                Game1.currentLocation.objects[Game1.currentCursorTile].farmerAdjacentAction(Game1.currentLocation);
            }
            else
            {
                string[] tones = Config.ToneList.Split(',');
                obj.modData.TryGetValue("aedenthorn.AdvancedFluteBlocks/tone", out string tone);
                for (int i = 0; i < tones.Length; i++)
                {
                    if (tone == null || tone == tones[i])
                    {
                        string newTone = null;
                        if (e.Delta > 0)
                        {
                            newTone = tones[(i + 1) % tones.Length];
                        }
                        else if (e.Delta < 0)
                        {
                            newTone = tones[i > 0 ? i - 1 : tones.Length - 1];
                        }
                        else
                        {
                            return;
                        }
                        Monitor.Log($"Setting tone to {newTone}");
                        Game1.currentLocation.objects[Game1.currentCursorTile].modData["aedenthorn.AdvancedFluteBlocks/tone"] = newTone;
                        Config.CurrentTone = newTone;
                        Game1.currentLocation.objects[Game1.currentCursorTile].internalSound?.Stop(AudioStopOptions.Immediate);
                        Game1.currentLocation.objects[Game1.currentCursorTile].farmerAdjacentAction(Game1.currentLocation);
                        return;
                    }
                }
                Game1.currentLocation.objects[Game1.currentCursorTile].modData["aedenthorn.AdvancedFluteBlocks/tone"] = tones[0];
            }
        }
Ejemplo n.º 4
0
 private void Input_MouseWheelScrolled(object sender, StardewModdingAPI.Events.MouseWheelScrolledEventArgs e)
 {
     foreach (var m in detachedMenus)
     {
         m.receiveScrollWheelAction(e.Delta);
     }
 }
Ejemplo n.º 5
0
 private static void Input_MouseWheelScrolled(object sender, StardewModdingAPI.Events.MouseWheelScrolledEventArgs e)
 {
     scrollChange = e.Delta;
 }