TextTwist1:模拟(译文)
By robot-v1.0
本文链接 https://www.kyfws.com/games/texttwist1-a-mock-up-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 13 分钟阅读 - 6050 个词 阅读量 0TextTwist1:模拟(译文)
原文地址:https://www.codeproject.com/Articles/357711/TextTwist1-A-Mock-Up
原文作者:rspercy65
译文由本站 robot-v1.0 翻译
前言
Addiction time. Play a moch-up version of Text Twist, (a guess all the words), before your time runs out, type game.
成瘾时间.在您的时间用完之前,玩一个Text Twist的模拟版本(猜所有单词),然后键入game.
- 下载演示和源(Download Demo and Source)
- 下载完整的应用程序和最新资源-837 Kb(Download Full App And Latest Source - 837 Kb)
介绍(Introduction)
您喜欢不能停止玩的小型游戏吗?试试这个…(Do you like small games that you just cant stop playing? Try this one…)
背景(Background)
我在玩(I was playing)超级文字扭曲®(Super Text Twist®)通过(by)GameHouse™(GameHouse™)游戏一直让我崩溃.(Games and it kept crashing on me.I run)Windows7®™(Windows7®™)Win7不喜欢这个游戏.然后,我决定开始自己的游戏版本,但不知道从哪里开始.我首先创建了要使用的所有表格,然后开始在以下位置搜索代码(and win7 doesnt like the game. I then decided to start my own version of the game but didnt quite knowwhere to start. I first created all the forms I was going to use and then I started searching for code at) PSC(PSC) 碰到一个(and came across a)VB2005®Beta Express(VB 2005® beta express)版本由(version by)Salan S.Al-Ani(Salan S. Al-Ani).可以看出他的游戏版本(. His version of the game can be seen) 在PSC(at PSC) 我在游戏版本中增加了视觉效果.我还添加了得分,添加高分并将其删除,您必须找到的单词总数以及3至7个字母单词计数器,具体取决于使用5个,6个或7个字母单词的难度阶段.(.I added a more visual effect to my version of the game. I also added scoring, add high scores and remove them, total of the words you have to find, and 3 to 7 letter word counters depending on the difficulty stage using 5, 6, or 7 letter words.)
使用代码(Using the code)
我试图使主窗体(如上所示)尽可能接近原始窗体(指的是(I tried to keep the main form(shown above) as close as possible to the original(referring to the program on)PSC®™(PSC®™)),而无需尝试将其复制到TEE.我为应用程序添加了色彩和柔和的视觉效果,以实现更好的播放效果(如上图所示).所有背景都是在() without trying to copy it to a TEE.I added color and a mellow visual feeling to the app for a better playing effect(pic shown above). All backgrounds were created in)PSCS3®™(PS CS3®™).我确实使用了一些旧的代码(. I did usesome of the old code from the) PSC(PSC) 版本,然后重新编辑并添加了很多代码,使其可以像原始代码一样工作((version and re-edited and added a lot of code to work like the original()超级文字扭曲®(Super Text Twist®)).().)
移动表格(Moving the Forms)
让我们开始吧,作为主要形式(如上所示)和(Let’s get started, As the main form(shown above) and the) Options
表格(如下所示)没有(form(shown below) have no) TitleBars
,我们需要一种在需要时移动它们的方法. (代码将显示在下面).所有其他形式都是固定的.在全屏模式下,我们需要一种退出全屏模式的方法.我用了闪烁(, we need a way to move them when needed. (Code will be displayed below). All other forms are stationary. When in fullscreen mode we need a way to exit out of fullscreen mode. I used a flashing) Label
在一个(in a) Timer
向用户显示如何执行此操作.(to display how do to this to the user.)
'As we do not have a title bar, we will need to drag the form if we need to.
Private Sub frmTextTwist_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
If e.Button = Windows.Forms.MouseButtons.Left Then
Me.isDragging = True
pointClicked = New Point(e.X, e.Y)
Else
Me.isDragging = False
End If
End Sub
'This sub does the actual dragging of the form.
Private Sub frmTextTwist_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If Me.isDragging Then
Dim pointMovedTo As Point
pointMovedTo = Me.PointToScreen(New Point(e.X, e.Y))
pointMovedTo.Offset(-pointClicked.X, -pointClicked.Y)
Me.Location = pointMovedTo
End If
End Sub
'This stops the dragging of the form.
Private Sub frmTextTwist_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
Me.isDragging = False
End Sub
加载并退出全屏模式(Load and Exit FullScreen Mode)
如果您想以全屏模式播放,只需检查(If you want to play in fullscreen mode, just check the) CheckBox
在"选项"表单中,然后单击(in the Options form and click the) CLOSE LABEL
.这将取消全屏模式.加载后,您将看到闪烁的(. This will lode the fullscreen mode. Once loaded, you will see a flashing) Label
.的(. The) frmTextTwist_KeyDown
当您按下(event gets fired when you press the) Escape Key
在键盘上. (以下两个事件的代码)…(on your keyboard. (Code below for both events)…)
Private Sub frmTextTwist_SizeChanged(sender As Object, e As System.EventArgs) Handles Me.SizeChanged
'Display a notice on how to exit Fullscreen mode.
If Me.WindowState = FormWindowState.Maximized Then
lblNotice.Location = New Point(CInt((Me.Width - lblNotice.Width) / 2), CInt((Me.Height - lblNotice.Height) / 2))
lblNotice.Visible = True
timerNotice.Start()
Else
lblNotice.Location = New Point(241, 229)
lblNotice.Visible = False
timerNotice.Stop()
End If
End Sub
'timerNotice uses code for flashing the lblNotice
Private Sub timerNotice_Tick(sender As Object, e As System.EventArgs) Handles timerNotice.Tick
iTick += 1
'To get the users attention...Flash the lable
Select Case iTick
Case 1
lblNotice.ForeColor = Color.Black
Case 2
lblNotice.ForeColor = Color.White
Case 3
lblNotice.ForeColor = Color.Black
Case 4
lblNotice.ForeColor = Color.White
Case 5
lblNotice.ForeColor = Color.Black
End Select
If iTick = 5 Then
iTick = 0
lblNotice.Visible = False
timerNotice.Stop()
End If
End Sub
Private Sub frmTextTwist_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
'If we are in full screen mode only, we press the esc key to reset the window state to normal.
If e.KeyData <> Keys.Escape Then
'Do Nothing
Else
'The esc key was pressed.
Me.WindowState = FormWindowState.Normal
'Be sure we uncheck the checkbox in frmOptions.
frmOptions.chkFullScreen.Checked = False
End If
End Sub
真正的黄油还是假黄油?(Real Butter or Fake Butter?)
接下来,我们有按钮的FAKE动画((Next, we have the the FAKE animation of the buttons() Button
1通(1 thru) Button
7).这是通过设置一些(7). This is accomplished by setting some) Points
并设置一些(and setting some) Booleans
至(to) True
要么(or) False
.除了七个按钮的名称外,其余所有七个按钮的代码均相同.我们还将按钮文本添加到不可见(. The code that follows is the same for all seven buttons except for the buttons name. We also add the button text to an invisible) Label
当我们点击(to be used when we click the)输入(Enter) Button
.(.)
Private Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
If NowPlaying = True And FirstRun = False Then
Dim s As String
Select Case Difficulty
Case 1
If AO1 = True And AO2 = False And AO3 = False And AO4 = False And AO5 = False And Button1.Location <> BL1 Then AO1 = False
If AO1 = True And AO2 = True And AO3 = False And AO4 = False And AO5 = False And Button1.Location <> BL1 Then AO2 = False
If AO1 = True And AO2 = True And AO3 = True And AO4 = False And AO5 = False And Button1.Location <> BL1 Then AO3 = False
If AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = False And Button1.Location <> BL1 Then AO4 = False
If AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = True And Button1.Location <> BL1 Then AO5 = False
If Button1.Location <> BL1 Then
Button1.Location = BL1
s = lblAnswer.Text
s = s.Replace(Button1.Text, "")
lblAnswer.Text = s
Exit Sub
End If
lblAnswer.Text += Button1.Text
If AO1 = False And AO2 = False And AO3 = False And AO4 = False And AO5 = False Then
Button1.Location = BL1a
AO1 = True
ElseIf AO1 = True And AO2 = False And AO3 = False And AO4 = False And AO5 = False Then
Button1.Location = BL2b
AO2 = True
ElseIf AO1 = True And AO2 = True And AO3 = False And AO4 = False And AO5 = False Then
Button1.Location = BL3c
AO3 = True
ElseIf AO1 = True And AO2 = True And AO3 = True And AO4 = False And AO5 = False Then
Button1.Location = BL4d
AO4 = True
ElseIf AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = False Then
Button1.Location = BL5e
AO5 = True
End If
Case 2
If AO1 = True And AO2 = False And AO3 = False And AO4 = False And AO5 = False And AO6 = False And Button1.Location <> BL1 Then AO1 = False
If AO1 = True And AO2 = True And AO3 = False And AO4 = False And AO5 = False And AO6 = False And Button1.Location <> BL1 Then AO2 = False
If AO1 = True And AO2 = True And AO3 = True And AO4 = False And AO5 = False And AO6 = False And Button1.Location <> BL1 Then AO3 = False
If AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = False And AO6 = False And Button1.Location <> BL1 Then AO4 = False
If AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = True And AO6 = False And Button1.Location <> BL1 Then AO5 = False
If AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = True And AO6 = True And Button1.Location <> BL1 Then AO6 = False
If Button1.Location <> BL1 Then
Button1.Location = BL1
s = lblAnswer.Text
s = s.Replace(Button1.Text, "")
lblAnswer.Text = s
Exit Sub
End If
lblAnswer.Text += Button1.Text
If AO1 = False And AO2 = False And AO3 = False And AO4 = False And AO5 = False And AO6 = False Then
Button1.Location = BL1a
AO1 = True
ElseIf AO1 = True And AO2 = False And AO3 = False And AO4 = False And AO5 = False And AO6 = False Then
Button1.Location = BL2b
AO2 = True
ElseIf AO1 = True And AO2 = True And AO3 = False And AO4 = False And AO5 = False And AO6 = False Then
Button1.Location = BL3c
AO3 = True
ElseIf AO1 = True And AO2 = True And AO3 = True And AO4 = False And AO5 = False And AO6 = False Then
Button1.Location = BL4d
AO4 = True
ElseIf AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = False And AO6 = False Then
Button1.Location = BL5e
AO5 = True
ElseIf AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = True And AO6 = False Then
Button1.Location = BL6f
AO6 = True
End If
Case 3
If AO1 = True And AO2 = False And AO3 = False And AO4 = False And AO5 = False And AO6 = False And AO7 = False And Button1.Location <> BL1 Then AO1 = False
If AO1 = True And AO2 = True And AO3 = False And AO4 = False And AO5 = False And AO6 = False And AO7 = False And Button1.Location <> BL1 Then AO2 = False
If AO1 = True And AO2 = True And AO3 = True And AO4 = False And AO5 = False And AO6 = False And AO7 = False And Button1.Location <> BL1 Then AO3 = False
If AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = False And AO6 = False And AO7 = False And Button1.Location <> BL1 Then AO4 = False
If AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = True And AO6 = False And AO7 = False And Button1.Location <> BL1 Then AO5 = False
If AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = True And AO6 = True And AO7 = False And Button1.Location <> BL1 Then AO6 = False
If AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = True And AO6 = True And AO7 = True And Button1.Location <> BL1 Then AO7 = False
If Button1.Location <> BL1 Then
Button1.Location = BL1
s = lblAnswer.Text
s = s.Replace(Button1.Text, "")
lblAnswer.Text = s
Exit Sub
End If
lblAnswer.Text += Button1.Text
If AO1 = False And AO2 = False And AO3 = False And AO4 = False And AO5 = False And AO6 = False And AO7 = False Then
Button1.Location = BL1a
AO1 = True
ElseIf AO1 = True And AO2 = False And AO3 = False And AO4 = False And AO5 = False And AO6 = False And AO7 = False Then
Button1.Location = BL2b
AO2 = True
ElseIf AO1 = True And AO2 = True And AO3 = False And AO4 = False And AO5 = False And AO6 = False And AO7 = False Then
Button1.Location = BL3c
AO3 = True
ElseIf AO1 = True And AO2 = True And AO3 = True And AO4 = False And AO5 = False And AO6 = False And AO7 = False Then
Button1.Location = BL4d
AO4 = True
ElseIf AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = False And AO6 = False And AO7 = False Then
Button1.Location = BL5e
AO5 = True
ElseIf AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = True And AO6 = False And AO7 = False Then
Button1.Location = BL6f
AO6 = True
ElseIf AO1 = True And AO2 = True And AO3 = True And AO4 = True And AO5 = True And AO6 = True And AO7 = False Then
Button1.Location = BL7g
AO7 = True
End If
End Select
End If
End Sub
在启动时加载字典(Loading the Dictionaries at Start-up)
我们需要先将字典加载到4种不同的字典中(We need to start by loading the dictionaries to 4 different) StreamReader
s并再次为4个不同(s and again to 4 different) FileInfo
持有人.(holders.) Declare
一种(a) integer
总共四个(to hold the total of the 4) FileInfo
持有人,通过以下方式向用户展示我们的进步(holders, show our progress to the user by way of a) Progressbar
,声明一些(, Declare some) New ArrayLists
然后开始将文件读入数组.然后清理并设置游戏计时器为(and start reading the files into the arrays. Then clean up and set the game timer to) False
直到我们开始游戏.(until we start the game.)
Public Sub Startup()
NowPlaying = False
Dim line As String
Dim MyReaderDicAll As System.IO.StreamReader
Dim MyReaderDic5L As System.IO.StreamReader
Dim MyReaderDic6L As System.IO.StreamReader
Dim MyReaderDic7L As System.IO.StreamReader
MyReaderDicAll = My.Computer.FileSystem.OpenTextFileReader(Application.StartupPath & "\Dic\DicAll.txt")
MyReaderDic5L = My.Computer.FileSystem.OpenTextFileReader(Application.StartupPath & "\Dic\Dic5L.txt")
MyReaderDic6L = My.Computer.FileSystem.OpenTextFileReader(Application.StartupPath & "\Dic\Dic6L.txt")
MyReaderDic7L = My.Computer.FileSystem.OpenTextFileReader(Application.StartupPath & "\Dic\Dic7L.txt")
Dim infoAll As System.IO.FileInfo
Dim info5L As System.IO.FileInfo
Dim info6L As System.IO.FileInfo
Dim info7L As System.IO.FileInfo
infoAll = My.Computer.FileSystem.GetFileInfo(Application.StartupPath & "\Dic\DicAll.txt")
info5L = My.Computer.FileSystem.GetFileInfo(Application.StartupPath & "\Dic\Dic5L.txt")
info6L = My.Computer.FileSystem.GetFileInfo(Application.StartupPath & "\Dic\Dic6L.txt")
info7L = My.Computer.FileSystem.GetFileInfo(Application.StartupPath & "\Dic\Dic7L.txt")
Dim max As Integer
max = CInt(infoAll.Length + info5L.Length + info6L.Length + info7L.Length)
PB_Loading.Style = ProgressBarStyle.Blocks
PB_Loading.Minimum = 0
PB_Loading.Maximum = max
PB_Loading.Value = 0
DicAll = New ArrayList
line = MyReaderDicAll.ReadLine()
While Not line Is Nothing
PB_Loading.Value = PB_Loading.Value + line.Length + 2
DicAll.Add(line.ToString)
line = MyReaderDicAll.ReadLine()
End While
Dic5L = New ArrayList
line = MyReaderDic5L.ReadLine()
While Not line Is Nothing
PB_Loading.Value = PB_Loading.Value + line.Length + 2
Dic5L.Add(line.ToString)
line = MyReaderDic5L.ReadLine()
End While
Dic6L = New ArrayList
line = MyReaderDic6L.ReadLine()
While Not line Is Nothing
PB_Loading.Value = PB_Loading.Value + line.Length + 2
Dic6L.Add(line.ToString)
line = MyReaderDic6L.ReadLine()
End While
Dic7L = New ArrayList
line = MyReaderDic7L.ReadLine()
While Not line Is Nothing
PB_Loading.Value = PB_Loading.Value + line.Length + 2
Dic7L.Add(line.ToString)
line = MyReaderDic7L.ReadLine()
End While
MyReaderDicAll.Close()
MyReaderDic5L.Close()
MyReaderDic6L.Close()
MyReaderDic7L.Close()
timerGame.Enabled = False
End Sub
输入按钮(The Enter Button)
这是大约60%的程序潜伏的地方.首先我们检查一些(This is where about 60% of the program lurks. First we check some) Booleans
看看我们是否要退出(to see if we are going to exit the) Sub
或不.接下来,我们声明一些子变量((or not. Next we declaresome in-sub variables() String, Integer and Boolean
)分别.记得上面我提到的隐形()respectively. Remember above where I made reference to a invisible) Label
?这是我们设置我们的地方(?. This is where we set our) String
(仅声明)为无形((just declared) to the invisible) labels
文本((text() lblAnswer
).接下来,我们将检查长度(). Next we will check the length of our) String
.如果(. If the) String
少于3个字符长,那么我们(is less than 3 characters long, then we) Clear
(稍后说明)所有内容并退出((Explained later) everything and exit the) Sub
,否则,我们继续检查是否已经拥有我们的(, Else, we continue on and check to see if we already have our) String
在我们的(in our) ListBox
(lstCorrectWords)使用((lstCorrectWords) using the) StrCompare()
方法.如果我们(method. If our) String
在列表框中,然后我们(is in the ListBox, then we) Clear
一切,退出子节点并重新开始,否则,我们继续.如果单词足够长或不够长,则会向用户显示消息,正确,已经在(everything , Exit the sub and start over once more, Else, we continue on. Messages are displayed to the user if the word is or isnt long enough, Correct, Already in) Listbox
, 是个(, Is the) ChoosenWord
或不.所有字计数器都会更新(如果字长为3个字母,则((or not. All word counters are updated(if word is 3 letters long then () threeLetters
-=1)),以此类推.我摔倒(-= 1)) and so on for the rest of the counters. If all) PossibleWords
找到后,我们进行大量清理,并向用户显示所有可能的单词(are found then we do alot of clean-up and display to the user all possible words in the) ListBox
根据长度按字母顺序排列.您的分数也会显示出来.然后我们通过按(in alphabetical order according to length. Your score is displayed also. Then we continue the game by pressing the) Proceed Button
.(.)
Private Sub btnEnter_Click(sender As System.Object, e As System.EventArgs) Handles btnEnter.Click
If NowPlaying = False Or FirstRun = True Then
Exit Sub
End If
Dim str As String
Dim i As Integer
Dim Okay As Boolean
str = lblAnswer.Text
If str.Length < 3 Then
lblNotify.Text = "The word should be at least 3 letters long."
Clear()
Exit Sub
End If
For i = 0 To lstCorrectWords.Items.Count - 1
If StrComp(lstCorrectWords.Items(i).ToString, str, CompareMethod.Text) = 0 Then
lblNotify.Text = "You already submitted this word (" & str & ")"
Clear()
Exit Sub
End If
Next i
Okay = False
For i = 0 To PossibleWords.Count - 1
If StrComp(str, PossibleWords.Item(i).ToString, CompareMethod.Text) = 0 Then
Okay = True
Exit For
End If
Next i
If Okay = True Then
If str.Length = 4 + Difficulty And str = ChoosenWord Then
lblNotify.Text = "Excellent (" & str & ")"
scoreTotal += 1500
totalWords -= 1
lblWordsToFind.Text = "Number of words to find ====>> " & totalWords.ToString
If Difficulty = 3 And str = ChoosenWord Then
sevenLetters -= 1
lblWordsWithSevenLetters.Text = "Words with 7 letters : " & sevenLetters.ToString()
ElseIf Difficulty = 2 And str = ChoosenWord Then
sixLetters -= 1
lblWordsWithSixLetters.Text = "Words with 6 letters : " & sixLetters.ToString()
ElseIf Difficulty = 1 And str = ChoosenWord Then
fiveLetters -= 1
lblWordsWithFiveLetters.Text = "Words with 5 letters : " & fiveLetters.ToString()
End If
btnProceed.Enabled = True
Else
lblNotify.Text = "Correct Word (" & str & ")"
If str.Length = 3 Then
scoreTotal += 250
totalWords -= 1
lblWordsToFind.Text = "Number of words to find ====>> " & totalWords.ToString
threeLetters -= 1
lblWordsWithThreeLetters.Text = "Words with 3 letters : " & threeLetters.ToString()
ElseIf str.Length = 4 Then
scoreTotal += 500
totalWords -= 1
lblWordsToFind.Text = "Number of words to find ====>> " & totalWords.ToString
fourLetters -= 1
lblWordsWithFourLetters.Text = "Words with 4 letters : " & fourLetters.ToString()
ElseIf str.Length = 5 Then
scoreTotal += 750
totalWords -= 1
lblWordsToFind.Text = "Number of words to find ====>> " & totalWords.ToString
fiveLetters -= 1
lblWordsWithFiveLetters.Text = "Words with 5 letters : " & fiveLetters.ToString()
ElseIf str.Length = 6 Then
scoreTotal += 1000
totalWords -= 1
lblWordsToFind.Text = "Number of words to find ====>> " & totalWords.ToString
sixLetters -= 1
lblWordsWithSixLetters.Text = "Words with 6 letters : " & sixLetters.ToString()
ElseIf str.Length = 7 Then
scoreTotal += 1500
totalWords -= 1
lblWordsToFind.Text = "Number of words to find ====>> " & totalWords.ToString
sevenLetters -= 1
lblWordsWithSevenLetters.Text = "Words with 7 letters : " & sevenLetters.ToString()
End If
End If
lstCorrectWords.Items.Add(str)
If lstCorrectWords.Items.Count = PossibleWords.Count Then
lblNotify.Text = "Excellent, you submitted all the possible words"
totalWords = 0
lblWordsToFind.Text = "Number of words to find ====>> " & totalWords.ToString
NowPlaying = False
GameTimerSec = 0
lblTimeHolder.Text = "0:00"
timerGame.Enabled = False
RedoList()
ShowWords()
Exit Sub
End If
Else
lblNotify.Text = "Sorry, this word is not supported in our dictionary (" & str & ")"
End If
lblScoreHolder.Text = scoreTotal.ToString() 'Display the user's score
Clear()
End Sub
清晰,分类,随机播放和扭曲,这就是我们" Doit-Doit"的方式(Clear, Sort, Shuffle and Twist, This is How We “Doit-Doit”)
的(The) Clear
子重置(sub resets) lblAnswer
至(to) Nothing
,设置(, Sets the) Enabled
和(and) Location Properties
的((of () Button
1通(1 thru) Button
7)(7) to) True
和各自的位置并设置其(and respective locations and sets their) Booleans
至(to) True
.(.)
Public Sub Clear()
lblAnswer.Text = ""
Button1.Enabled = True
Button2.Enabled = True
Button3.Enabled = True
Button4.Enabled = True
Button5.Enabled = True
Button6.Enabled = True
Button7.Enabled = True
Button1.Location = BL1
Button2.Location = BL2
Button3.Location = BL3
Button4.Location = BL4
Button5.Location = BL5
Button6.Location = BL6
Button7.Location = BL7
AO1 = False
AO2 = False
AO3 = False
AO4 = False
AO5 = False
AO6 = False
AO7 = False
End Sub
现在,我们对放入声明的所有单词进行排序(Now we do the sorting of all the words that we put into our declared) ArrayLists
.这是数组的列表…(. This is the list of arrays…)
- 三字母词(threeLetterWords)
- 四个字母词(fourLetterWords)
- 五字母词(fiveLetterWords)
- 六字母词(sixLetterWords)
- 七个字母词(sevenLetterWords)
我们根据所有单词的长度对其进行排序.然后它们显示在(We sort all the words according to thier length. Then they are displayed in the)
ListBox
根据其长度按字母顺序排列.这是用很多方法完成的(in alphabetical order according to thier lengths. This is done with a lot of)For...Next Loops
Private Sub RedoList()
lstCorrectWords.Items.Clear()
Dim i As Integer
For i = 0 To PossibleWords.Count - 1
If PossibleWords(i).ToString.Length = 3 Then
threeLetterWords.Add(PossibleWords(i))
End If
Next i
threeLetterWords.Sort()
For i = 0 To PossibleWords.Count - 1
If PossibleWords(i).ToString.Length = 4 Then
fourLetterWords.Add(PossibleWords(i))
End If
Next i
fourLetterWords.Sort()
For i = 0 To PossibleWords.Count - 1
If PossibleWords(i).ToString.Length = 5 Then
fiveLetterWords.Add(PossibleWords(i))
End If
Next i
fiveLetterWords.Sort()
For i = 0 To PossibleWords.Count - 1
If PossibleWords(i).ToString.Length = 6 Then
sixLetterWords.Add(PossibleWords(i))
End If
Next i
sixLetterWords.Sort()
For i = 0 To PossibleWords.Count - 1
If PossibleWords(i).ToString.Length = 7 Then
sevenLetterWords.Add(PossibleWords(i))
End If
Next i
sevenLetterWords.Sort()
End Sub
Private Sub ShowWords()
Dim i As Integer
For i = 0 To threeLetterWords.Count - 1
lstCorrectWords.Items.Add(threeLetterWords(i))
Next
For i = 0 To fourLetterWords.Count - 1
lstCorrectWords.Items.Add(fourLetterWords(i))
Next
For i = 0 To fiveLetterWords.Count - 1
lstCorrectWords.Items.Add(fiveLetterWords(i))
Next
For i = 0 To sixLetterWords.Count - 1
lstCorrectWords.Items.Add(sixLetterWords(i))
Next
For i = 0 To sevenLetterWords.Count - 1
lstCorrectWords.Items.Add(sevenLetterWords(i))
Next
End Sub
下一个子项目(Twist)中所做的所有工作都是在更改字母周围,以使它们与以前不在同一按钮上.(All that is being done in the next sub (Twist) is changing the letters around so that they are not on the same button as before.)
Public Sub Twist()
Dim AlReadyPicked() As Integer
Dim PickedSeq() As Integer
Dim LetterCount As Integer
Dim i As Integer
Dim j As Integer
Dim rndNo As Integer
Dim Okay As Boolean
LetterCount = Difficulty + 4
ReDim AlReadyPicked(LetterCount)
ReDim PickedSeq(LetterCount)
For j = 0 To LetterCount - 1
PickedSeq(j) = 0
Next j
Randomize()
For i = 0 To LetterCount - 1
Do
rndNo = CInt(Int(LetterCount * Rnd()) + 1)
Okay = True
For j = 0 To LetterCount - 1
If rndNo = PickedSeq(j) Then
Okay = False
Exit For
End If
Next j
If Okay = True Then
PickedSeq(i) = rndNo
Exit Do
End If
Loop
Next i
Button1.Text = Mid(ChoosenWord, PickedSeq(0), 1)
Button2.Text = Mid(ChoosenWord, PickedSeq(1), 1)
Button3.Text = Mid(ChoosenWord, PickedSeq(2), 1)
Button4.Text = Mid(ChoosenWord, PickedSeq(3), 1)
Button5.Text = Mid(ChoosenWord, PickedSeq(4), 1)
If Difficulty = 2 Then
Button6.Text = Mid(ChoosenWord, PickedSeq(5), 1)
ElseIf Difficulty = 3 Then
Button6.Text = Mid(ChoosenWord, PickedSeq(5), 1)
Button7.Text = Mid(ChoosenWord, PickedSeq(6), 1)
End If
End Sub
结论(Conclusion)
尽管此游戏之前已完成,但您必须为此付费.现在你不.玩起来很有趣,有时却不是,因为您没有足够的时间来完成单词,然后按Enter键以获取最后一个单词.我打算延长时间,但是," aaaaa".那将不再有趣了.玩得开心.投票…我只是把这个放在网站上,供任何想拔头发的人使用.(Although this game has been done before, You had to pay for it. Now you dont. It is fun to play and then sometimes its not because you dont have enough time to finish your word and press Enter to get the last word. I was going to extend the time, but, “aaaaa”. That just would not be fun anymore. Have fun playing. Voting…I just put this on the site for anyone who wants to pull thier hair out.)
兴趣点(Points of Interest)
世界历史,第1部分.(History of the World, Part 1.)
- 第一次完成03.30.2012(First Completion 03.30.2012)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
VB10.0 .NET4 Dev 新闻 翻译