示例#1
0
 private void Start()
 {
     CommonCode.instance.RefreshPermanentLanguage();
     CommonCode.instance.InstallLanguage();
     CommonCode.instance.Install();
     T2Module.SetupAll_PluginStart(allModules);
 }
        private void Awake()
        {
            Debug.Log("Loading assets.");
            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ArtifactOfHaste.artifactofhaste"))
            {
                var bundle   = AssetBundle.LoadFromStream(stream);
                var provider = new AssetBundleResourcesProvider("@ArtifactOfHaste", bundle);
                ResourcesAPI.AddProvider(provider);
            }

            config = new ConfigFile(Path.Combine(Paths.ConfigPath, modGuid + ".cfg"), true);

            Debug.Log("Creating mod info.");
            itemList = T2Module.InitAll <CatalogBoilerplate>(new T2Module.ModInfo
            {
                displayName     = "Artifact of Haste",
                longIdentifier  = "ArtifactOfHaste",
                shortIdentifier = "AOH",
                mainConfigFile  = config
            });

            Debug.Log("Initializing mod.");
            T2Module.SetupAll_PluginAwake(itemList);
            T2Module.SetupAll_PluginStart(itemList);
        }
示例#3
0
        private void Awake() //Sourced almost entirely from ThinkInvis' Classic Items. It is also extremely handy.
        {
            _logger = Logger;

#if DEBUG
            Logger.LogWarning("DEBUG mode is enabled! Ignore this message if you are actually debugging.");
            On.RoR2.Networking.GameNetworkManager.OnClientConnect += (self, user, t) => { };
#endif

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Aetherium.aetherium_assets"))
            {
                var bundle   = AssetBundle.LoadFromStream(stream);
                var provider = new AssetBundleResourcesProvider("@Aetherium", bundle);
                ResourcesAPI.AddProvider(provider);
            }

            ConfigFile = new ConfigFile(Path.Combine(Paths.ConfigPath, ModGuid + ".cfg"), true);

            masterItemList = T2Module.InitAll <CatalogBoilerplate>(new T2Module.ModInfo
            {
                displayName     = "Aetherium",
                longIdentifier  = "AETHERIUMMOD",
                shortIdentifier = "ATHRM",
                mainConfigFile  = ConfigFile
            });


            T2Module.SetupAll_PluginAwake(masterItemList);
            T2Module.SetupAll_PluginStart(masterItemList);
        }
示例#4
0
        private void Awake()
        {
            _logger = Logger;

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SupplyDrop.supplydrop_assets"))
            {
                MainAssets = AssetBundle.LoadFromStream(stream);
            }
            ConfigFile = new ConfigFile(Path.Combine(Paths.ConfigPath, ModGuid + ".cfg"), true);

            masterItemList = T2Module.InitAll <CatalogBoilerplate>(new T2Module.ModInfo
            {
                displayName     = "Supply Drop",
                longIdentifier  = "SUPPLYDROP",
                shortIdentifier = "SUPPDRP",
                mainConfigFile  = ConfigFile
            });

            using (var bankStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SupplyDrop.SupplyDropSounds.bnk"))
            {
                var bytes = new byte[bankStream.Length];
                bankStream.Read(bytes, 0, bytes.Length);
                SoundAPI.SoundBanks.Add(bytes);
            }

            T2Module.SetupAll_PluginAwake(masterItemList);
            T2Module.SetupAll_PluginStart(masterItemList);
        }
        private void Awake()
        {
            Log = new Log(Logger);

#if DEBUG
            MultiplayerTest.Enable(Logger, "Running test build with debug enabled! Report to CHEN if you're seeing this!");
#endif

            Log.Debug("Loading assets...");
            BundleInfo bundleInfo = new BundleInfo("ChensBombasticMod.chensbombasticmod_assets", BundleType.UnityAssetBundle);
            assetBundle = new AssetsManager(bundleInfo).Register();

            cfgFile = new ConfigFile(Path.Combine(Paths.ConfigPath, ModGuid + ".cfg"), true);

            Log.Debug("Instantiating item classes...");
            chensItemList = T2Module.InitAll <CatalogBoilerplate>(new T2Module.ModInfo
            {
                displayName     = "Chen's Bombastic Mod",
                longIdentifier  = "ChensBombasticMod",
                shortIdentifier = "CBM",
                mainConfigFile  = cfgFile
            });

            T2Module.SetupAll_PluginAwake(chensItemList);
            T2Module.SetupAll_PluginStart(chensItemList);
        }
        private void Start()
        {
            Logger.LogDebug("Performing late setup:");

            Logger.LogDebug("Late setup for individual items...");
            T2Module.SetupAll_PluginStart(masterItemList);

            Logger.LogDebug("Late setup done!");
        }
        private void Start()
        {
            pluginIsStarted = true;

            Logger.LogDebug("Performing late setup:");

            Logger.LogDebug("Late setup for individual items...");
            T2Module.SetupAll_PluginStart(masterItemList);

            Logger.LogDebug("Late setup done!");

            CatalogBoilerplate.ConsoleDump(Logger, masterItemList);
        }
示例#8
0
 private void Start()
 {
     T2Module.SetupAll_PluginStart(masterItemList);
     CatalogBoilerplate.ConsoleDump(Logger, masterItemList);
 }
示例#9
0
        private void Awake()
        {
            Log = new Log(Logger);

            Log.Debug("Performing plugin setup:");

#if DEBUG
            MultiplayerTest.Enable(Logger, "Running test build with debug enabled! Report to CHEN if you're seeing this!");
#endif

            Log.Debug("Loading assets...");
            BundleInfo bundleInfo = new BundleInfo("Chen.ClassicItems.chensclassicitems_assets", BundleType.UnityAssetBundle);
            assetBundle = new AssetsManager(bundleInfo).Register();
            assetBundle.ConvertShaders();

            cfgFile = new ConfigFile(Path.Combine(Paths.ConfigPath, ModGuid + ".cfg"), true);

            Log.Debug("Loading global configs...");
            globalCfg.BindAll(cfgFile, ModName, "Global");

            Log.Debug("Instantiating item classes...");
            chensItemList = T2Module.InitAll <CatalogBoilerplate>(new T2Module.ModInfo
            {
                displayName     = "Chen's Classic Items",
                longIdentifier  = "ChensClassicItems",
                shortIdentifier = "CCI",
                mainConfigFile  = cfgFile
            });

            Log.Debug("Loading item configs...");
            foreach (CatalogBoilerplate x in chensItemList)
            {
                x.SetupConfig();
                x.ConfigEntryChanged += (sender, args) =>
                {
                    if ((args.flags & AutoConfigUpdateActionTypes.InvalidateLanguage) == 0)
                    {
                        return;
                    }
                    var y = sender as CatalogBoilerplate;
                    if (y.pickupDef != null)
                    {
                        var c = y.pickupDef.displayPrefab;
                        if (!c)
                        {
                            return;
                        }
                        var ctsf   = c.transform;
                        var cfront = ctsf.Find("cardfront");
                        if (!cfront)
                        {
                            return;
                        }

                        cfront.Find("carddesc").GetComponent <TextMeshPro>().text = Language.GetString(longDesc ? y.descToken : y.pickupToken);
                        cfront.Find("cardname").GetComponent <TextMeshPro>().text = Language.GetString(y.nameToken);
                    }
                    if (y.logbookEntry != null)
                    {
                        y.logbookEntry.modelPrefab = y.pickupDef.displayPrefab;
                    }
                };
            }

            Log.Debug("Registering item attributes...");
            foreach (CatalogBoilerplate x in chensItemList)
            {
                string mpnOvr = null;
                if (x is Item item)
                {
                    mpnOvr = "Assets/ClassicItems/models/" + modelNameMap[item.itemTier] + ".prefab";
                }
                else if (x is Equipment eqp)
                {
                    mpnOvr = "Assets/ClassicItems/models/" + (eqp.isLunar ? "LqpCard.prefab" : "EqpCard.prefab");
                }
                var ipnOvr = "Assets/ClassicItems/icons/" + x.name + "_icon.png";

                if (mpnOvr != null)
                {
                    typeof(CatalogBoilerplate).GetProperty(nameof(CatalogBoilerplate.modelResource)).SetValue(x, assetBundle.LoadAsset <GameObject>(mpnOvr));
                    typeof(CatalogBoilerplate).GetProperty(nameof(CatalogBoilerplate.iconResource)).SetValue(x, assetBundle.LoadAsset <Sprite>(ipnOvr));
                }

                x.SetupAttributes();
            }

            Log.Debug("Registering item behaviors...");
            foreach (CatalogBoilerplate x in chensItemList)
            {
                x.SetupBehavior();
            }

            Log.Debug("Performing early finalization...");
            T2Module.SetupAll_PluginStart(chensItemList);

            new ContentProvider().Initialize();

            if (globalCfg.logEvolutionItemList)
            {
                RunArtifactManager.onArtifactEnabledGlobal  += OnEvolutionEnable;
                RunArtifactManager.onArtifactDisabledGlobal += OnEvolutionDisable;
            }

            Log.Debug("Initial setup done!");
        }
 private void Start()
 {
     T2Module.SetupAll_PluginStart(masterItemList);
     CatalogBoilerplate.ConsoleDump(Logger, masterItemList);
     On.RoR2.CharacterBody.OnInventoryChanged += On_InventoryChanged;
 }