private static bool IsThirdPartyOption(InitialStateOption item) { var act = (Action)InitOptActField.GetValue(item); var optAsm = act.Method.DeclaringType?.Assembly; var optAsmName = optAsm?.GetName().Name; if (optAsmName == null) { return(false); } if (optAsmName.StartsWith("TaleWorlds.")) { return(false); } if (optAsmName.StartsWith("SandBox.")) { return(false); } if (optAsmName.StartsWith("SandBoxCore.")) { return(false); } if (optAsmName.StartsWith("StoryMode.")) { return(false); } return(true); }
protected override void OnSubModuleLoad() { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(BasePath.Name + "Modules/RealisticBattleCombatModule/config.xml"); foreach (XmlNode childNode in xmlDocument.SelectSingleNode("/config").ChildNodes) { foreach (XmlNode subNode in childNode) { XmlConfig.dict.Add(childNode.Name + "." + subNode.Name, float.Parse(subNode.InnerText)); } } MyPatcher.DoPatching(); Module.CurrentModule.AddInitialStateOption(new InitialStateOption("RbmConfiguration", new TextObject("RBM Combat Module Settings"), 3, delegate { ScreenManager.PushScreen(new RbmConfigScreen()); }, () => (false, new TextObject("RBM Combat Module Settings")))); }
protected override void OnSubModuleLoad() { InformationMessage message = new InformationMessage("Hello from ExampleModule!"); InitialStateOption initStateOpt = new InitialStateOption( "ExampleModule", new TextObject("ExampleModule", null), 9990, () => InformationManager.DisplayMessage(message), false ); Module.CurrentModule.AddInitialStateOption(initStateOpt); }
protected override void OnSubModuleLoad() { InitialStateOption initStateOpt = new InitialStateOption( "Message", new TextObject("Message", null), 9990, () => { InformationManager.DisplayMessage(new InformationMessage("Hello from Ledger!")); }, false ); Module.CurrentModule.AddInitialStateOption(initStateOpt); }
private static bool IsThirdPartyOption(InitialStateOption item) { try { var act = (Action)InitOptActField.GetValue(item); var optAsm = act.Method.DeclaringType?.Assembly; var optAsmName = optAsm?.GetName().Name; if (optAsmName == null || optAsmName.StartsWith("TaleWorlds.") || optAsmName.StartsWith("SandBox.") || optAsmName.StartsWith("SandBoxCore.") || optAsmName.StartsWith("StoryMode.")) { if (PathHelpers.IsOfficialAssembly(optAsm)) { return(false); } } } catch (Exception) { return(true); } return(true); }