コード例 #1
0
        public MacroMain(RSGame game)
        {
            window = new MainWindow(game, this);
            window.Show();

            scriptController = new ScriptController(this);

            RSMacroProgram.Api.Configuration.game = game;
            /*var engine = new ScriptEngine();
            var session = engine.CreateSession();

            session.Execute(@"System.Console.WriteLine(""Hello Roslyn"");");*/

            if (gameProcess != null) setOverlay(gameProcess);
        }
コード例 #2
0
        public MainWindow(RSGame game, MacroMain main)
        {
            /*this.game = game;
            this.gameProcess = process;

            InitializeComponent();

            consoleOutput.AppendText(Environment.NewLine);

            TextWriter t = Console.Out;
            Console.SetOut(new TextBoxWriter(consoleOutput));

            consoleOutput.IsReadOnly = true;

            selectProcess.Click += new RoutedEventHandler(printaline);*/
            init(game, main);
        }
コード例 #3
0
        void init(RSGame game, MacroMain main)
        {
            this.main = main;

            this.random = new Random();

            InitializeComponent();

            consoleOutput.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            //consoleOutput.AppendText(Environment.NewLine);

            foreach (Process p in Process.GetProcesses()) {
                ProcessItem i = new ProcessItem(p);
                processSelectBox.Items.Add(i);
                if (p.ProcessName == Util.launcherName) {
                    processSelectBox.SelectedItem = i;
                    main.setOverlay(p);
                    break;
                }
            }
            /*if(main.gameProcess != null) {
                main.overlay = new WindowOverlay(main.gameProcess);
                main.overlay.Show();
                this.mouse = main.overlay.MouseInstance;
                this.mouse.Enable();
            }*/

            foreach (RSGame g in RSGame.games) {
                MenuItem item = new MenuItem();
                item.Header =  g.getName();
                item.IsCheckable = true;
                item.Click += new RoutedEventHandler(setGame);
                if (g.Equals(game))
                    item.IsChecked = true;
                gameMenu.Items.Add(item);
            }

            mouseHook = IntPtr.Zero;

            gameString = (String)lblGame.Content;
            scriptString = (String)lblScript.Content;
            authorString = (String)lblAuthor.Content;
            descString = (String)lblDesc.Content;

            lblGame.Content += game.getName();
            Closing += onClose;

            //TextWriter t = Console.Out;
            //Console.SetOut(new TextBoxWriter(consoleOutput));

            consoleOutput.IsReadOnly = true;

            Polygon pol = new Polygon();
            pol.Stroke = System.Windows.Media.Brushes.Black;
            pol.Fill = System.Windows.Media.Brushes.LightSeaGreen;
            pol.StrokeThickness = 2;
            pol.HorizontalAlignment = HorizontalAlignment.Left;
            pol.VerticalAlignment = VerticalAlignment.Center;
            Point p1 = new Point(10, 10);
            Point p2 = new Point(100, 15);
            Point p3 = new Point(86, 40);
            Point p4 = new Point(136, 76);
            PointCollection col = new PointCollection();
            col.Add(p1);
            col.Add(p2);
            col.Add(p3);
            col.Add(p4);
            pol.Points = col;

            //processCanvas.Children.Add(pol);

            //selectProcess.Click += new RoutedEventHandler(selectTheProcess);
            //refreshProcess.Click += new RoutedEventHandler(refreshProcesses);
            this.KeyDown += MainWindow_KeyDown;
        }