/// <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;
                    }
                });
            });
        }
Пример #3
0
        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);
        }
Пример #5
0
    public T GetModule <T>() where T : GameModule
    {
        GameModule kGameModule = null;

        m_GameModuleDic.TryGetValue(typeof(T), out kGameModule);
        return(kGameModule as T);
    }
Пример #6
0
        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;
            }
        }
Пример #9
0
        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();

            //----------------------
        }
Пример #10
0
        private void Select_Click(object sender, EventArgs e)
        {
            string id = listView2.FocusedItem.SubItems[0].Text;

            GameModule.SelectWarcraft(Convert.ToInt32(id));
            MessageBox.Show(id + "프로세스 실행");
            Close();
        }
Пример #11
0
 protected override void LaunchInProductionMode()
 {
     // 生产逻辑
     // 加载资源
     // 初始化 SDK
     // 点击开始游戏
     GameModule.LoadModule();
 }
Пример #12
0
 protected override void LaunchInTestMode()
 {
     // 测试逻辑
     // 加载资源
     // 初始化 SDK
     // 点击开始游戏
     GameModule.LoadModule();
 }
Пример #13
0
 public static GameModule Instance()
 {
     if (s_Inst == null)
     {
         s_Inst = new GameModule();
     }
     return(s_Inst);
 }
Пример #14
0
        private IGameModule CreateSystems(Contexts contexts, ISessionState sessionState)
        {
            GameModule module = new GameModule();

            module.AddSystem(new InitMapIdSystem(contexts));
            module.AddSystem(new GlobalEffectManagerInitSystem(contexts, sessionState));
            return(module);
        }
Пример #15
0
        public void OnDialogOpened(IDialogParameters parameters)
        {
            if (parameters.GetValue <GameModule>("GameModule") != null)
            {
                _game = parameters.GetValue <GameModule>("GameModule");
            }

            _logger.Info("Opened");
        }
Пример #16
0
 public DaprController(
     GameModule module,
     ILogger <DaprController> logger,
     Func <string, Type> typeResolver)
 {
     this.module       = module;
     this.logger       = logger;
     this.typeResolver = typeResolver;
 }
Пример #17
0
        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();
        }
Пример #18
0
        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);
        }
Пример #19
0
        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));
        }
Пример #20
0
 private bool OutOfAnswers(GameModule gm)
 {
     foreach (GameAnswer ga in gm.Answers)
     {
         if (ga.Pictures.Count == 0)
         {
             return(false);
         }
     }
     return(true);
 }
Пример #21
0
 public void Write(GameModule module)
 {
     if (module != null && module.ID != GameModule.UnspecifiedID)
     {
         Write(module.ID);
     }
     else
     {
         Write((uint)0);
     }
 }
Пример #22
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);
    }
Пример #23
0
        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);
        }
Пример #25
0
        private void OnOpenNexusCommand(GameModule gameModule)
        {
            _logger.Info($"Opening {gameModule.Url}");

            var psi = new ProcessStartInfo
            {
                FileName        = gameModule.Url,
                UseShellExecute = true
            };

            Process.Start(psi);
        }
Пример #26
0
 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);
        }
Пример #28
0
        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());
        }
Пример #29
0
        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))
            });
        }
Пример #30
0
        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;
                }
            }
        }