/// <summary> /// Fixes the graphical bug where the enemy ship is "spawned" beneath the player ship after it is destroyed. /// </summary> private void Structures_resetShipDataCoroutine_Fix() { ModuleDefinition unityModule = Injector.GetModuleZ("UnityEngine.dll"); TypeDefinition structuresDef = GameModule.GetTypeByName("Structures"); TypeDefinition resetShipDataCoroutine = structuresDef.NestedTypes.Where(t => t.Name.Contains("resetShipDataCoroutine")).FirstOrDefault(); MethodDefinition toggleShipVisual = structuresDef.GetMethodByName("toggleShipVisual"); MethodDefinition moveNextMethod = resetShipDataCoroutine.GetMethodByName("MoveNext"); FieldDefinition f_thisField = resetShipDataCoroutine.GetFieldByName("<>f__this"); MethodDefinition gameObjectGetMethod = unityModule.GetTypeByName("Component").GetPropertyByName("gameObject").GetMethod; Instruction[] instructions = new Instruction[] { Instruction.Create(OpCodes.Ldarg_0), Instruction.Create(OpCodes.Ldfld, GameModule.Import(f_thisField)), Instruction.Create(OpCodes.Ldc_I4_0), Instruction.Create(OpCodes.Callvirt, GameModule.Import(toggleShipVisual)) }; ILProcessor processor = moveNextMethod.Body.GetILProcessor(); Instruction lastInstruction = moveNextMethod.Body.Instructions.Where(i => i.OpCode == OpCodes.Callvirt && ((MethodReference)i.Operand).Name.Contains("set_position")).FirstOrDefault(); foreach (Instruction ins in instructions) { processor.InsertAfter(lastInstruction, ins); lastInstruction = ins; } }
public override void Inject() { GameModule.GetTypes().ToList().ForEach(t => { if (!t.IsNested) { t.IsPublic = true; InjectionHelper.Instance.CreateModMethods(t); } else { t.IsNestedPublic = true; } }); GameModule.GetTypes().ToList().ForEach(t => { t.Methods.ToList().ForEach(m => { if (m.IsPrivate) { m.IsFamily = true; } }); }); GameModule.GetTypes().ToList().ForEach(t => { t.Fields.ToList().ForEach(f => { if (f.IsPrivate) { f.IsFamily = true; } }); }); }
public static int FindPattern(IntPtr _handle, string pattern_str, GameModule module, bool sub, int offset = 0, bool read = false, int startAddress = 0) { var returnvalue = FindPatternEx(_handle, pattern_str, module, sub, offset, read, startAddress); GC.Collect(); return(returnvalue); }
private IGameModule CreateSystems(Contexts contexts) { GameModule module = new GameModule(); module.AddSystem(new InitMapIdSystem(contexts)); return(module); }
public T GetModule <T>() where T : GameModule { GameModule kGameModule = null; m_GameModuleDic.TryGetValue(typeof(T), out kGameModule); return(kGameModule as T); }
public override void Inject() { TypeDefinition ManagerDef = GameModule.GetTypeByName("ManagerOptions"); ChangeGameTitle(); NewPanelOpened(); }
/// <summary> /// Fixes a bug where crewmembers tries to find a tile outside the tile map (Position -444, -444). /// </summary> private void AI_anyPartOnFire_Fix() { TypeDefinition AIDef = GameModule.GetTypeByName("AI"); MethodDefinition anyPartOnFireDef = AIDef.GetMethodByName("anyPartOnFire"); ILProcessor il = anyPartOnFireDef.Body.GetILProcessor(); Instruction[] ending = new Instruction[] { Instruction.Create(OpCodes.Ldc_I4_0), Instruction.Create(OpCodes.Ret) }; il.Append(ending[0]); il.Append(ending[1]); Instruction[] beginning = new Instruction[] { Instruction.Create(OpCodes.Ldarg_1), Instruction.Create(OpCodes.Ldarg_2), Instruction.Create(OpCodes.Add), Instruction.Create(OpCodes.Ldc_I4, -888), Instruction.Create(OpCodes.Ceq), Instruction.Create(OpCodes.Brtrue, ending[0]) }; Instruction last = il.Body.Instructions[0]; for (int i = beginning.Length - 1; i >= 0; i--) { il.InsertBefore(last, beginning[i]); last = beginning[i]; } }
/// <summary> /// Fixes the graphical bug where the enemy ship is "spawned" beneath the player ship after it is destroyed. /// </summary> private void ManagerOptions_flyEnemyOutOfSceneCR_Fix() { TypeDefinition managerOptions = GameModule.GetTypeByName("ManagerOptions"); TypeDefinition flyEnemyOutOfSceneCR = managerOptions.NestedTypes.Where(t => t.Name.Contains("flyEnemyOutOfSceneCR")).FirstOrDefault(); TypeDefinition bugFixes = ModLibModule.GetTypeByName("__BugFixes"); MethodDefinition toggleShipVisual = bugFixes.GetMethodByName("ToggleShipVisual"); MethodDefinition moveNextMethod = flyEnemyOutOfSceneCR.GetMethodByName("MoveNext"); FieldDefinition f_thisField = flyEnemyOutOfSceneCR.GetFieldByName("<>f__this"); FieldDefinition enemyShipField = f_thisField.FieldType.Resolve().GetFieldByName("EnemyShip"); Instruction[] instructions = new Instruction[] { Instruction.Create(OpCodes.Ldarg_0), Instruction.Create(OpCodes.Ldfld, GameModule.Import(f_thisField)), Instruction.Create(OpCodes.Ldfld, GameModule.Import(enemyShipField)), Instruction.Create(OpCodes.Ldc_I4_0), Instruction.Create(OpCodes.Callvirt, GameModule.Import(toggleShipVisual)) }; ILProcessor processor = moveNextMethod.Body.GetILProcessor(); Instruction lastInstruction = moveNextMethod.Body.Instructions.Where(i => i.OpCode == OpCodes.Callvirt && ((MethodReference)i.Operand).Name.Contains("playSoundEnemyWarpOut")).FirstOrDefault(); foreach (Instruction ins in instructions) { processor.InsertAfter(lastInstruction, ins); lastInstruction = ins; } }
static void Main(string[] args) { NinjectModule gameModule = new GameModule(); NinjectModule serviceModule = new ServiceModule(); var kernel = new StandardKernel(gameModule, serviceModule); var gameService = kernel.Get <IGameService>(); var pl = new PlayerViewModel(); pl.PlayerBornDate = DateTime.Now.Subtract(TimeSpan.FromDays(365 * 17)); pl.PlayerFio = "Vasya"; pl.PlayerGender = StandingTables.BLL.ViewModels.genderType.female; pl.PlayerWeight = 110; pl.PlayerHeight = 112; pl.City = "Town"; pl.PlayerCategory = gameService.categoriesVM.FirstOrDefault(); pl.Club = "de"; gameService.InputCard(pl); pl = new PlayerViewModel(); pl.PlayerBornDate = DateTime.Now.Subtract(TimeSpan.FromDays(365 * 17)); pl.PlayerFio = "Vasya2"; pl.PlayerGender = StandingTables.BLL.ViewModels.genderType.female; pl.PlayerWeight = 110; pl.PlayerHeight = 115; pl.City = "Town2"; pl.PlayerCategory = gameService.categoriesVM.FirstOrDefault(); pl.Club = "de2"; gameService.InputCard(pl); pl = new PlayerViewModel(); pl.PlayerBornDate = DateTime.Now.Subtract(TimeSpan.FromDays(365 * 17)); pl.PlayerFio = "Vasya3"; pl.PlayerGender = StandingTables.BLL.ViewModels.genderType.female; pl.PlayerWeight = 110; pl.PlayerHeight = 115; pl.City = "Town2"; pl.PlayerCategory = gameService.categoriesVM.FirstOrDefault(); pl.Club = "de3"; gameService.InputCard(pl); //-------------------- var players = gameService.GetAllPlayers(); var selectedItems = from player in players group player by player.PlayerCategory; foreach (var el in selectedItems) { Console.WriteLine(el.Key.CategoryValue + "-" + el.Key.CategoryAge); foreach (var s in el) { Console.WriteLine(s.PlayerAgeCategory + "-" + s.PlayerFio + "-" + s.PlayerCategory.CategoryValue); gameService.AddStandingRawRecord(s, 1, 1); } } //gameService.GenerateStandingsRaw(); //---------------------- }
private void Select_Click(object sender, EventArgs e) { string id = listView2.FocusedItem.SubItems[0].Text; GameModule.SelectWarcraft(Convert.ToInt32(id)); MessageBox.Show(id + "프로세스 실행"); Close(); }
protected override void LaunchInProductionMode() { // 生产逻辑 // 加载资源 // 初始化 SDK // 点击开始游戏 GameModule.LoadModule(); }
protected override void LaunchInTestMode() { // 测试逻辑 // 加载资源 // 初始化 SDK // 点击开始游戏 GameModule.LoadModule(); }
public static GameModule Instance() { if (s_Inst == null) { s_Inst = new GameModule(); } return(s_Inst); }
private IGameModule CreateSystems(Contexts contexts, ISessionState sessionState) { GameModule module = new GameModule(); module.AddSystem(new InitMapIdSystem(contexts)); module.AddSystem(new GlobalEffectManagerInitSystem(contexts, sessionState)); return(module); }
public void OnDialogOpened(IDialogParameters parameters) { if (parameters.GetValue <GameModule>("GameModule") != null) { _game = parameters.GetValue <GameModule>("GameModule"); } _logger.Info("Opened"); }
public DaprController( GameModule module, ILogger <DaprController> logger, Func <string, Type> typeResolver) { this.module = module; this.logger = logger; this.typeResolver = typeResolver; }
public void BLLtest() { NinjectModule gameModule = new GameModule(); NinjectModule serviceModule = new ServiceModule(); var kernel = new StandardKernel(gameModule, serviceModule); var gameService = kernel.Get <IGameService>(); gameService.FillCategoriesIfNotExist(); //gameService.InitCategories(); }
public void GetTerrariaMods_ShouldReturnStringArray() { string mods = "[\"FastStart\",\"HelpfulNPCs\",\"LootBags\",\"MagicStorage\"]"; string[] expect = JsonConvert.DeserializeObject <string[]>(mods); string[] actual = GameModule.GetTerrariaMods("debug.json"); Assert.Equal(expect, actual); }
public static void Configure() { var gameModule = new GameModule(); var serviceModule = new ServiceModule("Connection"); var webModule = new WebModule(); var kernel = new StandardKernel(gameModule, serviceModule, webModule); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); }
private bool OutOfAnswers(GameModule gm) { foreach (GameAnswer ga in gm.Answers) { if (ga.Pictures.Count == 0) { return(false); } } return(true); }
public void Write(GameModule module) { if (module != null && module.ID != GameModule.UnspecifiedID) { Write(module.ID); } else { Write((uint)0); } }
// Use this for initialization void Start() { game = GameObject.Find("GameModule").GetComponent <GameModule>(); totalDrones.text = game.noteTotal.ToString(); hitDrones.text = game.hitTotal.ToString(); continueFunction.onClick.AddListener(continueSong); restart.onClick.AddListener(restartSong); _menu.onClick.AddListener(goToMenu); }
public override void Inject() { TypeDefinition ManagerDef = GameModule.GetTypeByName("ManagerOptions"); TypeDefinition ModGUIDef = ModLibModule.GetTypeByName("ModGUI"); MethodDefinition CreateModGUIMethod = ModGUIDef.GetMethodByName("__Create"); MethodDefinition ManagerStartMethod = ManagerDef.GetMethodByName("Start"); ManagerStartMethod.Body.GetILProcessor().InjectInstructionsToEnd(new Instruction[] { Instruction.Create(OpCodes.Callvirt, GameModule.Import(CreateModGUIMethod)), }); }
public override void Inject() { TypeDefinition ModLoaderDef = ModLibModule.GetTypeByName("ModLoader"); TypeDefinition ManagerDef = GameModule.GetTypeByName("ManagerOptions"); TypeDefinition GameEventsDef = ModLibModule.GetTypeByName("GameEvents"); InjectModLoaderField(ModLoaderDef, ManagerDef); InjectModLoaderLoadMods(ModLoaderDef, ManagerDef); InjectModLoaderGameStarted(GameEventsDef, ManagerDef); InjectModLoaderGameLoaded(GameEventsDef, ManagerDef); InjectModLoaderGameSaved(GameEventsDef, ManagerDef); }
private void OnOpenNexusCommand(GameModule gameModule) { _logger.Info($"Opening {gameModule.Url}"); var psi = new ProcessStartInfo { FileName = gameModule.Url, UseShellExecute = true }; Process.Start(psi); }
static int QPYX_SetRendererSortingOrder_YXQP(IntPtr L_YXQP) { try { ToLua.CheckArgsCount(L_YXQP, 1); GameModule QPYX_obj_YXQP = (GameModule)ToLua.CheckObject <GameModule>(L_YXQP, 1); QPYX_obj_YXQP.SetRendererSortingOrder(); return(0); } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
private void InjectModLoaderGameSaved(TypeDefinition gameEventsDef, TypeDefinition managerDef) { MethodDefinition GameSavedMethod = gameEventsDef.GetMethodByName("__OnGameSaved"); MethodDefinition ManagerSaveGameIntoSlotMethod = managerDef.GetMethodByName("saveGameIntoSlot"); List <Instruction> Instructions = new List <Instruction>() { Instruction.Create(OpCodes.Ldarg_1), Instruction.Create(OpCodes.Callvirt, GameModule.Import(GameSavedMethod)) }; ManagerSaveGameIntoSlotMethod.Body.GetILProcessor().InjectInstructionsToEnd(Instructions); }
private void OnOpenGameSettingsCommand(GameModule gameModule) { _logger.Info("Opening game settings dialog"); DialogParameters dp = new DialogParameters { { "Title", gameModule.Title }, { "GameSettings", gameModule.Settings } }; _dialogService.ShowDialog(nameof(GameSettingsDialog), dp, null); gameModule.Settings = ConfigurationManager <GameSettings> .LoadSettings(new GameSettings(gameModule.Module).GetFullPath()); }
public override void Inject() { TypeDefinition saveLoadDataType = ModLibModule.GetTypeByName("SaveLoadData"); MethodDefinition saveLoadInitMethod = saveLoadDataType.GetMethodByName("__Init"); TypeDefinition ES2InitType = GameModule.GetTypeByName("ES2Init"); MethodDefinition ES2InitMethod = ES2InitType.GetMethodByName("Init"); Instruction insertAfter = ES2InitMethod.Body.Instructions[ES2InitMethod.Body.Instructions.Count - 4]; ES2InitMethod.Body.GetILProcessor().InsertAfter(insertAfter, new Instruction[] { Instruction.Create(OpCodes.Callvirt, GameModule.Import(saveLoadInitMethod)) }); }
private void ChangeGameTitle() { TypeDefinition ManagerMenuDef = GameModule.GetTypeByName("ManagerMenu"); MethodDefinition Method = ManagerMenuDef.GetMethodByName("createMainMenuBackground"); foreach (Instruction I in Method.Body.Instructions) { if (I.OpCode == OpCodes.Ldstr && I.Operand.ToString() == "STARSHIP THEORY") { I.Operand = "STARSHIP THEORY - MODDED"; break; } } }