예제 #1
0
 public void SplashMod(Func <string, object, object> api = null)
 {
     SetApi(api);
     if (PatchTelemetry(GameAssembly?.GetType("AmplitudeWebClient") ?? typeof(PhoenixTelemetry)))
     {
         // Disable tele button
         TryPatch(typeof(UIModuleGameplayOptionsPanel), "Show", postfix: nameof(DisableTeleToggle));
     }
 }
예제 #2
0
        public Type GetAssemblyType(string namespaceName, string className)
        {
            try
            {
                Type type = GameAssembly.GetType(namespaceName + "." + className);

                return(type);
            }
            catch (Exception ex)
            {
                LogManager.ErrorLog.WriteLine(ex);
                return(null);
            }
        }
예제 #3
0
        internal static void EnterEvalMode(IConsole console)
        {
            if (EvalPatch != null)
            {
                return;
            }
            var me = new ConsoleShell();

            ReadPatch = me.TryPatch(GameAssembly.GetType("Base.Utils.GameConsole.CommandLineParser"), "ReadCommandLine", nameof(BeforeReadCommandLine_Eval));
            EvalPatch = me.TryPatch(GameAssembly.GetType("Base.Utils.GameConsole.EmptyCommand"), "Execute", postfix: nameof(AfterExecute_Eval));
            if (ReadPatch == null || EvalPatch == null)
            {
                Unpatch(ref ReadPatch);
                Unpatch(ref EvalPatch);
                return;
            }
            ShowLinePatch = me.TryPatch(typeof(GameConsoleWindow).GetMethod("ExecuteCommandLine", new Type[] { typeof(string), typeof(bool), typeof(bool) }),
                                        prefix: nameof(BeforeExecuteCommandLine_ShowLine));
            SetConsoleInputPlaceholder("Enter C# expression...", Color.blue);
            console.Write("Entering C# Shell.  Type 'Exit' to return.");
        }
예제 #4
0
파일: Main.cs 프로젝트: jcoder58/Plugins
        private static void CallStartFunction(string gameInstanceClass, string argument, IntPtr gameInsteance)
        {
            try {
                var dir       = Environment.CurrentDirectory;
                var classType = GameAssembly.GetType(gameInstanceClass);
                var baseType  = classType.BaseType;
                var gameStart = classType.GetMethod("Start");

                if (classType != null && classType.IsSubclassOf(typeof(DotNetGameInstance)))
                {
                    GameInstance = (DotNetGameInstance)UObject.Make(gameInsteance, classType);
                    GameInstance.Start(argument);
                }
                else
                {
                    Log.Fatal($"Class {gameInstanceClass} not found or is not subclass of DotNetGameInstance");
                }
            } catch (Exception ex) {
                Log.Fatal($"Calling '{gameInstanceClass}( \"{argument}\" );' threw exception {ex.ToString()}");
            }
        }