当前位置:   article > 正文

[WinForm开源]原神混池模拟器-蒙德篇:软件的基本介绍、使用方法、常见问题解决与代码开源

[WinForm开源]原神混池模拟器-蒙德篇:软件的基本介绍、使用方法、常见问题解决与代码开源

首先先和各位旅行者道个歉,混池都过去这么久了才把软件开发好并发布出来 >_<


创作目的:为给各位旅行者(当然包括我自己)估测混池抽取的出货率以及让各位旅行者可以过手瘾,故开发了此项目作为参考。

创作说明:该软件的一切结果仅可作为参考,并非游戏内所得结果;软件在部分情况下可能运行不佳,个人开发软件兼容性可能较差请谅解。


目录

一、软件基本介绍

(一)软件的基本运行需求

(二)软件的基本界面

1.加载界面

2.主界面

3.详情界面

4.历史记录界面

5.祈愿结果界面

(三)软件的基本使用方法

(四)常见问题的解决方法

1.打开时显示缺少FrameWork框架

2.运行过程中显示文件不存在

3.其他问题

二、软件与项目获取途径

(一)软件安装包

(二)项目开源压缩包

三、项目源代码

(一)LoadForm窗体

(二)MDIForm窗体

(三)MainForm窗体

(四)PrayerForm窗体

(五)InformationForm窗体

(六)HistoryForm窗体

(七).manifest文件

四、其他说明


一、软件基本介绍

(一)软件的基本运行需求

  • 系统版本需求:最佳运行环境为Windows11。
  • Framework需求:最低版本为.NET Framework 4.6.1。
  • 内存(运存)需求:最少0.5GB.
  • 存储大小需求:最少70MB,包含Framework则最少200MB.

(二)软件的基本界面

1.加载界面

2.主界面

3.详情界面

4.历史记录界面

5.祈愿结果界面

(三)软件的基本使用方法

软件的基本使用与游戏内几乎一致,略有不同的地方在下方列出声明:

  1. 进行祈愿之前必须先选择定轨目标,否则将无法进行祈愿。
  2. 点击加载界面可跳过加载。
  3. 祈愿结果界面点击空白处即可返回祈愿界面。
  4. 根据旅行者不同需求,模拟器保留了自由选择生成随机数参数的方法,软件将使用用户选择的方法生成随机数,软件默认以“密码学随机数”方法生成随机数。
  5. “详情”界面与游戏内或有不同,因软件开始开发时混池已经结束,无法直接获取关于混池的详情界面内容。
  6. 点击界面右上角叉号将直接退出软件,若不想退出软件,请按照游戏内操作方法点击界面内部的关闭按钮。
  7. 历史记录界面支持滚轮滚动切换页数。

(四)常见问题的解决方法

1.打开时显示缺少FrameWork框架

请在微软官网下载并安装Framework框架,要求最低版本为4.6.1 。

2.运行过程中显示文件不存在

说明您的安装包被修改过或安装后被修改,请尝试恢复被修改的资源或卸载并重新安装,若安装后还是出现此错误,请在本界面所附的连接下载该软件的安装包。

3.其他问题

运行过程中出现的一切无法处理的问题均可以向作者反馈。

二、软件与项目获取途径

注:所有下载均为免费,若遇到需要收费以下载此软件的途径,请将其视为诈骗。

(一)软件安装包

CSDN站内:安装包CSDN站内下载传送门

百度网盘:安装包下载-百度网盘途径-传送门 提取码:YSHC

123云盘:安装包下载-123云盘途径-传送门

(二)项目开源压缩包

CSDN站内:项目开源CSDN站内下载传送门

百度网盘:项目开源下载-百度网盘途径-传送门 提取码:YSHC

123云盘:项目开源下载-123云盘途径-传送门

三、项目源代码

注:此处仅展示完整代码,不作技术描述,关键的部分都有注释,若追求更好的体验请下载开源项目。程序入口为LoadForm()。

(一)LoadForm窗体

设计样式:

页面源代码: 

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace 原神混池模拟器
  12. {
  13. public partial class LoadForm : Form
  14. {
  15. public LoadForm()
  16. {
  17. InitializeComponent();
  18. }
  19. #region 变量的声明
  20. MDIForm MF = null;
  21. int ActionCounter = 0;
  22. private const int BorderRadius = 125;//绘制的圆角半径
  23. #endregion
  24. private void LoadForm_Load(object sender, EventArgs e)
  25. {
  26. panel_Load.Width = 0;
  27. }
  28. protected override void OnPaint(PaintEventArgs e)
  29. {//绘制圆角窗体
  30. base.OnPaint(e);
  31. GraphicsPath path = new GraphicsPath();
  32. path.AddArc(0, 0, BorderRadius, BorderRadius, 180, 90); // 左上角
  33. path.AddArc(this.Width - BorderRadius, 0, BorderRadius, BorderRadius, 270, 90); // 右上角
  34. path.AddArc(this.Width - BorderRadius, this.Height - BorderRadius, BorderRadius, BorderRadius, 0, 90); // 右下角
  35. path.AddArc(0, this.Height - BorderRadius, BorderRadius, BorderRadius, 90, 90); // 左下角
  36. path.CloseFigure();
  37. this.Region = new Region(path);
  38. }
  39. private void timer_Ticker_Tick(object sender, EventArgs e)//仅负责加载动画
  40. {
  41. ActionCounter++;//1-140,140-240,240-250
  42. if ((ActionCounter >= 0) && (ActionCounter <= 140))
  43. {
  44. panel_Load.Width = 5 * ActionCounter;
  45. }
  46. else
  47. {
  48. if ((ActionCounter > 240) && (ActionCounter <= 250))
  49. panel_Load.Width = 5 * (ActionCounter - 100);
  50. }
  51. if (ActionCounter==275)
  52. {
  53. timer_Ticker.Stop();
  54. MF = new MDIForm();
  55. MF.Show();
  56. this.Hide();
  57. }
  58. }
  59. private void LoadForm_MouseClick(object sender, MouseEventArgs e)
  60. {
  61. if (ActionCounter<=240)
  62. ActionCounter = 240;
  63. }
  64. private void pictureBox_Load_MouseClick(object sender, MouseEventArgs e)
  65. {
  66. if (ActionCounter <= 240)
  67. ActionCounter = 240;
  68. }
  69. private void panel_Load_MouseClick(object sender, MouseEventArgs e)
  70. {
  71. if (ActionCounter <= 240)
  72. ActionCounter = 240;
  73. }
  74. private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
  75. {
  76. if (ActionCounter <= 240)
  77. ActionCounter = 240;
  78. }
  79. }
  80. }

(二)MDIForm窗体

注:该窗体为MDI父窗体。

设计样式:

 页面源代码:

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace 原神混池模拟器
  11. {
  12. public partial class MDIForm : Form
  13. {
  14. public MDIForm()
  15. {
  16. InitializeComponent();
  17. this.FormBorderStyle = FormBorderStyle.Sizable;
  18. this.MaximumSize = this.MinimumSize = this.Size;
  19. this.DoubleBuffered = true;
  20. }
  21. private void MDIForm_Load(object sender, EventArgs e)
  22. {
  23. InformationForm IF = new InformationForm();
  24. IF.MdiParent = this;
  25. HistoryForm HF = new HistoryForm();
  26. HF.MdiParent = this;
  27. PrayerForm PF = new PrayerForm();
  28. PF.MdiParent = this;
  29. MainForm MF = new MainForm(IF, HF, PF);
  30. MF.MdiParent = this;
  31. MF.Show();
  32. }
  33. }
  34. }

(三)MainForm窗体

注:该窗体为MDI子窗体。

设计样式:

 页面源代码:

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading;
  9. using System.IO;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. using System.Diagnostics;
  13. using System.Security.Cryptography;
  14. namespace 原神混池模拟器
  15. {
  16. public partial class MainForm : Form
  17. {
  18. public MainForm(InformationForm InfoForm, HistoryForm HisForm, PrayerForm PraForm)
  19. {
  20. InitializeComponent();
  21. IF = InfoForm;
  22. HF = HisForm;
  23. PF = PraForm;
  24. }
  25. /*编码(Code)划分表:
  26. * 1-6为5星角色(总6件)
  27. * 7-17为5星武器(总11件)
  28. * 18-29为4星角色(总12件)
  29. * 30-49为4星武器(总20件)
  30. * 50-62为3星武器(总13件)
  31. */
  32. #region 变量的声明
  33. Color BottomPanelColor = Color.Gray;
  34. public int WillingCount = 0;//记录当前命定值
  35. public int NUM_Prayer = 0;//记录当前距离上次出金的抽数
  36. public string SelectedWilling = "0";//使用stoi(SW)转化成int,也即int.Parse(SW)
  37. string[] NameOfWilling = new string[18] { "0","Eula","Mona","Albedo","Klee","Diluc","Jean",
  38. "SkywardBlade","AquilaFavonia","BeaconOfTheReedSea",
  39. "SongOfBrokenPines","Wolf'sGravestone","SkywardPride",
  40. "SkywardSpine","LostPrayerToTheSacredWinds","SkywardAtlas",
  41. "Hunter’sPath","SkywardHarp"};//储存编号与名称的映射关系
  42. string[] ChineseName=new string[18]{
  43. "0","浪沫的旋舞·优菈(冰)","星天水镜·莫娜(水)","白垩之子·阿贝多(岩)",
  44. "逃跑的太阳·可莉(火)","晨曦的暗面·迪卢克(火)","蒲公英骑士·琴(风)",
  45. //这里开始是武器
  46. "单手剑·天空之刃","单手剑·风鹰剑","双手剑·苇海信标",
  47. "双手剑·松籁响起之时","双手剑·狼的末路","双手剑·天空之傲",
  48. "长柄武器·天空之脊","法器·四风原典","法器·天空之卷",
  49. "弓·猎人之径","弓·天空之翼"};//储存编号与中文名称的映射关系
  50. /*
  51. * 0是空编号
  52. * 1-6分别是列表中的六名角色,顺序一致
  53. * 7-17分别为列表中的十一件武器,顺序一致
  54. */
  55. string[] NameOf_4_Stars = new string[32] {
  56. "TheStringless","FavoniusWarbow","Rust","AlleyHunter",
  57. "MitternachtsWaltz","SacrificialFragments","FavoniusCodex","EyeOfPerception",
  58. "WineAndSong","Dragon'sBane","FavoniusLance","FavoniusGreatsword",
  59. "TheBell","SacrificialGreatsword","Rainslasher","FavoniusSword",
  60. "TheFlute","Lion'sRoar","SacrificialSword","TheAlleyFlash",
  61. //这里开始是4星角色,编号从20开始
  62. "Amber","Barbara","Bennett","Diona","Fischl","Kaeya",
  63. "Lisa","Mika","Noelle","Razor","Rosaria","Sucrose"
  64. };
  65. //四星武器与角色的名称,0-19为武器,20及之后为角色
  66. string[] NameOf_3_Stars = new string[13]
  67. {
  68. "BlackTassel","ThrillingTalesOfDragonSlayers","EmeraldOrb","MagicGuide","Slingshot",
  69. "Sharpshooter'sOath","RavenBow","DebateClub","FerrousShadow","BloodtaintedGreatsword",
  70. "HarbingerOfDawn","SkyriderSword","CoolSteel"
  71. };//13件3星武器
  72. InformationForm IF = null;//详情界面
  73. HistoryForm HF = null;//历史记录界面
  74. PrayerForm PF = null;//抽卡显示界面
  75. public int NumOfHistory = 0;//记录当前历史记录的条数
  76. public string[,] History = new string[1000, 3];//记录祈愿历史记录
  77. /* 第一维度为第n次抽取
  78. * 第二维度0为类型(第一列),1为名称(第二列),2为时间(第四列)
  79. */
  80. bool HistoryIsFull = false;
  81. // 线程局部存储的Random对象,确保每个线程都有自己的Random实例
  82. private static ThreadLocal<Random> random = new ThreadLocal<Random>(() => new Random(Guid.NewGuid().GetHashCode()));
  83. #endregion
  84. private void MainForm_Load(object sender, EventArgs e)
  85. {
  86. //this.FormBorderStyle = FormBorderStyle.Sizable;
  87. panel_History.BackColor = panel_Info.BackColor =
  88. panel_Prayer_1.BackColor = panel_Prayer_10.BackColor = Color.FromArgb(0, 0, 0, 0);
  89. for (int i = 0; i < 1000; i++)
  90. for (int j = 0; j < 3; j++)
  91. History[i, j] = "";//初始化数组
  92. radioButton_Rand_1.Checked = true;
  93. }
  94. private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
  95. {
  96. ExitTheApp();//退出软件
  97. }
  98. private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
  99. {
  100. ExitTheApp();//退出软件
  101. }
  102. public void ExitTheApp()
  103. {
  104. Application.Exit();
  105. }//此函数用于检查并处理仍在运行的线程等事件,并退出软件
  106. private void pictureBox_Info_Click(object sender, EventArgs e)
  107. {
  108. IF.Show();
  109. }
  110. private void pictureBox_History_Click(object sender, EventArgs e)
  111. {
  112. //NumOfHistory = 67;//调试用
  113. HF.Reshow(History,NumOfHistory);//将数据传入HF并让其显示出来
  114. }
  115. private void pictureBox_Prayer_1_Click(object sender, EventArgs e)
  116. {
  117. if (SelectedWilling == "0")//如果未定轨
  118. MessageBox.Show("您未进行对定轨目标的选择,暂时无法进行祈愿。请先选择您的定轨目标后再进行祈愿。",
  119. "提示", MessageBoxButtons.OK);
  120. else
  121. {//进行了定轨,接下来按定轨内容进行祈愿操作
  122. int[] Obtained=new int[1] { PrayerMode() };
  123. PF.Reshow(Obtained, 1, (Obtained[0] >= 1 && Obtained[0] <= 17)? true:false);//这里要输入参数
  124. }
  125. }
  126. private void pictureBox_Prayer_10_Click(object sender, EventArgs e)
  127. {
  128. if (SelectedWilling == "0")//如果未定轨
  129. MessageBox.Show("您未进行对定轨目标的选择,暂时无法进行祈愿。请先选择您的定轨目标后再进行祈愿。",
  130. "提示", MessageBoxButtons.OK);
  131. else
  132. {//进行了定轨,接下来按定轨内容进行祈愿操作
  133. int[] Obtained = new int[10];
  134. bool HasGold = false;
  135. for (int i = 1; i <= 10; i++)
  136. {
  137. Obtained[i - 1] = PrayerMode();
  138. if (!HasGold)
  139. HasGold = HasGold || (Obtained[i - 1] >= 1 && Obtained[i - 1] <= 17);
  140. }
  141. PF.Reshow(Obtained,10,HasGold);//这里也要输入参数
  142. }
  143. }
  144. private int PrayerMode()
  145. {//进行单次祈愿模拟的方法,返回值为获取物件对应的编码
  146. /*根据游戏内描述:
  147. * 90五星保底,10四星保底
  148. * 五星0.6%,抽到5星时50%概率为定轨目标
  149. * 歪时,定轨角色就歪角色,定轨武器就歪武器
  150. * 四星武器和角色各自2.55%
  151. * 根据0.6%=60/10000=3/500,2.55%=255/10000=51/2000,所以生成一个1-2000的随机数
  152. * 则1-12为五星,13-63为4星角色,64-114为4星武器,其余为3星武器
  153. */
  154. int Code = 0;
  155. int randomNum;
  156. if (NUM_Prayer == 90)
  157. {//触发保底
  158. if (WillingCount == 0)
  159. {//定轨为0/1
  160. randomNum = CreateRandomNumber(1000);
  161. if (randomNum >= 1 && randomNum <= 500)
  162. {//没歪
  163. Code = int.Parse(SelectedWilling);
  164. }
  165. else
  166. {//歪了
  167. int SW = int.Parse(SelectedWilling);
  168. if (SW >= 1 && SW <= 6)
  169. {//定轨角色只歪角色(1-6中除去定轨的随机生成一个)
  170. do
  171. {
  172. randomNum = CreateRandomNumber(6);
  173. } while (randomNum == SW);//一直随机生成直到生成的随机数不是定轨目标
  174. }
  175. else
  176. {//定轨武器只歪武器(7-17中除去定轨随机生成一个)
  177. do
  178. {
  179. randomNum = CreateRandomNumber(11) + 6;//生成范围7-17
  180. } while (randomNum == SW);//一直生成随机数直到与用户定轨目标不相同为止
  181. }
  182. Code = randomNum;
  183. WillingCount = 1;//命定值增加1
  184. }
  185. }
  186. else
  187. {//定轨为1/1
  188. Code = int.Parse(SelectedWilling);
  189. WillingCount = 0;//命定值清零
  190. }
  191. NUM_Prayer = 0;//5星清空保底值
  192. }
  193. else
  194. {//没触发五星保底机制时
  195. if (NUM_Prayer%10 == 0)
  196. {//触发了4星保底
  197. randomNum = CreateRandomNumber(1000);
  198. if (randomNum >=1 && randomNum <= 497)
  199. {//4星角色,18-29
  200. randomNum = CreateRandomNumber(12);
  201. Code = 17 + randomNum;
  202. NUM_Prayer++;//4星累计保底值
  203. }
  204. else if (randomNum >= 498 && randomNum <= 994)
  205. {//4星武器,30-49
  206. randomNum = CreateRandomNumber(20);//该卡池内总共有20把4星武器
  207. Code = 29 + randomNum;
  208. NUM_Prayer++;//4星累计保底值
  209. }
  210. else
  211. {//4星保底有0.6%概率抽取到5星
  212. if (WillingCount == 0)
  213. {//定轨为0/1
  214. randomNum = CreateRandomNumber(1000);
  215. if (randomNum >= 1 && randomNum <= 500)
  216. {//没歪
  217. Code = int.Parse(SelectedWilling);
  218. }
  219. else
  220. {//歪了
  221. int SW = int.Parse(SelectedWilling);
  222. if (SW >= 1 && SW <= 6)
  223. {//定轨角色只歪角色(1-6中除去定轨的随机生成一个)
  224. do
  225. {
  226. randomNum = CreateRandomNumber(6);
  227. } while (randomNum == SW);//一直随机生成直到生成的随机数不是定轨目标
  228. }
  229. else
  230. {//定轨武器只歪武器(7-17中除去定轨随机生成一个)
  231. do
  232. {
  233. randomNum = CreateRandomNumber(11) + 6;//生成范围7-17
  234. } while (randomNum == SW);//一直生成随机数直到与用户定轨目标不相同为止
  235. }
  236. Code = randomNum;
  237. WillingCount = 1;//命定值增加1
  238. }
  239. }
  240. else
  241. {//定轨为1/1
  242. Code = int.Parse(SelectedWilling);
  243. WillingCount = 0;//命定值清零
  244. }
  245. NUM_Prayer = 0;//5星清空保底值
  246. }//4星保底抽到5星的算法
  247. }
  248. else
  249. {//没触发4星保底
  250. randomNum = CreateRandomNumber(2000);
  251. if (randomNum >= 1 && randomNum <= 12)
  252. {//抽到了五星
  253. if (WillingCount == 0)
  254. {//定轨为0/1
  255. randomNum = CreateRandomNumber(1000);
  256. if (randomNum >= 1 && randomNum <= 500)
  257. {//没歪
  258. Code = int.Parse(SelectedWilling);
  259. }
  260. else
  261. {//歪了
  262. int SW = int.Parse(SelectedWilling);
  263. if (SW >= 1 && SW <= 6)
  264. {//定轨角色只歪角色(1-6中除去定轨的随机生成一个)
  265. do
  266. {
  267. randomNum = CreateRandomNumber(6);
  268. } while (randomNum == SW);//一直随机生成直到生成的随机数不是定轨目标
  269. }
  270. else
  271. {//定轨武器只歪武器(7-17中除去定轨随机生成一个)
  272. do
  273. {
  274. randomNum = CreateRandomNumber(11) + 6;//生成范围7-17
  275. } while (randomNum == SW);//一直生成随机数直到与用户定轨目标不相同为止
  276. }
  277. Code = randomNum;
  278. WillingCount = 1;//命定值增加1
  279. }
  280. }
  281. else
  282. {//定轨为1/1
  283. Code = int.Parse(SelectedWilling);
  284. WillingCount = 0;//命定值清零
  285. }
  286. NUM_Prayer = 0;//抽到了五星就要清空五星积累
  287. }
  288. else if (randomNum >= 13 && randomNum <= 63)
  289. {//抽到了四星角色
  290. randomNum = CreateRandomNumber(12);//该卡池内总共有12个4星角色
  291. Code = 17 + randomNum;
  292. NUM_Prayer++;//4星累计保底值
  293. }
  294. else if (randomNum >= 64 && randomNum <= 114)
  295. {//抽到了四星武器
  296. randomNum = CreateRandomNumber(20);//该卡池内总共有20把4星武器
  297. Code = 29 + randomNum;
  298. NUM_Prayer++;//4星累计保底值
  299. }
  300. else
  301. {//只抽到了三星武器
  302. randomNum = CreateRandomNumber(13);//总共13件3星武器
  303. Code = 49 + randomNum;
  304. NUM_Prayer++;//3星累计保底值
  305. }
  306. }
  307. }
  308. label_Num_Willing.Text = WillingCount.ToString();
  309. WriteTheHistoryRecord(Code, NumOfHistory);
  310. if (NumOfHistory < 1000) NumOfHistory++;
  311. if (NumOfHistory == 1000 && (!HistoryIsFull)) HistoryIsFull = true;
  312. return Code;
  313. }//进行单次祈愿模拟的方法,返回值为获取物件对应的编码
  314. private int CreateRandomNumber(int N)
  315. {//生成随机数的方法
  316. int _rand = 0;
  317. if (radioButton_Rand_1.Checked)
  318. {//使用密码学方法生成随机数
  319. using (var rng = new RNGCryptoServiceProvider())
  320. {
  321. // 生成一个随机字节数组
  322. byte[] randomBytes = new byte[4]; // 4 bytes for a uint32
  323. rng.GetBytes(randomBytes);
  324. // 将字节数组转换为整数
  325. _rand = BitConverter.ToInt32(randomBytes, 0);
  326. _rand = Math.Abs(_rand) % N + 1;
  327. }
  328. }
  329. else
  330. {
  331. _rand = Math.Abs(random.Value.Next(1, N + 1));//生成1-N的随机数
  332. }
  333. return _rand;//生成了一个1-N的随机数
  334. }//生成随机数的方法
  335. private void WriteTheHistoryRecord(int Code,int Num)
  336. {
  337. if (HistoryIsFull)
  338. {//记录已满,进行迭代
  339. for (int i = 0; i < 999; i++)
  340. for (int j = 0; j < 3; j++)
  341. History[i, j] = History[i + 1, j];
  342. //然后History[999,n]的位置空出来的
  343. Num = 999;
  344. }
  345. History[Num, 0] = ((Code >= 1 && Code <= 6) || (Code >= 18 && Code <= 29)) ? "角色" : "武器";
  346. History[Num, 1] = PF.ChineseNameOfItem[Code];//从PF窗体获取中文名并写入历史记录
  347. //然后把抽取时间写入History[Num,2]
  348. History[Num, 2] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  349. }
  350. #region 一大段panel变色代码
  351. private void pictureBox_Info_MouseEnter(object sender, EventArgs e)
  352. {
  353. panel_Info.BackColor = BottomPanelColor;
  354. }
  355. private void pictureBox_Info_MouseLeave(object sender, EventArgs e)
  356. {
  357. panel_Info.BackColor = Color.FromArgb(0, 0, 0, 0);
  358. }
  359. private void pictureBox_History_MouseEnter(object sender, EventArgs e)
  360. {
  361. panel_History.BackColor = BottomPanelColor;
  362. }
  363. private void pictureBox_History_MouseLeave(object sender, EventArgs e)
  364. {
  365. panel_History.BackColor = Color.FromArgb(0, 0, 0, 0);
  366. }
  367. private void pictureBox_Prayer_1_MouseEnter(object sender, EventArgs e)
  368. {
  369. panel_Prayer_1.BackColor = BottomPanelColor;
  370. }
  371. private void pictureBox_Prayer_1_MouseLeave(object sender, EventArgs e)
  372. {
  373. panel_Prayer_1.BackColor = Color.FromArgb(0, 0, 0, 0);
  374. }
  375. private void pictureBox_Prayer_10_MouseEnter(object sender, EventArgs e)
  376. {
  377. panel_Prayer_10.BackColor = BottomPanelColor;
  378. }
  379. private void pictureBox_Prayer_10_MouseLeave(object sender, EventArgs e)
  380. {
  381. panel_Prayer_10.BackColor = Color.FromArgb(0, 0, 0, 0);
  382. }
  383. private void pictureBox_Change_Willing_MouseEnter(object sender, EventArgs e)
  384. {
  385. panel_ChangeWilling.BackColor = BottomPanelColor;
  386. }
  387. private void pictureBox_Change_Willing_MouseLeave(object sender, EventArgs e)
  388. {
  389. panel_ChangeWilling.BackColor = Color.FromArgb(0, 0, 0, 0);
  390. }
  391. #endregion
  392. private void pictureBox_Change_Willing_MouseDown(object sender, MouseEventArgs e)
  393. {
  394. if (e.Button == MouseButtons.Left)
  395. {
  396. // 在鼠标点击的位置显示ContextMenuStrip
  397. contextMenuStrip_Willings.Show(pictureBox_Change_Willing, e.Location);
  398. }
  399. }
  400. #region 给SelectedWilling赋值以及将上一个选择赋给HistoryWilling的语句块
  401. private void ChangeWilling(string Temp)//修改定轨目标所用的函数
  402. {
  403. if ((int.Parse(SelectedWilling) != 0)&&(Temp!=SelectedWilling))
  404. {
  405. DialogResult dr = MessageBox.Show("您确定要把定轨目标从\"" + ChineseName[int.Parse(SelectedWilling)]
  406. + "\"改为\"" + ChineseName[int.Parse(Temp)] + "\"吗?修改后命定值将清零!", "提醒",
  407. MessageBoxButtons.YesNo);//询问用户是否更改
  408. if (dr == DialogResult.Yes)
  409. {//用户选择了修改定轨目标的选项
  410. WillingCount = 0;
  411. label_Num_Willing.Text = "0";
  412. SelectedWilling = Temp;
  413. }
  414. }
  415. else if (int.Parse(SelectedWilling) == 0) SelectedWilling = Temp;
  416. try
  417. {
  418. pictureBox_Willing.Image =
  419. Image.FromFile("bins\\source\\H_" + NameOfWilling[int.Parse(SelectedWilling)] + ".png");
  420. }
  421. catch (Exception ex)
  422. {
  423. MessageBox.Show("出现错误:" + ex.Message, "ERROR",
  424. MessageBoxButtons.OK, MessageBoxIcon.Error);
  425. }
  426. }
  427. private void 浪末的旋舞优菈冰ToolStripMenuItem_Click(object sender, EventArgs e)
  428. {
  429. ChangeWilling("1");
  430. }
  431. private void 星天水镜莫娜水ToolStripMenuItem_Click(object sender, EventArgs e)
  432. {
  433. ChangeWilling("2");
  434. }
  435. private void 白垩之子阿贝多岩ToolStripMenuItem_Click(object sender, EventArgs e)
  436. {
  437. ChangeWilling("3");
  438. }
  439. private void 逃跑的太阳可莉火ToolStripMenuItem_Click(object sender, EventArgs e)
  440. {
  441. ChangeWilling("4");
  442. }
  443. private void 晨曦的暗面迪卢克火ToolStripMenuItem_Click(object sender, EventArgs e)
  444. {
  445. ChangeWilling("5");
  446. }
  447. private void 蒲公英骑士琴风ToolStripMenuItem_Click(object sender, EventArgs e)
  448. {
  449. ChangeWilling("6");
  450. }
  451. private void 单手剑天空之刃ToolStripMenuItem_Click(object sender, EventArgs e)
  452. {
  453. ChangeWilling("7");
  454. }
  455. private void 单手剑风鹰剑ToolStripMenuItem_Click(object sender, EventArgs e)
  456. {
  457. ChangeWilling("8");
  458. }
  459. private void 双手剑苇海信标ToolStripMenuItem_Click(object sender, EventArgs e)
  460. {
  461. ChangeWilling("9");
  462. }
  463. private void 双手剑松籁响起之时ToolStripMenuItem_Click(object sender, EventArgs e)
  464. {
  465. ChangeWilling("10");
  466. }
  467. private void 双手剑狼的末路ToolStripMenuItem_Click(object sender, EventArgs e)
  468. {
  469. ChangeWilling("11");
  470. }
  471. private void 双手剑天空之傲ToolStripMenuItem_Click(object sender, EventArgs e)
  472. {
  473. ChangeWilling("12");
  474. }
  475. private void 长柄武器天空之脊ToolStripMenuItem_Click(object sender, EventArgs e)
  476. {
  477. ChangeWilling("13");
  478. }
  479. private void 法器四风原典ToolStripMenuItem_Click(object sender, EventArgs e)
  480. {
  481. ChangeWilling("14");
  482. }
  483. private void 法器天空之卷ToolStripMenuItem_Click(object sender, EventArgs e)
  484. {
  485. ChangeWilling("15");
  486. }
  487. private void 弓猎人之径ToolStripMenuItem_Click(object sender, EventArgs e)
  488. {
  489. ChangeWilling("16");
  490. }
  491. private void 弓天空之翼ToolStripMenuItem_Click(object sender, EventArgs e)
  492. {
  493. ChangeWilling("17");
  494. }
  495. private void 弓天空之翼ToolStripMenuItem_Click_1(object sender, EventArgs e)
  496. {
  497. ChangeWilling("17");//为什么会有这个事件???//但是没有这段又有bug
  498. }
  499. #endregion
  500. private void pictureBox_Willing_Click(object sender, EventArgs e)
  501. {
  502. }
  503. private void label_Willing_Click(object sender, EventArgs e)
  504. {
  505. }
  506. private void label_Num_Willing_Click(object sender, EventArgs e)
  507. {
  508. }
  509. private void pictureBox_Change_Willing_Click(object sender, EventArgs e)
  510. {
  511. }
  512. private void panel_ChangeWilling_Paint(object sender, PaintEventArgs e)
  513. {
  514. }
  515. private void panel_Info_Paint(object sender, PaintEventArgs e)
  516. {
  517. }
  518. private void panel_History_Paint(object sender, PaintEventArgs e)
  519. {
  520. }
  521. private void panel_Prayer_1_Paint(object sender, PaintEventArgs e)
  522. {
  523. }
  524. }
  525. }

(四)PrayerForm窗体

注:该窗体为MDI子窗体。

设计样式:

页面源代码:

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace 原神混池模拟器
  11. {
  12. public partial class PrayerForm : Form
  13. {
  14. public PrayerForm()
  15. {
  16. InitializeComponent();
  17. PB[0] = pictureBox1;
  18. PB[1] = pictureBox2;
  19. PB[2] = pictureBox3;
  20. PB[3] = pictureBox4;
  21. PB[4] = pictureBox5;
  22. PB[5] = pictureBox6;
  23. PB[6] = pictureBox7;
  24. PB[7] = pictureBox8;
  25. PB[8] = pictureBox9;
  26. PB[9] = pictureBox10;
  27. P_PB[0] = panel1;
  28. P_PB[1] = panel2;
  29. P_PB[2] = panel3;
  30. P_PB[3] = panel4;
  31. P_PB[4] = panel5;
  32. P_PB[5] = panel6;
  33. P_PB[6] = panel7;
  34. P_PB[7] = panel8;
  35. P_PB[8] = panel9;
  36. P_PB[9] = panel10;
  37. }
  38. #region ChineseNameOfItem数组的声明,没事别打开!
  39. public string[] ChineseNameOfItem = new string[63]
  40. {
  41. "0",//从1开始
  42. "优菈",
  43. "莫娜",
  44. "阿贝多",
  45. "可莉",
  46. "迪卢克",
  47. "琴",
  48. //以上1-6为5星角色,总6项
  49. "天空之刃",
  50. "风鹰剑",
  51. "苇海信标",
  52. "松籁响起之时",
  53. "狼的末路",
  54. "天空之傲",
  55. "天空之脊",
  56. "四风原典",
  57. "天空之卷",
  58. "猎人之径",
  59. "天空之翼",
  60. //以上7-17为5星武器,总11项
  61. "安柏",
  62. "芭芭拉",
  63. "班尼特",
  64. "迪奥娜",
  65. "菲谢尔",
  66. "凯亚",
  67. "丽莎",
  68. "米卡",
  69. "诺艾尔",
  70. "雷泽",
  71. "罗莎莉亚",
  72. "砂糖",
  73. //以上18-29为4星角色,总12项
  74. "绝弦",
  75. "西风猎弓",
  76. "弓藏",
  77. "暗巷猎手",
  78. "幽夜华尔兹",
  79. "祭礼残章",
  80. "西风秘典",
  81. "昭心",
  82. "暗巷的酒与诗",
  83. "匣里灭辰",
  84. "西风长枪",
  85. "西风大剑",
  86. "钟剑",
  87. "祭礼大剑",
  88. "雨裁",
  89. "西风剑",
  90. "笛剑",
  91. "匣里龙吟",
  92. "祭礼剑",
  93. "暗巷闪光",
  94. //以上30-49为4星武器,总20项
  95. "黑缨枪",
  96. "讨龙英杰谭",
  97. "翡玉法球",
  98. "魔导绪论",
  99. "弹弓",
  100. "神射手之誓",
  101. "鸦羽弓",
  102. "以理服人",
  103. "铁影阔剑",
  104. "沐浴龙血的剑",
  105. "黎明神剑",
  106. "飞天御剑",
  107. "冷刃"
  108. //以上50-62为3星武器,总13项
  109. };
  110. #endregion
  111. #region EnglishNameOfItem数组的声明,没事别点开!
  112. private string[] EnglishNameOfItem = new string[63]
  113. {
  114. "0",//从0开始
  115. "Eula","Mona","Albedo","Klee","Diluc","Jean",
  116. //以上是5星角色
  117. "SkywardBlade","AquilaFavonia","BeaconOfTheReedSea",
  118. "SongOfBrokenPines","Wolf'sGravestone","SkywardPride",
  119. "SkywardSpine","LostPrayerToTheSacredWinds","SkywardAtlas",
  120. "Hunter’sPath","SkywardHarp",
  121. //以上是5星武器
  122. "Amber","Barbara","Bennett","Diona","Fischl","Kaeya",
  123. "Lisa","Mika","Noelle","Razor","Rosaria","Sucrose",
  124. //以上是4星角色
  125. "TheStringless","FavoniusWarbow","Rust","AlleyHunter",
  126. "MitternachtsWaltz","SacrificialFragments","FavoniusCodex","EyeOfPerception",
  127. "WineAndSong","Dragon'sBane","FavoniusLance","FavoniusGreatsword",
  128. "TheBell","SacrificialGreatsword","Rainslasher","FavoniusSword",
  129. "TheFlute","Lion'sRoar","SacrificialSword","TheAlleyFlash",
  130. //以上是4星武器
  131. "BlackTassel","ThrillingTalesOfDragonSlayers","EmeraldOrb","MagicGuide","Slingshot",
  132. "Sharpshooter'sOath","RavenBow","DebateClub","FerrousShadow","BloodtaintedGreatsword",
  133. "HarbingerOfDawn","SkyriderSword","CoolSteel"
  134. //以上是3星武器
  135. };
  136. #endregion
  137. #region 变量的声明
  138. int[] Obtained = new int[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };//储存获取的角色或武器的Code编码
  139. int[] StarNumber = new int[10] { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 };//储存对应星级的数组
  140. int NumOfParyer = 1;
  141. PictureBox[] PB = new PictureBox[10];
  142. Panel[] P_PB = new Panel[10];
  143. int TimeCounter = 0;
  144. #endregion
  145. private void PrayerForm_Load(object sender, EventArgs e)
  146. {
  147. label_Exit.Location = new Point(this.Width / 2 - label_Exit.Width / 2,
  148. label_Exit.Location.Y);
  149. }
  150. public void Reshow(int[] TheRecoed,int Num=1,bool Has_5_Stars=false)
  151. {
  152. Obtained = TheRecoed;
  153. NumOfParyer = Num;
  154. for (int i = 0; i < Num; i++)
  155. StarNumber[i] = CodeTurnTheStarNumber(Obtained[i]);
  156. bool HasGold = false;
  157. switch (NumOfParyer)
  158. {
  159. case 1:
  160. for (int i=1;i<10;i++)
  161. PB[i].Visible = P_PB[i].Visible = false;//隐藏不必出现的控件
  162. PB[0].Location = new Point(737, 150);
  163. P_PB[0].Location = new Point(737, 671);
  164. //显示图片
  165. try
  166. {
  167. PB[0].Image = Image.FromFile("bins\\source\\" + EnglishNameOfItem[Obtained[0]] + ".png");
  168. }
  169. catch(Exception Ex)
  170. {
  171. MessageBox.Show("出现错误:" + Ex.Message, "出错啦", MessageBoxButtons.OK);
  172. }
  173. switch (StarNumber[0])
  174. {
  175. case 5:P_PB[0].BackColor = Color.Gold;break;
  176. case 4:P_PB[0].BackColor = Color.Purple;break;
  177. case 3:P_PB[0].BackColor = Color.RoyalBlue;break;
  178. }
  179. break;
  180. case 10:
  181. {
  182. for (int i = 0; i < 10; i++)
  183. {
  184. PB[i].Location = new Point(50 + 155 * i, 150);
  185. P_PB[i].Location = new Point(PB[i].Location.X, 671);
  186. PB[i].Visible = P_PB[i].Visible = true;
  187. HasGold = HasGold || (StarNumber[i] == 5);//判断十连是否出金,后面会用到
  188. }
  189. int Temp = 0;
  190. for (int i = 0; i < 10; i++)
  191. {
  192. for (int j = i+1; j < 10; j++)
  193. if (StarNumber[j] > StarNumber[i])
  194. {
  195. Temp = StarNumber[j];
  196. StarNumber[j] = StarNumber[i];
  197. StarNumber[i] = Temp;
  198. Temp = Obtained[j];
  199. Obtained[j] = Obtained[i];
  200. Obtained[i] = Temp;
  201. }
  202. }//对抽到的角色/武器按照星数进行排序
  203. for (int i = 0; i < 10; i++)
  204. {
  205. //显示图片
  206. try
  207. {
  208. PB[i].Image = Image.FromFile("bins\\source\\" + EnglishNameOfItem[Obtained[i]] + ".png");
  209. }
  210. catch (Exception Ex)
  211. {
  212. MessageBox.Show("出现错误:" + Ex.Message, "出错啦", MessageBoxButtons.OK);
  213. }
  214. switch (StarNumber[i])
  215. {
  216. case 5: P_PB[i].BackColor = Color.Gold; break;
  217. case 4: P_PB[i].BackColor = Color.Purple; break;
  218. case 3: P_PB[i].BackColor = Color.RoyalBlue; break;
  219. }
  220. }
  221. break;
  222. }
  223. default:
  224. MessageBox.Show("叫你不要乱改别人代码或者篡改数据,这下好了,出错了!",
  225. ">_<", MessageBoxButtons.OK);
  226. break;
  227. }//根据祈愿次数修改、重置UI
  228. label_Skip.Visible = true;
  229. //接下来是动画的加载以及UI中图片的布置
  230. if (axWindowsMediaPlayer_Load.Width != 1600) axWindowsMediaPlayer_Load.Width = 1600;
  231. axWindowsMediaPlayer_Load.Visible = true;
  232. switch (NumOfParyer)
  233. {
  234. case 1://如果是单抽,就包含蓝、紫、金三种抽卡动画
  235. {
  236. try
  237. {
  238. axWindowsMediaPlayer_Load.URL = "bins\\Prayer_1_" + StarNumber[0].ToString() + ".mp4";
  239. }
  240. catch(Exception Ex)
  241. {
  242. MessageBox.Show("出错啦!错误信息:" + Ex.Message, "出错啦", MessageBoxButtons.OK);
  243. }
  244. break;
  245. }
  246. case 10://如果是十连,就只有出紫和出金两种动画
  247. {
  248. try
  249. {
  250. axWindowsMediaPlayer_Load.URL = "bins\\Prayer_10_" + (4 + ((HasGold) ? 1 : 0)).ToString() + ".mp4";
  251. }
  252. catch(Exception Ex)
  253. {
  254. MessageBox.Show("出错啦!错误信息:" + Ex.Message, "出错啦", MessageBoxButtons.OK);
  255. }
  256. break;
  257. }
  258. default:
  259. MessageBox.Show("叫你不要乱改别人代码或者篡改数据,这下好了,出错了!",
  260. ">_<", MessageBoxButtons.OK);
  261. break;
  262. }//抽卡动画的加载
  263. TimeCounter = 0;
  264. timer_Load.Enabled = true;
  265. timer_Load.Start();
  266. //this.Show();
  267. }//让窗体播放动画、重置界面布局、加载内容的方法
  268. public int CodeTurnTheStarNumber(int Code)
  269. {
  270. int Num = 3;
  271. if (Code >= 1 && Code <= 17) Num = 5;
  272. else if (Code >= 18 && Code <= 49) Num = 4;
  273. return Num;
  274. }//将Code编码转化为星级数的方法
  275. private void label_Skip_Click(object sender, EventArgs e)
  276. {
  277. axWindowsMediaPlayer_Load.URL = "";
  278. axWindowsMediaPlayer_Load.Width = 0;
  279. axWindowsMediaPlayer_Load.Visible = false;
  280. label_Skip.Visible = false;
  281. }
  282. private void PrayerForm_Click(object sender, EventArgs e)
  283. {
  284. this.Hide();
  285. }
  286. private void label_Exit_Click(object sender, EventArgs e)
  287. {
  288. this.Hide();
  289. }
  290. private void timer_Load_Tick(object sender, EventArgs e)
  291. {
  292. TimeCounter++;
  293. if (TimeCounter>=60)
  294. {
  295. timer_Load.Stop();
  296. axWindowsMediaPlayer_Load.Width = 0;
  297. axWindowsMediaPlayer_Load.Visible = false;
  298. axWindowsMediaPlayer_Load.URL = "";
  299. }
  300. }
  301. }
  302. }

(五)InformationForm窗体

注:该窗体为MDI子窗体。

设计样式:

页面源代码:

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Diagnostics;
  11. namespace 原神混池模拟器
  12. {
  13. public partial class InformationForm : Form
  14. {
  15. public InformationForm()
  16. {
  17. InitializeComponent();
  18. pictureBox_Info.MouseWheel += new MouseEventHandler(pictureBox_Info_MouseWheel);
  19. }
  20. #region 变量的声明
  21. private bool dragging = false;
  22. private Point dragCursorPoint;
  23. private Point dragFormPoint;
  24. bool MouseWheelMove = false;
  25. #endregion
  26. private void InformationForm_Load(object sender, EventArgs e)
  27. {
  28. }
  29. private void pictureBox_Exit_Click(object sender, EventArgs e)
  30. {
  31. this.Hide();
  32. }
  33. private void pictureBox_Info_MouseDown(object sender, MouseEventArgs e)
  34. {
  35. dragging = true;
  36. dragCursorPoint = Cursor.Position;
  37. dragFormPoint = pictureBox_Info.Location;
  38. }
  39. private void pictureBox_Info_MouseEnter(object sender, EventArgs e)
  40. {
  41. MouseWheelMove = true;
  42. pictureBox_Info.Focus();
  43. }
  44. private void pictureBox_Info_MouseLeave(object sender, EventArgs e)
  45. {
  46. MouseWheelMove = false;
  47. }
  48. private void pictureBox_Info_MouseMove(object sender, MouseEventArgs e)
  49. {
  50. if (dragging)
  51. {
  52. Point dif = Point.Subtract(Cursor.Position, new Size(dragCursorPoint));
  53. int minY = -(pictureBox_Info.Height - panel_Info.Height); // 最小 y 坐标
  54. int maxY = 0; // 最大 y 坐标
  55. int y = pictureBox_Info.Location.Y + dif.Y / 25;
  56. if (y >= minY && y <= maxY)
  57. pictureBox_Info.Location = new Point(pictureBox_Info.Location.X, y);
  58. else
  59. {
  60. if (y < minY) pictureBox_Info.Location = new Point(pictureBox_Info.Location.X, minY);
  61. if (y > maxY) pictureBox_Info.Location = new Point(pictureBox_Info.Location.X, maxY);
  62. }
  63. }
  64. }
  65. private void pictureBox_Info_MouseUp(object sender, MouseEventArgs e)
  66. {
  67. dragging = false;
  68. }
  69. private void pictureBox_Info_MouseWheel(object sender, MouseEventArgs e)
  70. {//使用鼠标滚轮进行控制的操作
  71. if (MouseWheelMove)
  72. {
  73. int minY = -(pictureBox_Info.Height - panel_Info.Height); // 最小 y 坐标
  74. int maxY = 0; // 最大 y 坐标
  75. int y = pictureBox_Info.Location.Y + e.Delta / Math.Abs(e.Delta) * 100;
  76. if (y >= minY && y <= maxY)
  77. pictureBox_Info.Location = new Point(pictureBox_Info.Location.X, y);
  78. else
  79. {
  80. if (y < minY) pictureBox_Info.Location = new Point(pictureBox_Info.Location.X, minY);
  81. if (y > maxY) pictureBox_Info.Location = new Point(pictureBox_Info.Location.X, maxY);
  82. }
  83. }
  84. }
  85. private void pictureBox_About_Click(object sender, EventArgs e)
  86. {
  87. try
  88. {
  89. Process.Start("http://sherrychou.blog.csdn.net");
  90. }
  91. catch (Exception ex)
  92. {
  93. MessageBox.Show("出现错误:" + ex.Message, "出错啦", MessageBoxButtons.OK);
  94. }
  95. }
  96. private void pictureBox_Info_Click(object sender, EventArgs e)
  97. {
  98. }
  99. }
  100. }

(六)HistoryForm窗体

注:该窗体为MDI子窗体。

设计样式:

页面源代码:

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace 原神混池模拟器
  11. {
  12. public partial class HistoryForm : Form
  13. {
  14. public HistoryForm(/*string[,] _history, int _max=200*/)
  15. {
  16. InitializeComponent();
  17. this.MouseWheel += new MouseEventHandler(Form_MouseWheel);
  18. //HistoryRecord = _history;
  19. //MaxPage = _max;
  20. LabelMatrix[0, 0] = label1_1;
  21. LabelMatrix[0, 1] = label1_2;
  22. LabelMatrix[0, 2] = label1_4;
  23. LabelMatrix[1, 0] = label2_1;
  24. LabelMatrix[1, 1] = label2_2;
  25. LabelMatrix[1, 2] = label2_4;
  26. LabelMatrix[2, 0] = label3_1;
  27. LabelMatrix[2, 1] = label3_2;
  28. LabelMatrix[2, 2] = label3_4;
  29. LabelMatrix[3, 0] = label4_1;
  30. LabelMatrix[3, 1] = label4_2;
  31. LabelMatrix[3, 2] = label4_4;
  32. LabelMatrix[4, 0] = label5_1;
  33. LabelMatrix[4, 1] = label5_2;
  34. LabelMatrix[4, 2] = label5_4;
  35. }
  36. #region 变量的声明
  37. string[,] HistoryRecord = new string[1000, 3];
  38. bool MouseWheelMove = false;
  39. int CurrentPage = 1;
  40. int MaxPage = 200, NumOfHistory = 1000;
  41. Label[,] LabelMatrix = new Label[5, 3];
  42. const int X_Labeln_2 = 540;
  43. PrayerForm _pf = new PrayerForm();
  44. #endregion
  45. private void HistoryForm_Load(object sender, EventArgs e)
  46. {
  47. //Nothing running
  48. }
  49. private void Form_MouseWheel(object sender, MouseEventArgs e)
  50. {
  51. if (MouseWheelMove)
  52. {
  53. int y = e.Delta / Math.Abs(e.Delta);
  54. switch (y)
  55. {
  56. case 1:
  57. if (CurrentPage > 1)
  58. CurrentPage--;
  59. break;
  60. case -1:
  61. if (CurrentPage < MaxPage-((NumOfHistory % 5 == 0)? 1:0))
  62. CurrentPage++;
  63. break;
  64. default:
  65. MessageBox.Show("出现错误:数据错误无法解析!", "x_x", MessageBoxButtons.OK);
  66. break;
  67. }
  68. UpdateTheList(CurrentPage);//更新显示内容
  69. }
  70. }
  71. private void pictureBox_Exit_Click(object sender, EventArgs e)
  72. {
  73. this.Hide();
  74. }
  75. private void HistoryForm_MouseEnter(object sender, EventArgs e)
  76. {
  77. MouseWheelMove = true;
  78. }
  79. private void HistoryForm_MouseLeave(object sender, EventArgs e)
  80. {
  81. MouseWheelMove = false;
  82. }
  83. private void UpdateTheList(int PageNumber)
  84. {//更新显示出的列表的内容的方法
  85. label_Page.Text = PageNumber.ToString();
  86. label_Page.Location = new Point((this.Width - label_Page.Width) / 2,
  87. label_Page.Location.Y);
  88. //以上更新页码显示并使其居中
  89. //接下来更新列表显示内容
  90. int _temp = 0,LastLine;
  91. LastLine = Math.Max(NumOfHistory - (PageNumber - 1) * 5 - 5, 0);
  92. label1_3.Text = label2_3.Text = label3_3.Text = label4_3.Text = label5_3.Text = "";
  93. for (int i = 0; i <= 4; i++)
  94. for (int j = 0; j < 3; j++)
  95. LabelMatrix[i, j].Text = "";//先清空原先显示的内容
  96. for (int i = NumOfHistory - (PageNumber - 1) * 5-1; i >= LastLine; i--)
  97. {
  98. int Temp = -(i - NumOfHistory + (PageNumber - 1) * 5) - 1;
  99. for (int j = 0; j < 3; j++)
  100. {
  101. LabelMatrix[Temp, j].Text = HistoryRecord[i, j];
  102. if (j == 1)
  103. {
  104. LabelMatrix[Temp, j].Location = new Point(X_Labeln_2 - LabelMatrix[Temp, j].Width / 2,
  105. LabelMatrix[Temp, j].Location.Y);//居中
  106. _temp = 0;
  107. do
  108. {
  109. _temp++;
  110. if (_pf.ChineseNameOfItem[_temp] == LabelMatrix[Temp, j].Text)
  111. break;
  112. } while (true);
  113. if (_temp >= 1 && _temp <= 17) LabelMatrix[Temp, j].ForeColor = Color.Gold;
  114. else if (_temp >= 18 && _temp <= 49) LabelMatrix[Temp, j].ForeColor = Color.Purple;
  115. else LabelMatrix[Temp, j].ForeColor = Color.Black;
  116. }
  117. }
  118. switch (Temp)
  119. {
  120. case 0: label1_3.Text = "集录祈愿"; break;
  121. case 1: label2_3.Text = "集录祈愿"; break;
  122. case 2: label3_3.Text = "集录祈愿"; break;
  123. case 3: label4_3.Text = "集录祈愿"; break;
  124. case 4: label5_3.Text = "集录祈愿"; break;
  125. default: MessageBox.Show("出现错误:数据参数无法解析!", "x_x", MessageBoxButtons.OK); break;
  126. }
  127. }
  128. }
  129. private void pictureBox_Left_Click(object sender, EventArgs e)
  130. {
  131. UpdateTheList(CurrentPage = (CurrentPage > 1) ? (CurrentPage - 1) : 1);
  132. }
  133. private void pictureBox_Right_Click(object sender, EventArgs e)
  134. {
  135. UpdateTheList(CurrentPage = (CurrentPage < MaxPage - ((NumOfHistory % 5 == 0) ? 1 : 0)) ?
  136. (CurrentPage + 1) : CurrentPage);
  137. }
  138. private void pictureBox_Left_DoubleClick(object sender, EventArgs e)
  139. {
  140. if (CurrentPage >= 1)
  141. switch (CurrentPage)
  142. {
  143. case 1:
  144. case 2:
  145. case 3:
  146. UpdateTheList(CurrentPage = 1);
  147. break;
  148. default:
  149. UpdateTheList(CurrentPage = CurrentPage - 2);
  150. break;
  151. }
  152. else MessageBox.Show("出现了意料之外的错误!", "x_x", MessageBoxButtons.OK);
  153. }
  154. private void pictureBox_Right_DoubleClick(object sender, EventArgs e)
  155. {
  156. int TempMaxPage = NumOfHistory / 5 + ((NumOfHistory % 5 == 0) ? 0 : 1);
  157. if (CurrentPage <= TempMaxPage)
  158. if (CurrentPage == TempMaxPage || CurrentPage == TempMaxPage - 1 || CurrentPage == TempMaxPage - 2)
  159. UpdateTheList(CurrentPage = TempMaxPage);
  160. else UpdateTheList(CurrentPage = CurrentPage + 2);
  161. else MessageBox.Show("出现了意料之外的错误!", "x_x", MessageBoxButtons.OK);
  162. }
  163. public void Reshow(string[,] _history,int _num=1000)
  164. {//让该页面重新显示的方法
  165. /*内容包括但不限于:
  166. * 将History[,]传入该页面
  167. * 更新列表内容
  168. * 将首先显示出的页面设置为1
  169. */
  170. HistoryRecord = _history;
  171. MaxPage = _num/5 + 1;
  172. NumOfHistory = _num;
  173. UpdateTheList(CurrentPage = 1);//将CP重新赋值为1并更新列表显示
  174. this.Show();
  175. }
  176. }
  177. }

(七).manifest文件

将以下代码取消注释:

  1. <application xmlns="urn:schemas-microsoft-com:asm.v3">
  2. <windowsSettings>
  3. <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
  4. </windowsSettings>
  5. </application>

四、其他说明

  1. 该软件不用于盈利,不允许被用于盈利,不允许用作商业用途。
  2. 软件中的图片与视频素材版权所有仍归游戏《原神》所属公司所有。
  3. 该模拟器模拟结果仅作为参考,请勿将其当作游戏内祈愿的必定结果。
  4. 该项目为作者的个人项目,开发力量微薄,出现bug还请谅解,同时也欢迎广大用户反馈!

字数统计菌:28,521字

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/401890
推荐阅读
相关标签
  

闽ICP备14008679号