前几天做的修仙小游戏大更新啦,现在增加了出生经历,功法系统,法宝系统,宗门系统,具体的见下图吧。
整个游戏借鉴了一款手机上的小游戏,不过我忘记叫什么名字了。顺便说一句,游戏中含有许多彩蛋哦~
界面
功法获得所需要的修为会随境界增加而增加,每一个功法和法宝的功能都不一样。功法和法宝都是可以无限获取的
目前各个系统之间的数值还不怎么平衡,以后有时间再慢慢修改吧
下图是文件相关
下面就是整个程序的源代码啦
主程序代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.VisualBasic;
namespace xiuxian
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private int seconds = 0;
int t1 = 1, t2 = 0, q1 = 1, q2 = 0;//点击和每秒增加的数量和倍数
double t3 = 1, q3 = 1;
int s = 0, c = 0;//声望和财富每秒增加数量
int year=0;//每秒额外消耗寿元
int sou = 0;//每秒额外增加寿元
int z;//宗门代号
int z1=0;//判断是否加入了宗门
private void shengji1_Click(object sender, EventArgs e)
{
if(GlobalVariable.xiuwei >= (long)Math.Pow(10, GlobalVariable.t))
{
GlobalVariable.xiuwei -= (long)Math.Pow(10, GlobalVariable.t);
xiu.Text = "修为:" + GlobalVariable.xiuwei;
GlobalVariable.t += 1;
shengji1.Text = (long)Math.Pow(10, GlobalVariable.t) + "修为突破炼体境界";
}
else
{
MessageBox.Show("修为不足");
}
yongheng();
}
private void shengji2_Click(object sender, EventArgs e)
{
if (GlobalVariable.xiuwei >= (long)Math.Pow(10, GlobalVariable.q))
{
GlobalVariable.xiuwei -= (long)Math.Pow(10, GlobalVariable.q);
xiu.Text = "修为:" + GlobalVariable.xiuwei;
GlobalVariable.q += 1;
shengji2.Text = (long)Math.Pow(10, GlobalVariable.q) + "修为突破练气境界";
}
else
{
MessageBox.Show("修为不足");
}
yongheng();
}
private void timer1_Tick(object sender, EventArgs e)
{
GlobalVariable.jingjie = (GlobalVariable.t + GlobalVariable.q) / 2;
seconds+=1+year; // 秒数增加
GlobalVariable.sou += sou;
GlobalVariable.sou = GlobalVariable.jingjie * 100;
if (GlobalVariable.t >= 14 || GlobalVariable.q >= 14)
{
souyuan.Text = "寿元∞" + "/" + (seconds + 16).ToString(); // 显示秒数
}
else
{
souyuan.Text = "寿元:" + GlobalVariable.sou + "/" + (seconds + 16).ToString(); // 显示秒数
}
if (GlobalVariable.sou < (seconds + 16))
{
timer1.Stop();
MessageBox.Show("你寿元已到,证长生失败");
this.Close();
}
GlobalVariable.shengwang += s;
GlobalVariable.caifu+= c;
GlobalVariable.xiuwei += (long)Math.Pow(5, GlobalVariable.q -2)*q1+q2;
//数据更新
xiu.Text = "修为:" + GlobalVariable.xiuwei;
shengwang.Text = "声望:" + GlobalVariable.shengwang;
caifu.Text = "财富:" + GlobalVariable.caifu;
label1.Text = "每次修为+" + ((Math.Pow(5, GlobalVariable.t - 1) * t1 + t2)*t3);
label2.Text = "每秒修为+" + ((Math.Pow(5, GlobalVariable.q - 2) * q1 + q2)*q3);
label7.Text = "需要" + (long)Math.Pow(10, GlobalVariable.t + 1) + "修为";
label8.Text = "需要" + (long)Math.Pow(10, GlobalVariable.q + 1) + "修为";
Lianti();
Lianqi();
}
private void Form1_Load(object sender, EventArgs e)
{
timer1.Start(); // 启动计时器
//状态显示
label10.Text = "名字:" + GlobalVariable.name;
xiu.Text = "修为:" + GlobalVariable.xiuwei;
shengwang.Text = "声望:" + GlobalVariable.shengwang;
caifu.Text = "财富:" + GlobalVariable.caifu;
}
private void lianti_Click(object sender, EventArgs e)
{
GlobalVariable.xiuwei += (long)Math.Pow(5, GlobalVariable.t -1)*t1+t2;
xiu.Text = "修为:" + GlobalVariable.xiuwei;
}
//境界显示
public void Lianti()
{
switch(GlobalVariable.t)
{
case 1: ti.Text = "开始炼体"; break;
case 2: ti.Text = "练皮"; break;
case 3: ti.Text = "练肉"; break;
case 4: ti.Text = "换血"; break;
case 5: ti.Text = "锻骨"; break;
case 6: ti.Text = "锻脏"; break;
case 7: ti.Text = "金刚"; break;
case 8: ti.Text = "搬山"; break;
case 9: ti.Text = "移海"; break;
case 10: ti.Text = "破虚"; break;
case 11: ti.Text = "重生"; break;
case 12: ti.Text = "圣体"; break;
case 13: ti.Text = "神体"; break;
case 14: ti.Text = "不堕轮回"; break;
case 15: ti.Text = "永世不灭"; break;
default: ti.Text = "永恒"; break;
}
}
public void Lianqi()
{
switch (GlobalVariable.q)
{
case 1: qi.Text = "开始练气"; break;
case 2: qi.Text = "气感"; break;
case 3: qi.Text = "筑基"; break;
case 4: qi.Text = "结晶"; break;
case 5: qi.Text = "金丹"; break;
case 6: qi.Text = "元婴"; break;
case 7: qi.Text = "分神"; break;
case 8: qi.Text = "合体"; break;
case 9: qi.Text = "渡劫"; break;
case 10: qi.Text = "大乘"; break;
case 11: qi.Text = "飞升"; break;
case 12: qi.Text = "地仙"; break;
case 13: qi.Text = "金仙"; break;
case 14: qi.Text = "大罗金仙"; break;
case 15: qi.Text = "混元天尊"; break;
default: qi.Text = "永恒"; break;
}
}
//证道提示
public void yongheng()
{
if (GlobalVariable.t == 14 || GlobalVariable.q == 14)
{
souyuan.Text = "寿元∞" + "/" + (seconds / 10 + 16).ToString(); // 显示秒数
MessageBox.Show("你已证得永生,寿元将无穷无尽");
}
else if (GlobalVariable.t == 16 || GlobalVariable.q == 16)
{
MessageBox.Show("恭喜您,已经成为永恒存在!!!");
}
else if (GlobalVariable.t == 17 || GlobalVariable.q == 17)
{
MessageBox.Show("天地灭而你不灭!!!");
}
else if (GlobalVariable.t >= 18 || GlobalVariable.q >= 18)
{
MessageBox.Show("日月亡而你不亡!!!");
}
}
private void button6_Click(object sender, EventArgs e)
{
MessageBox.Show(GlobalVariable.name);
}
//功法
public void liangtigongfa(int a)
{
switch(a)
{
case 0:
{
t2 += 1000;
textBox4.Text += "法天相地(每次点击+1000)\n";
}break;
case 1:
{
t1++;
textBox4.Text += "七十二变(每次点击额外获得一次炼体修为)\r\n";
}
break;
case 2:
{
t2 += 100;
textBox4.Text += "第二套广播体操:时代在召唤(每次点击+100)\r\n";
}
break;
case 3:
{
t2 += 100;
textBox4.Text += "第二套广播体操:青春的活力(每次点击+100)\r\n";
}
break;
case 4:
{
t2 += 100;
textBox4.Text += "第三套广播体操:舞动青春(每次点击+100)\r\n";
}
break;
case 5:
{
t2 += 100;
textBox4.Text += "第三套广播体操:放飞理想(每次点击+100)\r\n";
}
break;
case 6:
{
t2 += 1000;
textBox4.Text += "八极天(每次点击+1000)\r\n";
}
break;
case 7:
{
year++;
t2 += 1000;
textBox4.Text += "燃寿决(每次点击+10000,每秒寿元-1)\r\n";
}
break;
case 8:
{
t2 += 10000;
textBox4.Text += "盘古金身(每次点击+10000)\r\n";
}
break;
}
}
public void liangqigongfa(int a)
{
switch (a)
{
case 0:
{
q2 += 1000;
textBox3.Text += "五行混沌决(每秒修为+1000)\r\n";
}
break;
case 1:
{
q2 += 10;
textBox3.Text += "吐纳功(每秒修为+10)\r\n";
}
break;
case 2:
{
q1 += 1;
textBox3.Text += "焚决(每秒额外获得一次境界修为)\r\n";
}
break;
case 3:
{
s += 1;
textBox3.Text += "正气决(每秒获得声望一点)\r\n";
}
break;
case 4:
{
c += 1;
textBox3.Text += "聚财大法\r\n";
}
break;
case 5:
{
q2 += 100;
textBox3.Text += "大衍决(每秒修为+100)\r\n";
}
break;
case 6:
{
q2 -= 100;
textBox3.Text += "聚财大法.魔(每秒减少修为100,获得财富+2)\r\n";
}
break;
case 7:
{
q1 += 2;
year++;
textBox3.Text += "烬寿决(每秒减少寿命1,额外获得两次境界修为)\r\n";
}
break;
case 8:
{
sou++;
textBox3.Text += "长寿功(每秒寿元+1)\r\n";
}
break;
}
}
//法宝
public void fabao(int a)
{
switch (a)
{
case 0:
{
t2 += 100;
textBox2.Text += "玄铁尺(每次点击修为获得+100)\r\n";
}
break;
case 1:
{
year--;
textBox2.Text += "小绿瓶(每秒寿元流逝-1)\r\n";
}
break;
case 2:
{
c++;
textBox2.Text += "聚宝盆(每秒财富+1)\r\n";
}
break;
case 3:
{
t1++;
textBox2.Text += "盘古斧(每次点击额外获得一次炼体修为)\r\n";
}
break;
case 4:
{
s += 2;
textBox2.Text += "天道令(每秒声望+2)\r\n";
}
break;
case 5:
{
GlobalVariable.xiuwei *= 2;
textBox2.Text += "造化丹(每次获得使当前修为翻倍)\r\n";
}
break;
case 6:
{
t3 += 0.5;
textBox2.Text += "伏羲琴(最终点击获得修为增加0.5倍)\r\n";
}
break;
case 7:
{
q3 += 0.5;
textBox2.Text += "混沌钟(每秒最终获得修为增加0.5倍)\r\n";
}
break;
case 8:
{
t2 += 1000;
q2 += 1000;
s += 1;
c += 1;
textBox2.Text += "爱浩之心(每次点击获得修为+1000,每秒获得修为+1000,每秒获得一点声望和一点财富)\r\n";
}
break;
}
}
//宗门
public void zongmen(int a)
{
switch (a)
{
case 0:
{
q2 += 100;
s++;
textBox1.Text += "云岚宗(每秒获得修为+100,声望+1)\r\n";
z = 0;
}
break;
case 1:
{
t2 += 2000;
textBox1.Text += "唐门(每次获得修为+2000)\r\n";
z = 1;
}
break;
case 2:
{
q2 += 50;
c++;
s++;
textBox1.Text += "英雄联盟(每秒获得财富+1,声望+1,修为+50)\r\n";
z = 2;
}
break;
case 3:
{
q2 += 100;
year++;
c--;
textBox1.Text += "合欢宗(每秒修为+100,寿命-1,财富-1)\r\n";
z = 3;
}
break;
case 4:
{
c += 3;
textBox1.Text += "**银行(每秒获得财富+3)\r\n";
z = 4;
}
break;
}
}
public void tuizongmen(int a)
{
switch (a)
{
case 0:
{
q2 -= 100;
s--;
z1 = 0;
}
break;
case 1:
{
t2 -= 2000;
z1 = 0;
}
break;
case 2:
{
q2 -= 50;
c--;
s--;
z1 = 0;
}
break;
case 3:
{
q2 -= 100;
year--;
c++;
z1 = 0;
}
break;
case 4:
{
c -= 3;
z1 = 0;
}
break;
}
}
//随机数生成
public int suiji(int a)
{
byte[] buffer = Guid.NewGuid().ToByteArray();
int iSeed = BitConverter.ToInt32(buffer, 0);
Random random = new Random(iSeed);
return random.Next() % a;
}
private void button1_Click(object sender, EventArgs e)
{
if(GlobalVariable.caifu>=100)
{
fabao(suiji(9));
GlobalVariable.caifu -= 100;
}
else
{ MessageBox.Show("财富不足"); }
}
private void button2_Click(object sender, EventArgs e)
{
if(GlobalVariable.t <2)
{ MessageBox.Show("炼肉境才可修行炼体功法"); }
else if (GlobalVariable.xiuwei >= (long)Math.Pow(10, GlobalVariable.t+1))
{
liangtigongfa(suiji(9));
GlobalVariable.xiuwei -= (long)Math.Pow(10, GlobalVariable.t+1);
}
else
{ MessageBox.Show("修为不足"); }
}
private void button3_Click(object sender, EventArgs e)
{
if (GlobalVariable.q < 2)
{ MessageBox.Show("气感境才可修行练气功法"); }
else if (GlobalVariable.xiuwei >= (long)Math.Pow(10, GlobalVariable.q + 1))
{
liangqigongfa(suiji(9));
GlobalVariable.xiuwei -= (long)Math.Pow(10, GlobalVariable.q + 1);
}
else
{ MessageBox.Show("修为不足"); }
}
private void button4_Click(object sender, EventArgs e)
{
if (GlobalVariable.shengwang >= 100 && z1==0)
{
z1 = 1;
zongmen(suiji(5));
GlobalVariable.shengwang -= 100;
}
else if(z1==1)
{ MessageBox.Show("你已加入宗门"); }
else { MessageBox.Show("声望不足"); }
}
private void button5_Click(object sender, EventArgs e)
{
if(z1==1)
{ tuizongmen(z);}
else
{ MessageBox.Show("你还没有加入宗门"); }
}
}
}
主程序设计器代码
namespace xiuxian
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.xiu = new System.Windows.Forms.Label();
this.souyuan = new System.Windows.Forms.Label();
this.lianti = new System.Windows.Forms.Button();
this.shengji1 = new System.Windows.Forms.Button();
this.shengji2 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.ti = new System.Windows.Forms.Label();
this.qi = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.shengwang = new System.Windows.Forms.Label();
this.caifu = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.button5 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// xiu
//
this.xiu.AutoSize = true;
this.xiu.Location = new System.Drawing.Point(261, 46);
this.xiu.Name = "xiu";
this.xiu.Size = new System.Drawing.Size(47, 12);
this.xiu.TabIndex = 0;
this.xiu.Text = "修为:0";
//
// souyuan
//
this.souyuan.AutoSize = true;
this.souyuan.Location = new System.Drawing.Point(13, 13);
this.souyuan.Name = "souyuan";
this.souyuan.Size = new System.Drawing.Size(71, 12);
this.souyuan.TabIndex = 1;
this.souyuan.Text = "寿元:100/16";
//
// lianti
//
this.lianti.Location = new System.Drawing.Point(12, 100);
this.lianti.Name = "lianti";
this.lianti.Size = new System.Drawing.Size(75, 23);
this.lianti.TabIndex = 2;
this.lianti.Text = "炼体";
this.lianti.UseVisualStyleBackColor = true;
this.lianti.Click += new System.EventHandler(this.lianti_Click);
//
// shengji1
//
this.shengji1.Location = new System.Drawing.Point(233, 99);
this.shengji1.Name = "shengji1";
this.shengji1.Size = new System.Drawing.Size(173, 23);
this.shengji1.TabIndex = 3;
this.shengji1.Text = "10修为突破炼体境界";
this.shengji1.UseVisualStyleBackColor = true;
this.shengji1.Click += new System.EventHandler(this.shengji1_Click);
//
// shengji2
//
this.shengji2.Location = new System.Drawing.Point(233, 172);
this.shengji2.Name = "shengji2";
this.shengji2.Size = new System.Drawing.Size(173, 23);
this.shengji2.TabIndex = 4;
this.shengji2.Text = "10修为突破练气境界";
this.shengji2.UseVisualStyleBackColor = true;
this.shengji2.Click += new System.EventHandler(this.shengji2_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(35, 177);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(29, 12);
this.label3.TabIndex = 6;
this.label3.Text = "练气";
//
// ti
//
this.ti.AutoSize = true;
this.ti.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ti.Location = new System.Drawing.Point(428, 101);
this.ti.Name = "ti";
this.ti.Size = new System.Drawing.Size(72, 16);
this.ti.TabIndex = 7;
this.ti.Text = "开始炼体";
//
// qi
//
this.qi.AutoSize = true;
this.qi.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.qi.Location = new System.Drawing.Point(428, 173);
this.qi.Name = "qi";
this.qi.Size = new System.Drawing.Size(72, 16);
this.qi.TabIndex = 8;
this.qi.Text = "开始练气";
//
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(110, 105);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 12);
this.label1.TabIndex = 9;
this.label1.Text = "每次修为+1";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(110, 177);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 10;
this.label2.Text = "每秒修为+0";
//
// button1
//
this.button1.Location = new System.Drawing.Point(60, 251);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(115, 23);
this.button1.TabIndex = 11;
this.button1.Text = "获取法宝";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(558, 41);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(98, 23);
this.button2.TabIndex = 12;
this.button2.Text = "获取炼体功法";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(558, 144);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(98, 23);
this.button3.TabIndex = 13;
this.button3.Text = "获取练气功法";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(442, 251);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 14;
this.button4.Text = "加入宗门";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// shengwang
//
this.shengwang.AutoSize = true;
this.shengwang.Location = new System.Drawing.Point(347, 46);
this.shengwang.Name = "shengwang";
this.shengwang.Size = new System.Drawing.Size(47, 12);
this.shengwang.TabIndex = 16;
this.shengwang.Text = "声望:0";
//
// caifu
//
this.caifu.AutoSize = true;
this.caifu.Location = new System.Drawing.Point(425, 46);
this.caifu.Name = "caifu";
this.caifu.Size = new System.Drawing.Size(47, 12);
this.caifu.TabIndex = 17;
this.caifu.Text = "财富:0";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(181, 256);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(107, 12);
this.label6.TabIndex = 18;
this.label6.Text = "每次需要100点财富";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(662, 46);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(71, 12);
this.label7.TabIndex = 19;
this.label7.Text = "需要100修为";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(662, 149);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(71, 12);
this.label8.TabIndex = 20;
this.label8.Text = "需要100修为";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(524, 256);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(167, 12);
this.label9.TabIndex = 21;
this.label9.Text = "需要100声望(只能加入一个)";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(134, 46);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(41, 12);
this.label10.TabIndex = 22;
this.label10.Text = "姓名:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(442, 291);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(228, 99);
this.textBox1.TabIndex = 24;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(60, 291);
this.textBox2.Multiline = true;
this.textBox2.Name = "textBox2";
this.textBox2.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox2.Size = new System.Drawing.Size(228, 99);
this.textBox2.TabIndex = 25;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(558, 173);
this.textBox3.Multiline = true;
this.textBox3.Name = "textBox3";
this.textBox3.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox3.Size = new System.Drawing.Size(175, 72);
this.textBox3.TabIndex = 26;
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(558, 70);
this.textBox4.Multiline = true;
this.textBox4.Name = "textBox4";
this.textBox4.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox4.Size = new System.Drawing.Size(175, 68);
this.textBox4.TabIndex = 27;
//
// button5
//
this.button5.Location = new System.Drawing.Point(697, 291);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(75, 23);
this.button5.TabIndex = 28;
this.button5.Text = "退出宗门";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.button5);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label10);
this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.caifu);
this.Controls.Add(this.shengwang);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.qi);
this.Controls.Add(this.ti);
this.Controls.Add(this.label3);
this.Controls.Add(this.shengji2);
this.Controls.Add(this.shengji1);
this.Controls.Add(this.lianti);
this.Controls.Add(this.souyuan);
this.Controls.Add(this.xiu);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label xiu;
private System.Windows.Forms.Label souyuan;
private System.Windows.Forms.Button lianti;
private System.Windows.Forms.Button shengji1;
private System.Windows.Forms.Button shengji2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label ti;
private System.Windows.Forms.Label qi;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Label shengwang;
private System.Windows.Forms.Label caifu;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
public System.Windows.Forms.Timer timer1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Button button5;
}
}
开始界面代码
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;
namespace xiuxian
{
public partial class select : Form
{
public select()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
GlobalVariable.birth = 1;
GlobalVariable.xiuwei = 0;
GlobalVariable.shengwang = 200;
GlobalVariable.caifu = 0;
label2.Text = "修为:0";
label3.Text = "声望:200";
label4.Text = "财富:0";
Birth();
}
private void button3_Click(object sender, EventArgs e)
{
GlobalVariable.birth = 2;
GlobalVariable.xiuwei = 1000;
GlobalVariable.shengwang = 0;
GlobalVariable.caifu = 0;
label2.Text = "修为:1000";
label3.Text = "声望:0";
label4.Text = "财富:0";
Birth();
}
private void button4_Click(object sender, EventArgs e)
{
GlobalVariable.birth = 3;
GlobalVariable.xiuwei = 0;
GlobalVariable.shengwang = 0;
GlobalVariable.caifu = 200;
label2.Text = "修为:0";
label3.Text = "声望:0";
label4.Text = "财富:200";
Birth();
}
private void button5_Click(object sender, EventArgs e)
{
GlobalVariable.birth = 0;
Birth();
}
private void button1_Click(object sender, EventArgs e)
{
GlobalVariable.name = textBox2.Text;
if (textBox2.Text!="")
{
this.DialogResult = DialogResult.OK;
}
else
{
MessageBox.Show("名字为空");
}
}
public void Birth()
{
switch(GlobalVariable.birth)
{
case 0: textBox1.Text = "你就是一个普普通通的凡人,家世没有任何特定,一切都要靠自己慢慢打拼"; break;
case 1: textBox1.Text = "你是一位教书先生,桃李满天下,有着不小的声望,机缘巧合之下接触到了仙路。声望+200"; break;
case 2: textBox1.Text = "你是一位修仙世家后裔,从小便接触修仙,但因为家族没落,决心自己重新闯荡。修为+1000"; break;
case 3: textBox1.Text = "你的家族是商业世家,十分富有,家族为了能更进一步,于是拿出部分资金供你踏上仙路。财富+200"; break;
}
}
}
}
开始界面设计器代码
namespace xiuxian
{
partial class select
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.button5 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button1.Location = new System.Drawing.Point(353, 115);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(137, 74);
this.button1.TabIndex = 0;
this.button1.Text = "确定";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(97, 131);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(67, 43);
this.button2.TabIndex = 1;
this.button2.Text = "闻名一方教书先生";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(170, 131);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(70, 43);
this.button3.TabIndex = 2;
this.button3.Text = "没落修仙世家后裔";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(246, 131);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(69, 43);
this.button4.TabIndex = 3;
this.button4.Text = "富甲一方商人之子";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(46, 180);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(260, 132);
this.textBox1.TabIndex = 4;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(140, 12);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 21);
this.textBox2.TabIndex = 5;
this.textBox2.Text = "无名之辈";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(89, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(29, 12);
this.label1.TabIndex = 6;
this.label1.Text = "姓名";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(89, 71);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(47, 12);
this.label2.TabIndex = 7;
this.label2.Text = "修为:0";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(168, 70);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(47, 12);
this.label3.TabIndex = 8;
this.label3.Text = "声望:0";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(242, 71);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(47, 12);
this.label4.TabIndex = 9;
this.label4.Text = "财富:0";
//
// button5
//
this.button5.Location = new System.Drawing.Point(26, 131);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(65, 43);
this.button5.TabIndex = 10;
this.button5.Text = "普普通通一个凡人";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// select
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(513, 340);
this.ControlBox = false;
this.Controls.Add(this.button5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "select";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "出生选择";
this.TopMost = true;
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button5;
}
}
program.cs代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace xiuxian
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
select form1 = new select();
if (form1.ShowDialog() == DialogResult.OK)
{
Application.Run(new Form1());
}
}
}
}
GlobalVariable.cs代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace xiuxian
{
public static class GlobalVariable
{
public static int birth = 0;
public static string name = string.Empty;
public static long xiuwei = 0, caifu = 0, shengwang = 0;
public static int t = 1, q = 1, sou = 100, jingjie;
}
}