主要是玩求生之路2这个游戏 发现网上有C#的源码 但是奈何看不懂
这里想请教各位大佬能不能帮我把这段代码转易语言啊
[C#] 纯文本查看 复制代码 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Memory;
namespace 求生之路2
{
public partial class Form1 : Form
{
Mem m = new Mem();
[DllImport("user32.dll")]
static extern short GetAsyncKeyState(Keys vKey);
[DllImport("user32")]
private static extern int mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
//移动鼠标
const int MOUSEEVENTF_MOVE = 0x0001;
//模拟鼠标左键按下
const int MOUSEEVENTF_LEFTDOWN = 0x0002;
//模拟鼠标左键抬起
const int MOUSEEVENTF_LEFTUP = 0x0004;
//模拟鼠标右键按下
const int MOUSEEVENTF_RIGHTDOWN = 0x0008;
//模拟鼠标右键抬起
const int MOUSEEVENTF_RIGHTUP = 0x0010;
//模拟鼠标中键按下
const int MOUSEEVENTF_MIDDLEDOWN = 0x0020;
//模拟鼠标中键抬起
const int MOUSEEVENTF_MIDDLEUP = 0x0040;
//标示是否采用绝对坐标
const int MOUSEEVENTF_ABSOLUTE = 0x8000;
//模拟鼠标滚轮滚动操作,必须配合dwData参数
const int MOUSEEVENTF_WHEEL = 0x0800;
string JUMP = "client.dll+0x757DF0";//内存位置
string AIR = "client.dll+0x6E1008";//内存位置
int result;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
int PID = m.GetProcIdFromName("left4dead2");
if (PID > 0)
{
m.OpenProcess(PID);
Thread BH = new Thread(BHOP) { IsBackground = true };
BH.Start();
Thread SK = new Thread(SUKAN) { IsBackground = true };
SK.Start();
Thread LD = new Thread(LIANDIAN) { IsBackground = true };
LD.Start();
label9.Text = "已运行游戏";
label9.ForeColor = Color.Red;
}
}
void BHOP()
{
while (true)
{
if (checkBox1.Checked)
{
if (GetAsyncKeyState(Keys.Space) < 0)
{
result = m.ReadInt(AIR);
if (result == 0)
{
m.WriteMemory(JUMP, "int", "5");
Thread.Sleep(20);
m.WriteMemory(JUMP, "int", "4");
}
}
}
Thread.Sleep(1);
}
}
void SUKAN()
{
while (true)
{
if (checkBox2.Checked)
{
if (GetAsyncKeyState(Keys.XButton1) < 0)
{
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Thread.Sleep(10);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
Thread.Sleep(35);
mouse_event(MOUSEEVENTF_WHEEL, 0, 0, 1, 0);
Thread.Sleep(35);
mouse_event(MOUSEEVENTF_WHEEL, 0, 0, -1, 0);
Thread.Sleep(500);
}
}
Thread.Sleep(1);
}
}
void LIANDIAN()
{
while (true)
{
if (checkBox3.Checked)
{
if (GetAsyncKeyState(Keys.XButton2) < 0)
{
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Thread.Sleep(50);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
Thread.Sleep(50);
}
}
Thread.Sleep(1);
}
}
private void button1_Click(object sender, EventArgs e)
{
Form2 newForm = new Form2();//声明新窗体,Formmain是已设计好的并列窗体
newForm.Show();//打开新窗体
}
}
}
|