We have our main UI visuals ready and the starting game process with our settler and our first city. Now let's expand!
I decided to add some visuals for the game to look a bit better. Let's add a unit that will give an update on how your game is going on it's own or every couple of turns. I'll add the code and show you what I mean.
Add the following structure and GameTime variable (which will be our turn)
Public GameTime As Integer
Public Structure AdvisorStruct
Dim Height As Integer
Dim StrLen As Integer
Dim StrText As String
Dim StrTextL2 As String
Dim Frame As Integer
End Structure
Public GameAdvisor As AdvisorStruct
On Faction_F("END_TURN") I added the following code which checks some basic data and gives a text back based on them.
GameTime += 1
If GameTime Mod 2 = 0 Then 'Advisor will spawn once every two turns
I = 0
For Q = 0 To MaxCitiesPF
If Faction(0).City(Q).Enabled = 1 Then
I += 1
End If
Next
If I < 1 Then 'If there is no city
GameAdvisor.StrText = "We need to build a city, our people"
GameAdvisor.StrTextL2 = "are without a place to stay!"
Else
I = 0
For Q = 0 To MaxUnitsPF
If Faction(0).Unit(Q).ID > 0 Then
I += 1
End If
Next
If I < 5 Then
GameAdvisor.StrText = "We have no units to protect our"
GameAdvisor.StrTextL2 = "faction! Build more units!"
Else
I = 0
For Q = 0 To 10
I += Faction(0).STLibrary.Resource(Q)
Next
If I < 20 Then
GameAdvisor.StrText = "We don't have enough resources."
GameAdvisor.StrTextL2 = "It's time to expand our borders!"
Else
GameAdvisor.StrText = "We are doing well enough!"
GameAdvisor.StrTextL2 = "Let's keep this going!"
End If
End If
End If
I kept it simple, you can do it as complex as you want. This one is good for the first 20 turns or so, after that it will just repeat the last message.
On our UI render I add this clause for when no other window is open.
(It uses the length of our text as seen above to bring the advisor in the screen, take him off at the end and enough time for the player to read the message.)
ElseIf SUIWindow = 0 Then
'No window is open
If GameAdvisor.Frame < 68 Then
GameAdvisor.Frame += 1
Else
GameAdvisor.Frame = 0
End If
If GameAdvisor.StrLen > Len(GameAdvisor.StrText) * 3 Then
If GameAdvisor.Height > ScreenHeight - (32 * 2 + 5) * (ScreenHeight / UISizeH) Then
GameAdvisor.Height -= 1
End If
sRect = New Rectangle(525, 297, 275, 32)
dRect = New Rectangle((35 + 5) * (ScreenWidth / UISizeW) * 2, GameAdvisor.Height, sRect.Width * (ScreenWidth / UISizeW) * 2, sRect.Height * (ScreenHeight / UISizeH) * 2)
DrawTexturedQuad(sRect, dRect, 907, 548, 3, 1.0F, 1, 1, 1, 1)
DrawText(GameAdvisor.StrText, (35 + 10) * (ScreenWidth / UISizeW) * 2, GameAdvisor.Height + 15, 2, 1, 0.8, 0.8, 0.8, 1)
DrawText(GameAdvisor.StrTextL2, (35 + 10) * (ScreenWidth / UISizeW) * 2, GameAdvisor.Height + 55, 2, 1, 0.8, 0.8, 0.8, 1)
sRect = New Rectangle(280 + (GameAdvisor.Frame \ 10) * 35, 297, 35, 32)
dRect = New Rectangle((5) * (ScreenWidth / UISizeW) * 2, GameAdvisor.Height, sRect.Width * (ScreenWidth / UISizeW) * 2, sRect.Height * (ScreenHeight / UISizeH) * 2)
DrawTexturedQuad(sRect, dRect, 907, 548, 3, 1.0F, 1, 1, 1, 1)
GameAdvisor.StrLen -= 1
ElseIf GameAdvisor.StrLen > 0 Then
If GameAdvisor.Height <= ScreenHeight Then
GameAdvisor.Height += 1
End If
sRect = New Rectangle(525, 297, 275, 32)
dRect = New Rectangle((35 + 5) * (ScreenWidth / UISizeW) * 2, GameAdvisor.Height, sRect.Width * (ScreenWidth / UISizeW) * 2, sRect.Height * (ScreenHeight / UISizeH) * 2)
DrawTexturedQuad(sRect, dRect, 907, 548, 3, 1.0F, 1, 1, 1, 1)
DrawText(GameAdvisor.StrText, (35 + 10) * (ScreenWidth / UISizeW) * 2, GameAdvisor.Height + 15, 2, 1, 0.8, 0.8, 0.8, 1)
sRect = New Rectangle(280 + (GameAdvisor.Frame \ 10) * 35, 297, 35, 32)
dRect = New Rectangle((5) * (ScreenWidth / UISizeW) * 2, GameAdvisor.Height, sRect.Width * (ScreenWidth / UISizeW) * 2, sRect.Height * (ScreenHeight / UISizeH) * 2)
DrawTexturedQuad(sRect, dRect, 907, 548, 3, 1.0F, 1, 1, 1, 1)
GameAdvisor.StrLen -= 1
End If
Now we have an advisor popping on our screen. You could create more advisor sprites based on turn (gametime) and have your advisor change clothes through time. (Only thing to check is to keep the space under the advisor empty so you can implement more advisors just by changing the Y on source rectangle)
Let's add a button to close the faction-city management window, A bit mixed since this is the way I'm going through it
On GameButtons("CREATE")
SButton(5).Text = "Close faction window"
SButton(5).Enabled = 1
SButton(5).X = 290 : SButton(5).Y = 515
SButton(5).Width = 79 : SButton(5).Height = 15
SButton(5).UIState = 1
On GameButtons("CLICK")
ElseIf SButtonHover = 5 Then 'If the mouse is over close faction - city management windowIf SButton(5).UIState = SUIWindow Then
SUIWindow = 0
End If
On Rendering faction-city management window
DrawText(Faction(0).STLibrary.BasicA(1), 415 * (ScreenWidth / UISizeW), (350) * (ScreenHeight / UISizeH), 1.2, 1, 0.8, 0.8, 0.8, 1) 'Treasury
DrawText(Faction(0).STLibrary.BasicA(2), 415 * (ScreenWidth / UISizeW), (363) * (ScreenHeight / UISizeH), 1.2, 1, 0.8, 0.8, 0.8, 1) 'Income
DrawText(Faction(0).STLibrary.BasicA(3), 415 * (ScreenWidth / UISizeW), (376) * (ScreenHeight / UISizeH), 1.2, 1, 0.8, 0.8, 0.8, 1) 'Population
DrawText(Faction(0).STLibrary.BasicA(5), 415 * (ScreenWidth / UISizeW), (389) * (ScreenHeight / UISizeH), 1.2, 1, 0.8, 0.8, 0.8, 1) 'Technology
DrawText(Faction(0).STLibrary.BasicA(7), 415 * (ScreenWidth / UISizeW), (402) * (ScreenHeight / UISizeH), 1.2, 1, 0.8, 0.8, 0.8, 1) 'Construction
DrawText(Faction(0).STLibrary.BasicB(1), 334 * (ScreenWidth / UISizeW), 429 * (ScreenHeight / UISizeH), 1.2, 1, 0.8, 0.8, 0.8, 1) 'Education
DrawText(Faction(0).STLibrary.BasicB(2), 419 * (ScreenWidth / UISizeW), 429 * (ScreenHeight / UISizeH), 1.2, 1, 0.8, 0.8, 0.8, 1) 'Taxation
DrawText(Faction(0).STLibrary.BasicB(3), 504 * (ScreenWidth / UISizeW), 429 * (ScreenHeight / UISizeH), 1.2, 1, 0.8, 0.8, 0.8, 1) 'Luxuries
DrawText(Faction(0).STLibrary.BasicB(4), 589 * (ScreenWidth / UISizeW), 429 * (ScreenHeight / UISizeH), 1.2, 1, 0.8, 0.8, 0.8, 1) 'Unemployment
DrawText(Faction(0).STLibrary.BasicB(5), 334 * (ScreenWidth / UISizeW), 466 * (ScreenHeight / UISizeH), 1.2, 1, 0.8, 0.8, 0.8, 1) 'Civility
DrawText(Faction(0).STLibrary.BasicB(6), 419 * (ScreenWidth / UISizeW), 466 * (ScreenHeight / UISizeH), 1.2, 1, 0.8, 0.8, 0.8, 1) 'Militarism
DrawText(Faction(0).STLibrary.BasicB(7), 504 * (ScreenWidth / UISizeW), 466 * (ScreenHeight / UISizeH), 1.2, 1, 0.8, 0.8, 0.8, 1) 'Science
DrawText(Faction(0).STLibrary.PolicyPoints, 580 * (ScreenWidth / UISizeW), 466 * (ScreenHeight / UISizeH), 1.3, 1, 0.8, 0.8, 0.8, 1) 'Policy points
Now I'm going to create buttons for adding and removing policy points.
On GameButtons("CREATE")
For I = 6 To 9 'BasicB(1)
SButton(I).Text = "Policies Plus 1/2"
SButton(I).Enabled = 1
SButton(I).X = 354 + 85 * (I - 6) : SButton(I).Y = 420
SButton(I).Width = 7 : SButton(I).Height = 7
SButton(I).UIState = 1
SButton(I + 8).Text = "Policies Minus 1/2"
SButton(I + 8).Enabled = 1
SButton(I + 8).X = 331 + 85 * (I - 6) : SButton(I + 8).Y = 438
SButton(I + 8).Width = 7 : SButton(I + 8).Height = 7
SButton(I + 8).UIState = 1
SButton(I + 4).Text = "Policies Plus 2/2"
SButton(I + 4).Enabled = 1
SButton(I + 4).X = 354 + 85 * (I - 6) : SButton(I + 4).Y = 457
SButton(I + 4).Width = 7 : SButton(I + 4).Height = 7
SButton(I + 4).UIState = 1
SButton(I + 12).Text = "Policies Minus 2/2"
SButton(I + 12).Enabled = 1
SButton(I + 12).X = 331 + 85 * (I - 6) : SButton(I + 12).Y = 475
SButton(I + 12).Width = 7 : SButton(I + 12).Height = 7
SButton(I + 12).UIState = 1
Next
The above loop creates the following buttons in order for the player to assign or re-assign policy points.
On GameButtons("CLICK")
ElseIf sbuttonhover >= 6 And SButtonHover <= 13 Then 'Adding policy points to basicB
If Faction(0).STLibrary.PolicyPoints > 0 Then
Faction(0).STLibrary.BasicB(SButtonHover - 5) += 1
Faction(0).STLibrary.PolicyPoints -= 1
End If
ElseIf SButtonHover >= 14 And SButtonHover <= 21 Then 'Adding policy points to basicB
If Faction(0).STLibrary.BasicB(SButtonHover - 13) > 0 Then
Faction(0).STLibrary.BasicB(SButtonHover - 13) -= 1
Faction(0).STLibrary.PolicyPoints += 1
End If
We added the button references and the click button events, now we can assign the points with ease.
By now we should have almost all of our management values in place, and we need to create buttons to assign points, unit constructing and connect them with our research structure and window. It's a bit too much, but we'll try to mix it up all together at once, so for this matter I updated the UI.
We need to create structures to hold our unit and research availability which will be heavily dependent on each other.
But first let's create handles to open our new windows.
On GameButtons("CREATE")
SButton(22).Text = "Construct Menu"
SButton(22).Enabled = 1
SButton(22).X = 638 : SButton(22).Y = 430
SButton(22).Width = 177 : SButton(22).Height = 15
SButton(22).UIState = 1
On GameButtons("CLICK")
ElseIf SButtonHover = 22 Then 'If the mouse is over construct button
If SButton(22).UIState = SUIWindow Then
SUIWindowConstruct = 1
End If
End If
For I = 23 To 31 'Units
SButton(I).Text = "Units"
SButton(I).Enabled = 1
SButton(I).X = 15 + 29 * (I - 23) : SButton(I).Y = 354
SButton(I).Width = 25 : SButton(I).Height = 25
SButton(I).UIState = 1
SButton(I + 9).Text = "Units"
SButton(I + 9).Enabled = 1
SButton(I + 9).X = 15 + 29 * (I - 23) : SButton(I + 9).Y = 383
SButton(I + 9).Width = 25 : SButton(I + 9).Height = 25
SButton(I + 9).UIState = 1
If (I + 18) <= 44 Then
SButton(I + 18).Text = "Units"
SButton(I + 18).Enabled = 1
SButton(I + 18).X = 15 + 29 * (I - 23) : SButton(I + 18).Y = 412
SButton(I + 18).Width = 25 : SButton(I + 18).Height = 25
SButton(I + 18).UIState = 1
End If
Next
For I = 45 To 53 'Units
SButton(I).Text = "Buildings"
SButton(I).Enabled = 1
SButton(I).X = 15 + 29 * (I - 45) : SButton(I).Y = 441
SButton(I).Width = 25 : SButton(I).Height = 25
SButton(I).UIState = 1
If (I + 9) <= 58 Then
SButton(I + 9).Text = "Buildings"
SButton(I + 9).Enabled = 1
SButton(I + 9).X = 15 + 29 * (I - 45) : SButton(I + 9).Y = 470
SButton(I + 9).Width = 25 : SButton(I + 9).Height = 25
SButton(I + 9).UIState = 1
End If
Next
This will create our construct button and buttons for all units on the library, we will also create a variable to hold that window state.
Public SUIWindowConstruct As Integer 'Construct window state
On our UI render inside the following clause If SUIWindow = 1 Then add
If SUIWindowConstruct = 1 Then
'Construct window
sRect = New Rectangle(280, 329, 280, 214)
dRect = New Rectangle(5 * (ScreenWidth / UISizeW), (ScreenHeight - (sRect.Height + 5) * (ScreenHeight / UISizeH)), sRect.Width * (ScreenWidth / UISizeW), sRect.Height * (ScreenHeight / UISizeH))
DrawTexturedQuad(sRect, dRect, 907, 548, 3, 1.0F, 1, 1, 1, 1)
If SButtonHover >= 23 And SButtonHover <= 44 Then
DrawText(Lib_Construct_S(SButtonHover - 22).Name & " (" & Int(Lib_Construct_S(SButtonHover - 22).Turns - Lib_Construct_S(SButtonHover - 22).Turns * (Faction(0).STLibrary.BasicB(6) + Faction(0).STLibrary.BasicB(4)) / 100) & ")", 17 * (ScreenWidth / UISizeW), 507 * (ScreenHeight / UISizeH), 1.3, 1, 0.8, 0.8, 0.8, 1) 'Units Hovering over
ElseIf SButtonHover >= 45 And SButtonHover <= 58 Then
DrawText(Lib_Construct_S(SButtonHover - 22).Name & " (" & Int(Lib_Construct_S(SButtonHover - 22).Turns - Lib_Construct_S(SButtonHover - 22).Turns * (Faction(0).STLibrary.BasicB(7) + Faction(0).STLibrary.BasicB(4)) / 100) & ")", 17 * (ScreenWidth / UISizeW), 507 * (ScreenHeight / UISizeH), 1.3, 1, 0.8, 0.8, 0.8, 1) 'Buildings Hovering over
Else
DrawText("None", 21 * (ScreenWidth / UISizeW), 507 * (ScreenHeight / UISizeH), 1.3, 1, 0.8, 0.8, 0.8, 1) 'Construction Hovering over
End If
End If
Don't forget to add Game_Library_Construct("LOAD", 0, 0) when game loads. This new sub with the variable and structure declarations are the following.
Public Structure Library_Constructions_S
Dim Name As String
Dim UnlockID As Integer 'An index which when called will unlock the unit
Dim Unlocked As Integer 'Is the unit or structure unlocked
Dim Turns As Integer
End Structure
Public Lib_Construct_S(36) As Library_Constructions_S
Public LibraryConstructIndex As Integer
Public Sub Game_Library_Construct(ByVal Func As String, ByVal X As Integer, ByVal Y As Integer)
Dim I, Q As Integer
Dim IndexID As Integer
If Func = "LOAD" Then
For I = 0 To 36
Lib_Construct_S(0).Name = "None"
Lib_Construct_S(I).Turns = 0
Lib_Construct_S(0).UnlockID = 0
Lib_Construct_S(0).Unlocked = 0
Next
'Units
Lib_Construct_S(0).Name = "None" : Lib_Construct_S(1).Name = "Settler" : Lib_Construct_S(2).Name = "Worker"
Lib_Construct_S(3).Name = "Warriors" : Lib_Construct_S(4).Name = "Archers" : Lib_Construct_S(5).Name = "Pikemen"
Lib_Construct_S(6).Name = "Cavalry" : Lib_Construct_S(7).Name = "Catapult" : Lib_Construct_S(8).Name = "Longbowmen"
Lib_Construct_S(9).Name = "Knights" : Lib_Construct_S(10).Name = "Riflemen" : Lib_Construct_S(11).Name = "Cannon"
Lib_Construct_S(12).Name = "Infantry" : Lib_Construct_S(13).Name = "Parachuters" : Lib_Construct_S(14).Name = "Light Vehicle"
Lib_Construct_S(15).Name = "Marines" : Lib_Construct_S(16).Name = "AA Vehicle" : Lib_Construct_S(17).Name = "Tank"
Lib_Construct_S(18).Name = "Helicopter" : Lib_Construct_S(19).Name = "Airplane" : Lib_Construct_S(20).Name = "Fighter Jet"
Lib_Construct_S(21).Name = "Ship" : Lib_Construct_S(22).Name = "Warship"
Lib_Construct_S(0).Turns = 0 : Lib_Construct_S(1).Turns = 16 : Lib_Construct_S(2).Turns = 14
Lib_Construct_S(3).Turns = 8 : Lib_Construct_S(4).Turns = 7 : Lib_Construct_S(5).Turns = 16
Lib_Construct_S(6).Turns = 22 : Lib_Construct_S(7).Turns = 24 : Lib_Construct_S(8).Turns = 20
Lib_Construct_S(9).Turns = 26 : Lib_Construct_S(10).Turns = 26 : Lib_Construct_S(11).Turns = 22
Lib_Construct_S(12).Turns = 32 : Lib_Construct_S(13).Turns = 34 : Lib_Construct_S(14).Turns = 36
Lib_Construct_S(15).Turns = 38 : Lib_Construct_S(16).Turns = 42 : Lib_Construct_S(17).Turns = 52
Lib_Construct_S(18).Turns = 68 : Lib_Construct_S(19).Turns = 70 : Lib_Construct_S(20).Turns = 80
Lib_Construct_S(21).Turns = 38 : Lib_Construct_S(22).Turns = 80
'Buildings
Lib_Construct_S(23).Name = "Granary" : Lib_Construct_S(24).Name = "Temple" : Lib_Construct_S(25).Name = "Market"
Lib_Construct_S(23).Turns = 8 : Lib_Construct_S(24).Turns = 18 : Lib_Construct_S(25).Turns = 22
Lib_Construct_S(26).Name = "Barracks" : Lib_Construct_S(27).Name = "Watchtower" : Lib_Construct_S(28).Name = "Courthouse"
Lib_Construct_S(26).Turns = 18 : Lib_Construct_S(27).Turns = 22 : Lib_Construct_S(28).Turns = 24
Lib_Construct_S(29).Name = "Library" : Lib_Construct_S(30).Name = "Police station" : Lib_Construct_S(31).Name = "Factory"
Lib_Construct_S(29).Turns = 26 : Lib_Construct_S(30).Turns = 22 : Lib_Construct_S(31).Turns = 36
Lib_Construct_S(32).Name = "Apartments" : Lib_Construct_S(33).Name = "Transit" : Lib_Construct_S(34).Name = "University"
Lib_Construct_S(32).Turns = 20 : Lib_Construct_S(33).Turns = 30 : Lib_Construct_S(34).Turns = 28
Lib_Construct_S(35).Name = "Airport" : Lib_Construct_S(36).Name = "Power Plant"
Lib_Construct_S(35).Turns = 40 : Lib_Construct_S(36).Turns = 46
End If
End Sub
Now I'm going to leave them all available by default for now, so we can test our game's newly added data. Now let's go to implementing our research window.
On GameButtons("CREATE")
SButton(59).Text = "Research"
SButton(59).Enabled = 1
SButton(59).X = 900 : SButton(59).Y = 487
SButton(59).Width = 15 : SButton(59).Height = 15
On GameButtons("CLICK")
ElseIf SButtonHover = 59 Then 'If the mouse is over research button
SUIWindow = 2
And onward to creating our research buttons. (I'm going in small steps throughout the whole post since I'm adding them in this order on the code myself).
On GameButtons("CREATE")
'The following loop is for creating our research buttons
For I = 60 To 66
SButton(I).Text = "Research queue (1)"
SButton(I).Enabled = 1
SButton(I).X = 533 + 23 * (I - 60) : SButton(I).Y = 433
SButton(I).Width = 22 : SButton(I).Height = 22
SButton(I).UIState = 2
SButton(I + 7).Text = "Research queue (2)"
SButton(I + 7).Enabled = 1
SButton(I + 7).X = 533 + 23 * (I - 60) : SButton(I + 7).Y = 456
SButton(I + 7).Width = 22 : SButton(I + 7).Height = 22
SButton(I + 7).UIState = 2
SButton(I + 14).Text = "Research queue (3)"
SButton(I + 14).Enabled = 1
SButton(I + 14).X = 533 + 23 * (I - 60) : SButton(I + 14).Y = 479
SButton(I + 14).Width = 22 : SButton(I + 14).Height = 22
SButton(I + 14).UIState = 2
SButton(I + 21).Text = "Research queue (4)"
SButton(I + 21).Enabled = 1
SButton(I + 21).X = 533 + 23 * (I - 60) : SButton(I + 21).Y = 502
SButton(I + 21).Width = 22 : SButton(I + 21).Height = 22
SButton(I + 21).UIState = 2
Next
We need to create our research structure
Public Structure Library_Research_S
Dim Name As String
Dim ConstructionID1 As Integer 'An index to unlock constructions
Dim ConstructionID2 As Integer 'An index to unlock constructions
Dim ResearchID1 As Integer 'And index to unlock research
Dim ResearchID2 As Integer 'And index to unlock research
Dim Turns As Integer
Dim Researched As Integer
Dim Available As Integer
End Structure
Public Lib_Research_S(28) As Library_Research_S
And inside our sub that we created above
Public Sub Game_Library_Construct(ByVal Func As String, ByVal X As Integer, ByVal Y As Integer)
we'll add (after the code for creating our construct library) the following for research
'Research
Lib_Research_S(0).Name = "None" : Lib_Research_S(0).Turns = 0
Lib_Research_S(1).Name = "Farming" : Lib_Research_S(1).Turns = 3
Lib_Research_S(2).Name = "Husbandry" : Lib_Research_S(2).Turns = 5
Lib_Research_S(3).Name = "Horseback riding" : Lib_Research_S(3).Turns = 8
Lib_Research_S(4).Name = "The Wheel" : Lib_Research_S(4).Turns = 12
Lib_Research_S(5).Name = "Sailing" : Lib_Research_S(5).Turns = 20
Lib_Research_S(6).Name = "Gunpowder" : Lib_Research_S(6).Turns = 32
Lib_Research_S(7).Name = "Computers" : Lib_Research_S(7).Turns = 64
Lib_Research_S(8).Name = "Simple tools" : Lib_Research_S(8).Turns = 4
Lib_Research_S(9).Name = "Clay working" : Lib_Research_S(9).Turns = 9
Lib_Research_S(10).Name = "Masonry" : Lib_Research_S(10).Turns = 16
Lib_Research_S(11).Name = "Bronze working" : Lib_Research_S(11).Turns = 20
Lib_Research_S(12).Name = "Iron working" : Lib_Research_S(12).Turns = 28
Lib_Research_S(13).Name = "Construction" : Lib_Research_S(13).Turns = 32
Lib_Research_S(14).Name = "Rocketry" : Lib_Research_S(14).Turns = 68
Lib_Research_S(15).Name = "Alphabet" : Lib_Research_S(15).Turns = 9
Lib_Research_S(16).Name = "Writing" : Lib_Research_S(16).Turns = 14
Lib_Research_S(17).Name = "Mathematics" : Lib_Research_S(17).Turns = 19
Lib_Research_S(18).Name = "Cartography" : Lib_Research_S(18).Turns = 20
Lib_Research_S(19).Name = "Physics" : Lib_Research_S(19).Turns = 22
Lib_Research_S(20).Name = "Chemistry" : Lib_Research_S(20).Turns = 34
Lib_Research_S(21).Name = "Advanced physics" : Lib_Research_S(21).Turns = 58
Lib_Research_S(22).Name = "Trading" : Lib_Research_S(22).Turns = 12
Lib_Research_S(23).Name = "Religion" : Lib_Research_S(23).Turns = 16
Lib_Research_S(24).Name = "Laws" : Lib_Research_S(24).Turns = 20
Lib_Research_S(25).Name = "Monarchy" : Lib_Research_S(25).Turns = 24
Lib_Research_S(26).Name = "Feudalism" : Lib_Research_S(26).Turns = 38
Lib_Research_S(27).Name = "Democracy" : Lib_Research_S(27).Turns = 46
Lib_Research_S(28).Name = "Technocracy" : Lib_Research_S(28).Turns = 50
And now on our rendering for SUIWindow = 2, on the following clause If SUIWindow = 1 Then add another elseif for SUIWindow = 2 as follows
ElseIf SUIWindow = 2 Then 'RESEARCH MANAGEMENT
'Research window
sRect = New Rectangle(560, 329, 297, 132)
dRect = New Rectangle(ScreenWidth - 140 * (ScreenWidth / UISizeW) - sRect.Width * (ScreenWidth / UISizeW), (ScreenHeight - (sRect.Height + 5) * (ScreenHeight / UISizeH)), sRect.Width * (ScreenWidth / UISizeW), sRect.Height * (ScreenHeight / UISizeH))
DrawTexturedQuad(sRect, dRect, 907, 548, 3, 1.0F, 1, 1, 1, 1)
If SButtonHover >= 60 And SButtonHover <= 87 Then
If Lib_Research_S(SButtonHover - 59).Name.Contains(" ") Then
DrawText(Split(Lib_Research_S(SButtonHover - 59).Name, " ")(0), 697 * (ScreenWidth / UISizeW), 436 * (ScreenHeight / UISizeH), 1.1, 1, 0.8, 0.8, 0.8, 1)
DrawText(Split(Lib_Research_S(SButtonHover - 59).Name, " ")(1), 697 * (ScreenWidth / UISizeW), 446 * (ScreenHeight / UISizeH), 1.1, 1, 0.8, 0.8, 0.8, 1)
DrawText(Int(Lib_Construct_S(SButtonHover - 59).Turns - Lib_Construct_S(SButtonHover - 59).Turns * (Faction(0).STLibrary.BasicB(1) + Faction(0).STLibrary.BasicB(4) + Faction(0).STLibrary.BasicB(7)) / 100), 783 * (ScreenWidth / UISizeW), 436 * (ScreenHeight / UISizeH), 1.3, 1, 0.8, 0.8, 0.8, 1)
Else
DrawText(Lib_Research_S(SButtonHover - 59).Name, 697 * (ScreenWidth / UISizeW), 436 * (ScreenHeight / UISizeH), 1.1, 1, 0.8, 0.8, 0.8, 1)
DrawText(Int(Lib_Construct_S(SButtonHover - 59).Turns - Lib_Construct_S(SButtonHover - 59).Turns * (Faction(0).STLibrary.BasicB(1) + Faction(0).STLibrary.BasicB(4) + Faction(0).STLibrary.BasicB(7)) / 100), 783 * (ScreenWidth / UISizeW), 436 * (ScreenHeight / UISizeH), 1.3, 1, 0.8, 0.8, 0.8, 1)
End If
Else
DrawText("None", 697* (ScreenWidth / UISizeW), 436* (ScreenHeight / UISizeH), 1.3, 1, 0.8, 0.8, 0.8, 1) 'Construction Hovering over
End If
End If
Our research window is also ready! Next post we'll create our library interactions!
Comments
Post a Comment