コード例 #1
0
        public static void Init()
        {
            if (Loaded)
            {
                return;
            }

            Loaded = true;
            var execAssembly = Assembly.GetExecutingAssembly();

            using (var stream = execAssembly.GetManifestResourceStream("JarlykMods.Umbrella.umbrella.assets"))
            {
                var bundle   = AssetBundle.LoadFromStream(stream);
                var provider = new AssetBundleResourcesProvider(Prefix.TrimEnd(':'), bundle);
                ResourcesAPI.AddProvider(provider);

                BulletTimerPrefab = bundle.LoadAsset <GameObject>("Assets/Import/bullet_timer/BulletTimer.prefab");
                JestersDicePrefab = bundle.LoadAsset <GameObject>("Assets/Prefabs/JestersDice.prefab");
            }

            using (var bankStream = execAssembly.GetManifestResourceStream("JarlykMods.Umbrella.Umbrella.bnk"))
            {
                var bytes = new byte[bankStream.Length];
                bankStream.Read(bytes, 0, bytes.Length);
                SoundBanks.Add(bytes);
            }
        }
コード例 #2
0
ファイル: SoundAPI.cs プロジェクト: xiaoxiao921/R2API
        internal static void SoundAwake()
        {
            // Disable SoundPlus if RoR2 is running with its graphics and sound engine disabled (Dedicated Servers) to avoid any bad side effects.
            if (Application.isBatchMode)
            {
                return;
            }

            if (Loaded)
            {
                return;
            }

            Loaded = true;

            var files = Directory.GetFiles(Paths.PluginPath, "*.sound", SearchOption.AllDirectories);

            foreach (var file in files)
            {
                SoundBanks.Add(file);
            }

            _ = new Hook(
                typeof(AkWwiseInitializationSettings).GetMethodCached(nameof(AkWwiseInitializationSettings.InitializeSoundEngine)),
                typeof(SoundAPI).GetMethodCached(nameof(AddBanksAfterEngineInit)));
        }
コード例 #3
0
ファイル: SoundAPI.cs プロジェクト: harbingerofme/R2API
        internal static void SoundAwake()
        {
            // Disable SoundPlus if RoR2 is running with its graphics and sound engine disabled (Dedicated Servers) to avoid any bad side effects.
            if (Application.isBatchMode)
            {
                return;
            }

            if (Loaded)
            {
                return;
            }

            Loaded = true;

            var files = Directory.GetFiles(Paths.PluginPath, "*.sound", SearchOption.AllDirectories);

            foreach (var file in files)
            {
                SoundBanks.Add(file);
            }

            //for bank loading
            On.RoR2.RoR2Application.OnLoad += RoR2Application_OnLoad;
        }
コード例 #4
0
        public static void Init()
        {
            if (Loaded)
            {
                return;
            }

            Loaded = true;
            var execAssembly = Assembly.GetExecutingAssembly();

            using (var stream = execAssembly.GetManifestResourceStream("JarlykMods.Hailstorm.hailstorm.assets"))
            {
                var bundle   = AssetBundle.LoadFromStream(stream);
                var provider = new AssetBundleResourcesProvider(Prefix.TrimEnd(':'), bundle);
                ResourcesAPI.AddProvider(provider);

                DarknessShader = bundle.LoadAsset <Shader>("Assets/Effects/darkness.shader");

                PureBlack    = bundle.LoadAsset <Material>("Assets/Materials/PureBlack.mat");
                PurpleCracks = bundle.LoadAsset <Material>("Assets/Materials/PurpleCracks.mat");

                TwisterVisualPrefab = bundle.LoadAsset <GameObject>("Assets/Prefabs/TwisterVisual.prefab");
                TwisterPrefab       = bundle.LoadAsset <GameObject>("Assets/Prefabs/Twister.prefab");
                TwisterProjectileController.AugumentPrefab(TwisterPrefab);

                BarrierMaterial = Resources.Load <GameObject>("Prefabs/TemporaryVisualEffects/barriereffect")
                                  .GetComponentInChildren <MeshRenderer>().material;

                CataclysmPlatformPrefab = bundle.LoadAsset <GameObject>("Assets/Prefabs/CataclysmPlatform.prefab");
                CataclysmPlatformPrefab.AddComponent <MobilePlatform>();

                CataclysmSkyboxMaterial = bundle.LoadAsset <Material>("Assets/SpaceSkies Free/Skybox_3/Purple_4K_Resolution.mat");
                CataclysmArenaPrefab    = bundle.LoadAsset <GameObject>("Assets/Prefabs/CataclysmArena.prefab");

                GravBombPrefab = bundle.LoadAsset <GameObject>("Assets/Prefabs/GravBomb.prefab");
                GravBombEffect.AugmentPrefab(GravBombPrefab);

                AsteroidProjectilePrefab = bundle.LoadAsset <GameObject>("Assets/Prefabs/AsteroidProjectile.prefab");
                AsteroidProjectileController.AugmentPrefab(AsteroidProjectilePrefab);

                LaserChargerPrefab = bundle.LoadAsset <GameObject>("Assets/Prefabs/LaserCharger.prefab");
                LaserChargerInteraction.AugmentPrefab(LaserChargerPrefab);
            }

            using (var bankStream = execAssembly.GetManifestResourceStream("JarlykMods.Hailstorm.Hailstorm.bnk"))
            {
                var bytes = new byte[bankStream.Length];
                bankStream.Read(bytes, 0, bytes.Length);
                SoundBanks.Add(bytes);
            }

            On.RoR2.Networking.GameNetworkManager.OnStartClient += GameNetworkManager_OnStartClient;
        }
        public static void AddSoundBank()
        {
            var soundbank = LoadEmbeddedResource(BankName);

            if (soundbank != null)
            {
                SoundBanks.Add(soundbank);
            }
            else
            {
                UnityEngine.Debug.LogError("SoundBank Fetching Failed");
            }
        }
コード例 #6
0
 internal void Awake()
 {
     //if the bank file is embedded, if not then put a .sound in the plugin folder or any of it's subdirectories
     if (embedded)
     {
         var soundbank = LoadFile(bankName);
         if (soundbank != null)
         {
             SoundBanks.Add(soundbank);
         }
         else
         {
             UnityEngine.Debug.LogError("soundbank fetching failed");
         }
     }
     On.EntityStates.Mage.Weapon.FireBolt.OnEnter += FireBolt_OnEnter;
 }
コード例 #7
0
        internal override void Load()
        {
            base.Load();
            // Disable SoundPlus if RoR2 is running with its graphics and sound engine disabled (Dedicated Servers) to avoid any bad side effects.
            if (Application.isBatchMode)
            {
                return;
            }

            var files = Directory.GetFiles(Paths.PluginPath, "*.sound", SearchOption.AllDirectories);

            foreach (var file in files)
            {
                SoundBanks.Add(file);
            }

            //for bank loading
            //On.RoR2.RoR2Application.OnLoad += RoR2Application_OnLoad1; ;
        }
コード例 #8
0
ファイル: Assets.cs プロジェクト: MatarraNA/PlayableSephiroth
        public static void PopulateAssets()
        {
            // populate ASSETS
            if (MainAssetBundle == null)
            {
                using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PlayableSephiroth.sephiroth"))
                {
                    MainAssetBundle = AssetBundle.LoadFromStream(assetStream);
                    Provider        = new AssetBundleResourcesProvider("@Sephiroth", MainAssetBundle);
                }
            }

            // populate SOUNDS
            using (var bankStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PlayableSephiroth.SephirothBank.bnk"))
            {
                var bytes = new byte[bankStream.Length];
                bankStream.Read(bytes, 0, bytes.Length);
                SoundBanks.Add(bytes);
            }

            // gather assets
            SephIcon  = MainAssetBundle.LoadAsset <Sprite>("SephirothIcon");
            SephHitFx = MainAssetBundle.LoadAsset <GameObject>("SephHitFx");
        }
コード例 #9
0
        uint BankID; //used for the non-R2API version
        public void Awake()
        {
            RoR2.RoR2Application.isModded = true;

            //      Debug.Log("TestModLoaded");
            Volume = Config.Bind <int>("Config", "Volume", 100, "How loud the music will be on a scale from 0-100");

            //load the rave music into sound banks
            using (var bankStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("RiskOfRave.Rave.bnk"))
            {
                //////////////////////////////////////////
                //R2API version

                var bytes = new byte[bankStream.Length];
                bankStream.Read(bytes, 0, bytes.Length);
                SoundBanks.Add(bytes);

                //R2API version
                //////////////////////////////////////////


                /////////////////////////////////////////
                //Custom version
//        bytes = new byte[bankStream.Length];
//        bankStream.Read(bytes, 0, bytes.Length);
//        Debug.Log("bytes lenght: " + bytes.Length);
                //Ccustom version
                /////////////////////////////////////////
            }

            //      Debug.Log("TestModLoaded2");



            //On.RoR2.HoldoutZoneController.Start += StartRave;
            //On.RoR2.HoldoutZoneController.FullyChargeHoldoutZone += EndRaveChargedHoldout;
            On.RoR2.HoldoutZoneController.OnEnable  += StartRaveTest;
            On.RoR2.HoldoutZoneController.OnDisable += EndRaveTest;
            //On.RoR2.UI.ObjectivePanelController.FinishTeleporterObjectiveTracker.ctor += EndRaveChargedTele;
            On.RoR2.GameOverController.SetRunReport += EndRaveDeath;

            /////////////////////////////////////////
            //Custom version
//      On.RoR2.RoR2Application.OnLoad += OnLoad;
            //Custom version
            /////////////////////////////////////////

            On.RoR2.UI.HUD.Awake += RaveUI;
            //On.RoR2.TeleporterInteraction.OnInteractionBegin += StartConductor;


            On.RoR2.UI.ObjectivePanelController.AddObjectiveTracker += (orig, self, tracker) =>
            {
                orig(self, tracker);
                if (tracker.ToString() == "RoR2.HoldoutZoneController+ChargeHoldoutZoneObjectiveTracker")
                {
                    HodlTracker = tracker;
                }

//        Debug.Log("===================================================");
//        Debug.Log("Objective Tracker Added: " + tracker.ToString());
//        Debug.Log("===================================================");
            };

            On.RoR2.UI.ObjectivePanelController.RemoveObjectiveTracker += (orig, self, tracker) =>
            {
                orig(self, tracker);
                if (tracker.ToString() == "RoR2.HoldoutZoneController+ChargeHoldoutZoneObjectiveTracker")
                {
                    HodlTracker = null;
                }

//        Debug.Log("===================================================");
//        Debug.Log("Objective Tracker Removed: " + tracker.ToString());
//        Debug.Log("===================================================");
            };

            //TODO: create a prefab of a image that is scaled across the entire screen and load it in
        }