public void NewProviderAvailable(IProvider newProvider) { //Get Reference to SaveManager when Initialized if (DepInjector.MapProvider <SaveManager>(newProvider, ref this.currentSave)) { //Subscribe to receive Deck Notifications currentSave.AddDeckNotifications(this); data = currentSave.GetAllGameData(); this.Logger.LogInfo("SaveManager Initialized"); InitializeCardDataBase(); this.Logger.LogInfo("Relic Manager Initialized"); InitializeRelicDataBase(); IsInit = false; } //Get Reference to GameStateManager When Initialized if (DepInjector.MapProvider <GameStateManager>(newProvider, ref this.Game)) { //Subscribe listener to Signal Game.runStartedSignal.AddListener(GameStartedListener); } if (DepInjector.MapProvider <RelicManager>(newProvider, ref this.relicManager)) { relicManager.AddRelicNotifications(this); } }
public override void Start() { mapLoader = new Map.MapLoader(); map = mapLoader.LoadAndParseMap(); mapEntManager = new Map.MapEntityManager(); DepInjector.RegisterInjectable(this); }
void Awake() { DepInjector.AddClient(new ProviderManager()); var harmony = new Harmony(GUID); harmony.PatchAll(); }
public InputBridge(RenderManager rM) { renderManager = rM; DepInjector.RegisterInjectable(this); renderManager.consoleWindow.KeyDown += ConsoleWindow_KeyDown; renderManager.consoleWindow.KeyUp += ConsoleWindow_KeyUp; renderManager.consoleWindow.KeyPress += ConsoleWindow_KeyPress; }
public void InitInjector(IEnumerable <MonoBehaviour> source) { injector = new DepInjector <MonoBehaviour>(); // register source foreach (MonoBehaviour s in source) { injector.RegisterIf(s, typeof(InjectionSourceAttribute)); } sources = injector.GetSources(); }
/// <summary> /// Called on startup. Executes all Harmony patches anywhere in the framework's assembly. /// </summary> private void Awake() { DepInjector.AddClient(new ProviderManager()); // Load the Trainworks Bundle, which will be used by the framework for templating var assembly = this.GetType().Assembly; APIBasePath = Path.GetDirectoryName(assembly.Location); TrainworksBundle = AssetBundle.LoadFromFile(Path.Combine(APIBasePath, "trainworks")); var harmony = new Harmony(GUID); harmony.PatchAll(); }
/// <summary> /// Called on startup. Executes all Harmony patches anywhere in the framework's assembly. /// </summary> private void Awake() { DepInjector.AddClient(new ProviderManager()); // Load the Trainworks Bundle, which will be used by the framework for templating var assembly = this.GetType().Assembly; APIBasePath = Path.GetDirectoryName(assembly.Location); TrainworksBundle = AssetBundle.LoadFromFile(Path.Combine(APIBasePath, "trainworks")); // Register in order to provide dummy synthesis data for compatibility reasons PluginManager.RegisterPlugin(this); var harmony = new Harmony(GUID); harmony.PatchAll(); }
public GameObjectManager() { DepInjector.RegisterInjectable(this); }
public void Initialize() { Trainworks.Trainworks.Log("Initializing"); Harmony harmony = new Harmony("io.github.crazyjackel.Stoker"); harmony.PatchAll(); Logger.Log(BepInEx.Logging.LogLevel.Info, "Initializing AssetBundle"); //Load Assets var assembly = Assembly.GetExecutingAssembly(); PluginManager.PluginGUIDToPath.TryGetValue("io.github.crazyjackel.Stoker", out basePath); info = new BundleAssetLoadingInfo { PluginPath = basePath, FilePath = bundleName, }; BundleManager.RegisterBundle(GUIDGenerator.GenerateDeterministicGUID(info.FullPath), info); Logger.Log(BepInEx.Logging.LogLevel.Info, "Loaded AssetBundle"); //Instantiate then Hide Canvas var GameObj = BundleManager.LoadAssetFromBundle(info, assetName_Canvas) as GameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Loaded Main Asset: " + GameObj.name); Canvas = GameObject.Instantiate(GameObj); DontDestroyOnLoad(Canvas); Canvas.SetActive(false); //Load Prefab to Instantiate Later SelectionButtonPrefab = BundleManager.LoadAssetFromBundle(info, assetName_SelectionButton) as GameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Loaded Button Prefab"); //Find local Buttons and add Listeners //Load Content where to add Selection Buttons DeckContent = Canvas.transform.Find($"{name_mainBackground}/{name_secondaryBackground}/{name_viewport}/{name_content}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Deck Content"); CardDatabaseContent = Canvas.transform.Find($"{name_mainBackground}/{name_secondaryBackground2}/{name_viewport}/{name_content}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Card Database Content"); RelicDatabaseContent = Canvas.transform.Find($"{name_mainBackground}/{name_secondaryBackground3}/{name_viewport}/{name_content}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Relic Database Content"); RelicContent = Canvas.transform.Find($"{name_mainBackground}/{name_secondaryBackground4}/{name_viewport}/{name_content}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Relic Content"); UpgradeContent = Canvas.transform.Find($"{name_mainBackground}/{name_secondaryBackground5}/{name_viewport}/{name_content}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Upgrade Content"); UpgradeDatabaseContent = Canvas.transform.Find($"{name_mainBackground}/{name_secondaryBackground6}/{name_viewport}/{name_content}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Upgrade Database Content"); //Get Buttons and Input Fields RemoveButton = Canvas.transform.Find($"{name_mainBackground}/{name_removeBackground}/{name_Button}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Remove Button"); RemoveButton.GetComponent <Button>().onClick.AddListener(AttemptToRemoveSelectedCard); AddButton = Canvas.transform.Find($"{name_mainBackground}/{name_addBackground}/{name_Button}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Add Button"); AddButton.GetComponent <Button>().onClick.AddListener(AttemptToAddSelectedCardData); DuplicateButton = Canvas.transform.Find($"{name_mainBackground}/{name_duplicateBackground}/{name_Button}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Duplication Button"); DuplicateButton.GetComponent <Button>().onClick.AddListener(AttemptToDuplicateSelectedCard); AddRelicButton = Canvas.transform.Find($"{name_mainBackground}/{name_addRelicBackground}/{name_Button}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Add Relic Button"); AddRelicButton.GetComponent <Button>().onClick.AddListener(AttemptToAddSelectedRelicData); RemoveRelicButton = Canvas.transform.Find($"{name_mainBackground}/{name_removeRelicBackground}/{name_Button}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Remove Relic Button"); RemoveRelicButton.GetComponent <Button>().onClick.AddListener(AttemptToRemoveSelectedRelic); AddUpgradeButton = Canvas.transform.Find($"{name_mainBackground}/{name_addUpgradeBackground}/{name_Button}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Add Upgrade Button"); AddUpgradeButton.GetComponent <Button>().onClick.AddListener(AttemptToUpgradeCardState); RemoveUpgradeButton = Canvas.transform.Find($"{name_mainBackground}/{name_removeUpgradeBackground}/{name_Button}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Remove Upgrade Button"); RemoveUpgradeButton.GetComponent <Button>().onClick.AddListener(AttemptToRemoveUpgradeState); ImportButton = Canvas.transform.Find($"{name_mainBackground}/{name_importBackground}/{name_Button}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Import Button"); ImportButton.GetComponent <Button>().onClick.AddListener(LoadFromTxtFile); ExportButton = Canvas.transform.Find($"{name_mainBackground}/{name_exportBackground}/{name_Button}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Export Button"); ExportButton.GetComponent <Button>().onClick.AddListener(ExportStateToTxtFile); SearchBar = Canvas.transform.Find($"{name_mainBackground}/{name_searchBarBackground}/{name_searchBar}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Search Bar"); SearchBar.GetComponent <InputField>().onValueChanged.AddListener(UpdateDatabases); FileNameBar = Canvas.transform.Find($"{name_mainBackground}/{name_presetNameBackground}/{name_searchBar}").gameObject; Logger.Log(BepInEx.Logging.LogLevel.Info, "Found File Name Bar"); FileNameBar.GetComponent <InputField>().onValueChanged.AddListener(UpdateFileName); Logger.Log(BepInEx.Logging.LogLevel.Info, "Found Elements"); //Subscribe as Client DepInjector.AddClient(this); this.Logger.LogInfo("Stoker Plugin Initialized"); }
public override void Start() { DepInjector.RegisterInjectable(this); this.Inject(); }
public RenderManager(GameObjectManager goM) { goManager = goM; consoleWindow = new ConsoleWindow(40, 60, "Test"); DepInjector.RegisterInjectable(this); }