Exemplo n.º 1
0
            /// <summary>
            /// Get SoundEffect from WAV file
            /// </summary>
            /// <param name="soundName">File name of the WAV -> without the extension</param>
            /// <returns></returns>
            public static SoundEffect GetSoundEffect(string soundName)
            {
                ContentManager contentManager = ChristianGame.contentManager;

                string      absolutePath = Path.Combine(contentManager.RootDirectory, $"{soundName}.wav");
                SoundEffect result       = SoundEffect.FromFile(absolutePath);

                return(result);
            }
Exemplo n.º 2
0
        public static void LoadSound(string path)
        {
            string asm  = Main.instance.GetType().Assembly.Location;
            string name = path;

            int lastsep = path.LastIndexOf(Path.DirectorySeparatorChar);

            if (lastsep != -1)
            {
                name = name.Substring(lastsep, name.Length);
            }

            int lastdot = name.LastIndexOf('.');

            if (lastdot != -1)
            {
                name = name.Substring(0, lastdot);
            }

            sounds.TryAdd(name.ToLowerInvariant(), SoundEffect.FromFile(Path.Combine(asm, path)));
        }
Exemplo n.º 3
0
        public override void Entry(IModHelper helper)
        {
            I18n.Init(helper.Translation);

            Log.Monitor = Monitor;
            instance    = this;

            Config = Helper.ReadConfig <Configuration>();

            Assets.Load(helper.Content);
            SoundEffect mainMusic = SoundEffect.FromFile(Path.Combine(Helper.DirectoryPath, "assets", "into-the-spaceship.wav"));

            Game1.soundBank.AddCue(new CueDefinition("into-the-spaceship", mainMusic, 2, loop: true));

            Helper.ConsoleCommands.Add("mm_items", "View all items added by this mod.", OnItemsCommand);
            Helper.ConsoleCommands.Add("mm_key", "Gives you the lunar key.", OnKeyCommand);
            Helper.ConsoleCommands.Add("mm_infuse", "Opens the celestial infuser menu.", OnInfuseCommand);

            Helper.Events.GameLoop.GameLaunched        += OnGameLaunched;
            Helper.Events.GameLoop.TimeChanged         += OnTimeChanged;
            Helper.Events.GameLoop.UpdateTicked        += OnUpdateTicked;
            helper.Events.GameLoop.DayStarted          += OnDayStarted;
            Helper.Events.Specialized.LoadStageChanged += OnLoadStageChanged;
            Helper.Events.Display.MenuChanged          += OnMenuChanged;
            Helper.Events.Display.RenderingWorld       += OnRenderingWorld;
            Helper.Events.Display.RenderedWorld        += OnRenderedWorld;
            Helper.Events.GameLoop.ReturnedToTitle     += OnReturnedToTitle;
            Helper.Events.Player.Warped += OnWarped;

            SpaceEvents.AddWalletItems += AddWalletItems;
            SpaceEvents.AfterGiftGiven += AfterGiftGiven;

            var harmony = new Harmony(ModManifest.UniqueID);

            harmony.PatchAll();
            harmony.Patch(AccessTools.Method("StardewModdingAPI.Framework.SGame:DrawImpl"), transpiler: new HarmonyMethod(typeof(Patches.Game1CatchLightingRenderPatch).GetMethod("Transpiler")));
        }
Exemplo n.º 4
0
        private static void loadEffect(string identifier, string absolutePath)
        {
            SoundEffect effect = SoundEffect.FromFile(absolutePath);

            effects[identifier] = effect;
        }