C#Windows窗体应用程序| Cookie Clicker
我想做一个饼干制造商! 它工作得很好,但每次我点击cookie时,只需点击两次,就可以将一个添加到cookie计数中。我想让计数系统运行得更快,因为如果我每秒点击2次,它将只作为一台atm机计数 代码:C#Windows窗体应用程序| Cookie Clicker,c#,C#,我想做一个饼干制造商! 它工作得很好,但每次我点击cookie时,只需点击两次,就可以将一个添加到cookie计数中。我想让计数系统运行得更快,因为如果我每秒点击2次,它将只作为一台atm机计数 代码: 使用系统; 使用System.Collections.Generic; 使用系统组件模型; 使用系统数据; 使用系统图; 使用System.Linq; 使用系统文本; 使用System.Threading.Tasks; 使用System.Windows.Forms; 使用系统线程; 名称空间格式
使用系统;
使用System.Collections.Generic;
使用系统组件模型;
使用系统数据;
使用系统图;
使用System.Linq;
使用系统文本;
使用System.Threading.Tasks;
使用System.Windows.Forms;
使用系统线程;
名称空间格式库
{
公共部分类Form1:Form
{
int cnum=0;
int-add=1;
公共表格1()
{
初始化组件();
标签1.Text=(“鼠标价格:“+”50”);
textBox1.Text=(“Cookies:+”+cnum);
mouse.Enabled=false;
对于(int i=0;i1&&添加%2==0)
{
cnum+=1*相加;
}
睡眠(1000);
}
}
私有void textBox1\u TextChanged(对象发送方,事件参数e)
{
}
私有无效按钮1\u单击(对象发送者,事件参数e)
{
//老鼠
如果(cnum>=add*add*50)
{
cnum-=(加上*100);
加法+=2;
}
}
私有无效按钮2\u单击(对象发送者,事件参数e)
{
Application.Restart();
}
私有无效按钮3\u单击(对象发送者,事件参数e)
{
Application.Exit();
}
私有无效图片单击(对象发送方,事件参数e)
{
如果(cnum>=(添加*添加*50))
{
mouse.Enabled=true;
}
其他的
{
mouse.Enabled=false;
}
cnum+=(添加*添加);
textBox1.Text=(“Cookies:+”+cnum);
label1.Text=(“鼠标价格:+”+(添加*添加*50));
}
私有无效标签1_单击(对象发送方,事件参数e)
{
}
私有无效图片单击(对象发送者,鼠标目标)
{
}
}
}
此外,我认为这与鼠标单击事件有关。当前事件只是正常的单击事件。我需要换这个吗?此外,此行(pictureBox1\u Click)指的是cookie图片。请尝试MouseLeftButtonDown
事件,而不是单击
。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
namespace FormalCookie
{
public partial class Form1 : Form
{
int cnum = 0;
int add = 1;
public Form1()
{
InitializeComponent();
label1.Text = ("Price For Mouse:" + " 50");
textBox1.Text = ("Cookies:" + " " + cnum);
mouse.Enabled = false;
for (int i = 0; i< add; i++)
{
if (add > 1 && add % 2 == 0)
{
cnum += 1 * add;
}
Thread.Sleep(1000);
}
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
//Mouse
if (cnum >= add * add * 50)
{
cnum -= (add * 100);
add+=2;
}
}
private void button2_Click(object sender, EventArgs e)
{
Application.Restart();
}
private void button3_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
if (cnum >= (add * add * 50))
{
mouse.Enabled = true;
}
else
{
mouse.Enabled = false;
}
cnum += (add * add);
textBox1.Text = ("Cookies:" + " " + cnum);
label1.Text = ("Price For Mouse:" + " " + (add * add * 50));
}
private void label1_Click(object sender, EventArgs e)
{
}
private void pictureBox1_Click(object sender, MouseEventArgs e)
{
}
}
}