All language subtitles for 63. Creating an Options Menu

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian Download
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,256 --> 00:00:03,072 It is time to start on our options menu 2 00:00:03,328 --> 00:00:07,168 So let's go ahead and do it I'm going to be a little bit lazy here 3 00:00:07,424 --> 00:00:12,032 And I am going to simply duplicate the main menu to use as our starting point 4 00:00:12,288 --> 00:00:13,824 For the options menu 5 00:00:14,080 --> 00:00:17,408 So I'm going to go ahead and with my main menu open here 6 00:00:17,664 --> 00:00:23,296 I'm going to go to seems you I and I'm going to duplicate this main menu so 7 00:00:23,808 --> 00:00:25,344 Right click on menu duplicate 8 00:00:25,600 --> 00:00:26,624 Am I gonna call it 9 00:00:27,136 --> 00:00:27,904 Options menu 10 00:00:29,952 --> 00:00:35,072 Anchor Hanover that options menu seem now the first thing we're going to do is Wigan to remove this script 11 00:00:35,584 --> 00:00:39,680 So if you select the main menu here actually literally name is two options money before we start 12 00:00:39,936 --> 00:00:42,752 So make sure that you were on the options menu 13 00:00:43,264 --> 00:00:43,776 Scene 14 00:00:44,032 --> 00:00:46,336 And rename the route options menu and then 15 00:00:46,592 --> 00:00:49,664 Quickly detach script button to remove the sky 16 00:00:52,224 --> 00:00:57,344 So now this label here what we're gonna do is we're going to call this options instead 17 00:00:59,392 --> 00:01:00,141 Just like cell 18 00:01:00,143 --> 00:01:02,491 Subtitled by online-courses.club We compress knowledge for you! 19 00:01:02,492 --> 00:01:05,280 And we pretty much don't need any of these buttons here so I'm going to delete two of the buttons 20 00:01:06,304 --> 00:01:08,864 And I'm going to rename the quick button to the back button 21 00:01:10,144 --> 00:01:12,448 And I'm going to change the text to back 22 00:01:13,728 --> 00:01:15,776 This is a rough start here 23 00:01:16,800 --> 00:01:18,336 Now what happens do we want 24 00:01:18,592 --> 00:01:20,384 We're going to do 3 we're going to have 25 00:01:21,408 --> 00:01:23,200 Fullscreen windowed mode option 26 00:01:23,712 --> 00:01:28,064 And we're going to have sliders for the music and SFX 27 00:01:28,320 --> 00:01:29,088 Volumes 28 00:01:29,344 --> 00:01:34,720 What I'm going to do here is I'm going to add another vbox container under this vbox container here 29 00:01:34,976 --> 00:01:38,304 I'm going to put that in the mill between the label and the back button 30 00:01:38,816 --> 00:01:43,168 Select the router box container for the parent of the box container agency 31 00:01:43,680 --> 00:01:45,472 And scroll down to the 32 00:01:45,728 --> 00:01:47,776 Override constant section 33 00:01:48,288 --> 00:01:50,592 Change the separation of something like 16 34 00:01:52,128 --> 00:01:57,248 Ok so in this be box container here That's my girl first option the SFX value 35 00:01:57,504 --> 00:02:00,832 And we're going to use another box container for this 36 00:02:01,088 --> 00:02:04,672 So we're nesting about of you box containers for layout purposes 37 00:02:04,928 --> 00:02:09,792 And if you want to make a little bit clear we can call this 38 00:02:10,048 --> 00:02:13,376 The SFX option container 39 00:02:13,888 --> 00:02:14,656 Like so 40 00:02:14,912 --> 00:02:17,984 Anna let's add a child under their let's say labour 41 00:02:18,240 --> 00:02:21,056 And then we'll give a little the text of 42 00:02:21,568 --> 00:02:22,848 SFX volume 43 00:02:23,360 --> 00:02:24,128 Like so 44 00:02:24,384 --> 00:02:27,968 Let's add underneath the boxing trainer again a 45 00:02:28,224 --> 00:02:29,504 8 slider 46 00:02:31,040 --> 00:02:35,904 Ok so that's rs-x volume listen duplicate the SFX volume container here 47 00:02:36,160 --> 00:02:37,440 By hitting ctrl-d 48 00:02:37,952 --> 00:02:40,512 And when I call this the music option container 49 00:02:43,328 --> 00:02:44,096 Just like so 50 00:02:44,352 --> 00:02:49,472 And before I go to further I'm going to change the minimum size of the disk 51 00:02:49,728 --> 00:02:51,008 Vbox container here 52 00:02:51,264 --> 00:02:53,824 So this device container under the margin container 53 00:02:54,080 --> 00:02:56,128 I'm gonna go to the custom minimum size 54 00:02:56,640 --> 00:03:00,992 Which is at the top and I'm going to give it a minimum x size of 55 00:03:01,248 --> 00:03:02,016 200 56 00:03:02,272 --> 00:03:06,368 Just because that gives us a little bit more room it looks a little bit nicer 57 00:03:06,624 --> 00:03:08,160 And it's back button here 58 00:03:08,416 --> 00:03:09,952 I'm going to select 59 00:03:10,208 --> 00:03:10,720 And 60 00:03:10,976 --> 00:03:12,000 Scroll down 61 00:03:12,256 --> 00:03:16,352 Ennis container sizing I'm going to change the horizontal to shrink begin 62 00:03:17,120 --> 00:03:20,448 And I think that looks great so that will be a back button 63 00:03:20,704 --> 00:03:25,056 And then I'm just going to give the back button also it cost a minimum size here 64 00:03:25,312 --> 00:03:26,080 Which is 65 00:03:26,336 --> 00:03:27,360 A little bit down 66 00:03:27,616 --> 00:03:28,640 Toward the control 67 00:03:28,896 --> 00:03:29,408 Heading 68 00:03:29,664 --> 00:03:33,760 And I'm going to give it a minimum size of 50 just looks a little 69 00:03:35,040 --> 00:03:38,880 Ok and for this vbox container underneath the margin container 70 00:03:39,136 --> 00:03:45,280 I'm going to slightly increase The Separation so scroll all the way down or nearly all the way down here to the theme of 71 00:03:45,536 --> 00:03:46,048 Constance 72 00:03:46,560 --> 00:03:48,352 And change this to 73 00:03:48,864 --> 00:03:49,632 24 74 00:03:49,888 --> 00:03:50,656 Instead 75 00:03:51,680 --> 00:03:57,824 Ok and then for the options label I'm going to change this text to have a Centre 76 00:03:58,080 --> 00:03:58,848 Horizontal alignment 77 00:03:59,872 --> 00:04:03,712 Alright so we're in good shape now and then there's one more option we want to add 78 00:04:04,224 --> 00:04:05,504 Which is the 79 00:04:05,760 --> 00:04:09,344 Window so I'm going to duplicate the music often container 80 00:04:09,856 --> 00:04:10,880 Where's control d 81 00:04:11,136 --> 00:04:13,696 I want to change the label here to 82 00:04:13,952 --> 00:04:14,720 Window mode 83 00:04:15,232 --> 00:04:16,000 And 84 00:04:17,024 --> 00:04:19,327 I'm going to rename this container to window 85 00:04:19,583 --> 00:04:21,119 Mode container 86 00:04:22,143 --> 00:04:24,191 Window option container 87 00:04:25,983 --> 00:04:27,519 So I can't window option container 88 00:04:27,775 --> 00:04:29,311 Instead of a slider here 89 00:04:30,079 --> 00:04:31,359 Let's instance 90 00:04:31,615 --> 00:04:34,431 Instantiate a child scene of Sound button 91 00:04:36,991 --> 00:04:39,807 We are going to change this sound button here 92 00:04:40,063 --> 00:04:43,391 Scroll all the way down on a change the container size in to shrink begin 93 00:04:43,903 --> 00:04:47,743 And then let's give it a custom minimum size as well 94 00:04:48,511 --> 00:04:53,119 So scroll to the customer satisfaction give it a minimum size me x of 100 95 00:04:53,375 --> 00:04:54,911 And that looks a little bit nicer 96 00:04:56,191 --> 00:04:59,775 Right now for this meal box container that contains all of the 97 00:05:00,031 --> 00:05:01,311 Child options 98 00:05:01,823 --> 00:05:07,455 Let's increase the container spacing for The Separation too 99 00:05:07,711 --> 00:05:08,223 8 100 00:05:09,247 --> 00:05:10,527 Sorry can you something like 12 101 00:05:11,807 --> 00:05:17,695 So again that's the box container that wraps all the options would change the constant separation to 12 year 102 00:05:19,231 --> 00:05:25,375 Alright so now you got an options menu that is looking pretty decent now you doing to make sure that you're not making it so big 103 00:05:25,631 --> 00:05:27,423 It leaves the screen 104 00:05:27,679 --> 00:05:28,191 An 105 00:05:28,447 --> 00:05:30,495 The screen region is sort of 106 00:05:30,751 --> 00:05:36,639 Denoted by the very faint blue line I don't know if you can see that but that's the blue line that represents the screen size 107 00:05:36,895 --> 00:05:40,223 And so long as your options menu is staying with Anna bound 108 00:05:40,479 --> 00:05:43,807 You're a good girl and you can also Verified by running the scene 109 00:05:44,063 --> 00:05:46,367 With F6 or by clicking this button 110 00:05:46,623 --> 00:05:47,647 And there we go 111 00:05:48,671 --> 00:05:51,743 So you noticed that the sliders aren't doing anything 112 00:05:52,255 --> 00:05:54,303 And they don't look that great either 113 00:05:54,559 --> 00:05:56,351 We'll tackle the theming 114 00:05:56,607 --> 00:05:57,887 In the next lesson 115 00:05:58,399 --> 00:06:00,959 But for now let's get the sliders to work 116 00:06:01,215 --> 00:06:04,031 Let's create a script for the options menu here 117 00:06:05,055 --> 00:06:05,823 And click create 118 00:06:06,079 --> 00:06:08,895 And let's do the following 119 00:06:09,663 --> 00:06:12,223 Let's expand our sfxr container 120 00:06:12,735 --> 00:06:15,295 Unless rename this to SFX lighter 121 00:06:16,575 --> 00:06:17,087 Like so 122 00:06:17,343 --> 00:06:18,111 Wycliffe 123 00:06:18,367 --> 00:06:19,903 Access as unique name 124 00:06:20,671 --> 00:06:25,535 Kate let's do the same for the age slider under the music auction container and called the music slider 125 00:06:25,791 --> 00:06:27,327 Market as unique name 126 00:06:27,839 --> 00:06:32,447 And then this sound button under the window are container going to call this a window button 127 00:06:35,007 --> 00:06:37,311 And right-click and access as unique name 128 00:06:37,567 --> 00:06:41,151 Alright so let's override a ready method in HR 129 00:06:41,663 --> 00:06:42,687 Options menu 130 00:06:42,943 --> 00:06:45,503 Anniversary that we're going to do is let's do the window mode 131 00:06:45,759 --> 00:06:46,783 So we're going to say 132 00:06:48,063 --> 00:06:49,599 Dollar sign 133 00:06:50,623 --> 00:06:51,391 Window button 134 00:06:52,159 --> 00:06:52,927 Depressed 135 00:06:53,183 --> 00:06:53,951 Connect 136 00:06:54,463 --> 00:06:55,743 On window 137 00:06:55,999 --> 00:06:56,511 Button 138 00:06:56,767 --> 00:06:57,279 Pressed 139 00:07:00,095 --> 00:07:02,655 Caitlin's creative function on window button 140 00:07:03,167 --> 00:07:03,679 Pressed 141 00:07:05,727 --> 00:07:07,775 And then here we want to set the 142 00:07:08,287 --> 00:07:12,383 Window mode so we're going to reference that display server 143 00:07:12,639 --> 00:07:16,223 And we're going to get the current modes are there save our Motors equal to 144 00:07:17,247 --> 00:07:18,527 Display server 145 00:07:19,551 --> 00:07:20,831 Window 146 00:07:21,087 --> 00:07:24,927 Get mode and that will give us the mode that the windows in 147 00:07:25,183 --> 00:07:31,327 What's we have the mode we can check it so we can say if mode is not equal to display server data 148 00:07:31,583 --> 00:07:32,863 Mode 149 00:07:33,119 --> 00:07:33,887 Full stream 150 00:07:34,399 --> 00:07:35,679 Then we're going to say 151 00:07:36,447 --> 00:07:37,727 Display server 152 00:07:39,007 --> 00:07:40,799 Window 153 00:07:41,055 --> 00:07:41,823 Mode 154 00:07:42,591 --> 00:07:44,127 To display server down 155 00:07:46,175 --> 00:07:47,967 Window mode fullscreen 156 00:07:48,479 --> 00:07:50,527 And these are constants all capitalised 157 00:07:51,039 --> 00:07:53,343 Sofa and fullscreen mode in a set it to full screen 158 00:07:53,599 --> 00:07:54,367 Else 159 00:07:54,879 --> 00:07:56,415 What is a display server 160 00:07:56,671 --> 00:07:57,695 Dad window 161 00:07:57,951 --> 00:07:58,975 Set mode 162 00:07:59,487 --> 00:08:01,023 To display server 163 00:08:01,279 --> 00:08:01,791 Start 164 00:08:02,559 --> 00:08:03,327 Window 165 00:08:03,583 --> 00:08:04,095 Mode 166 00:08:04,863 --> 00:08:05,375 Windows 167 00:08:06,655 --> 00:08:12,287 The saying if you're not in fullscreen mode set it to full screen mode otherwise set it to windowed mode 168 00:08:13,311 --> 00:08:16,383 Let's create a new function called update display 169 00:08:17,919 --> 00:08:22,783 And here we're going to need to update all over UI to display the current options 170 00:08:23,807 --> 00:08:25,343 So the window button 171 00:08:25,599 --> 00:08:27,391 We want to set the window button text 172 00:08:27,903 --> 00:08:28,927 I'm going to say 173 00:08:29,439 --> 00:08:34,047 9% and we're actually probably need a reference this in multiple places 174 00:08:34,303 --> 00:08:36,863 So I'm going to do an already very well at the top 175 00:08:37,119 --> 00:08:38,911 Add on ready bar 176 00:08:39,423 --> 00:08:40,447 Window button 177 00:08:40,703 --> 00:08:41,471 Is equal to 178 00:08:41,727 --> 00:08:43,775 Star sign percent window button 179 00:08:45,567 --> 00:08:47,103 Ok and we can catch this 180 00:08:47,615 --> 00:08:49,407 Or type this letter as a button 181 00:08:49,919 --> 00:08:52,735 So that we get the completion suggestions in our editor 182 00:08:52,991 --> 00:08:56,319 I'm going to say window button depressed in the ready method 183 00:08:56,831 --> 00:08:59,391 Anna in display window button 184 00:09:01,183 --> 00:09:03,999 Text or said that equal to Windows 185 00:09:04,511 --> 00:09:07,839 But we have to check the mode so I'm going to say 186 00:09:08,095 --> 00:09:09,119 I'm going to copy this 187 00:09:09,375 --> 00:09:11,679 Display server window get mode is equal to 188 00:09:12,191 --> 00:09:13,471 Display server 189 00:09:13,727 --> 00:09:14,751 Window mode 190 00:09:15,775 --> 00:09:16,799 Full screen 191 00:09:17,311 --> 00:09:21,151 Then we're going to say window button that text is equal to 192 00:09:21,919 --> 00:09:22,943 Full screen 193 00:09:23,967 --> 00:09:24,479 Ok 194 00:09:24,735 --> 00:09:27,807 Then the rain method were going to call that update display 195 00:09:28,319 --> 00:09:30,367 So that it uses the most up-to-date 196 00:09:30,879 --> 00:09:32,159 Window configuration 197 00:09:32,415 --> 00:09:36,255 And then on window button pressed we need to also call update display 198 00:09:37,279 --> 00:09:42,655 So update display is going to be our function that we call whenever a setting changes or whenever the 199 00:09:42,911 --> 00:09:48,799 Options menu is initially loaded going to be particularly important when we change the slider value as well 200 00:09:49,823 --> 00:09:51,359 So now we're going to make the sliders work 201 00:09:51,615 --> 00:09:55,455 So if you select both the SFX and the music sliders with 202 00:09:55,711 --> 00:09:56,735 Holding control 203 00:09:56,991 --> 00:09:57,759 You can 204 00:09:58,527 --> 00:10:01,740 Scroll down to the range here and we're going to set the main value in the max value 20-in one 205 00:10:01,741 --> 00:10:03,912 Subtitled by online-courses.club We compress knowledge for you! 206 00:10:03,913 --> 00:10:06,463 We're going to set the step 2.01 207 00:10:06,719 --> 00:10:10,815 And again we're doing this so that the slider now represent 8% 208 00:10:11,071 --> 00:10:13,631 And the present value is going to represent 209 00:10:13,887 --> 00:10:16,191 A volume between silent and 210 00:10:16,447 --> 00:10:17,215 Full volume 211 00:10:17,471 --> 00:10:20,799 Ok so the next thing we need to do is less create function 212 00:10:21,567 --> 00:10:22,847 Cold get 213 00:10:23,359 --> 00:10:24,127 Bus 214 00:10:24,383 --> 00:10:26,687 Volume percent so 215 00:10:27,199 --> 00:10:28,735 What's Right pass on here for now 216 00:10:28,991 --> 00:10:35,135 What we needed do essentially as we need to get the current volume percentage of the buses that yes 217 00:10:35,391 --> 00:10:37,695 So these buses right here 218 00:10:38,207 --> 00:10:41,791 And we need to convert that volume into a display value 219 00:10:42,047 --> 00:10:42,815 4 220 00:10:43,071 --> 00:10:44,351 The sliders 221 00:10:44,607 --> 00:10:50,239 And then in the reverse way we need to convert the percent of the sliders to the boss of volume 222 00:10:50,495 --> 00:10:52,799 And there is this handy function 223 00:10:54,079 --> 00:10:55,871 Called DB to Linear 224 00:10:56,127 --> 00:11:01,759 And this is going to allow us to convert a dB value like from our bus to a percent 225 00:11:02,015 --> 00:11:02,783 Which is perfect 226 00:11:03,039 --> 00:11:05,343 And then is also a linear 227 00:11:06,111 --> 00:11:08,927 2 DB which we can use the go the other way 228 00:11:09,183 --> 00:11:11,231 And the reason we need to do this is because 229 00:11:11,487 --> 00:11:14,303 Volume isn't linear as no 2 in the docks 230 00:11:14,559 --> 00:11:16,095 Go back 2 hour 231 00:11:16,607 --> 00:11:17,887 Options menu script 232 00:11:18,143 --> 00:11:23,775 So we want to get bus volume percent the way that we get a bus as we can say 233 00:11:24,031 --> 00:11:24,799 Audio 234 00:11:25,311 --> 00:11:26,335 Server 235 00:11:26,591 --> 00:11:27,103 Get 236 00:11:27,359 --> 00:11:28,127 Bus 237 00:11:28,383 --> 00:11:29,151 Index 238 00:11:29,663 --> 00:11:31,455 I'm going to pass on the bus name 239 00:11:31,967 --> 00:11:36,575 So let's assign the bus index to the result of this call 240 00:11:37,087 --> 00:11:40,159 What is a bus name when we're going to have to pass in a bus name 241 00:11:40,415 --> 00:11:42,719 As part of its functions parameters 242 00:11:43,231 --> 00:11:45,791 Also bus name in data type of string 243 00:11:46,047 --> 00:11:47,071 Like so 244 00:11:47,583 --> 00:11:49,375 I don't know person that bus name 245 00:11:49,631 --> 00:11:51,679 Into the bus index 246 00:11:53,471 --> 00:11:53,983 Alright 247 00:11:54,239 --> 00:11:56,031 So now let's get the bus volume 248 00:11:56,543 --> 00:11:57,567 Audio server 249 00:11:58,079 --> 00:11:59,103 Get 250 00:11:59,359 --> 00:12:00,127 Boss 251 00:12:00,383 --> 00:12:01,919 Volume DB 252 00:12:02,175 --> 00:12:05,247 And like this takes a bus index so we say bus index 253 00:12:05,759 --> 00:12:06,783 And water sign 254 00:12:07,039 --> 00:12:08,575 Volume DB 255 00:12:09,855 --> 00:12:11,135 Equal to 256 00:12:11,391 --> 00:12:13,439 Audio server get boss volume DB 257 00:12:14,463 --> 00:12:17,279 And now we can return at this function 258 00:12:18,559 --> 00:12:20,863 DB to Linear 259 00:12:21,631 --> 00:12:22,399 Volume 260 00:12:23,935 --> 00:12:24,447 Ok 261 00:12:24,703 --> 00:12:25,727 So now 262 00:12:25,983 --> 00:12:28,031 We can in our update display 263 00:12:28,287 --> 00:12:32,639 Let's get a reference to the SFX lighter and the music louder 264 00:12:33,151 --> 00:12:35,455 And I'm going to do this by selecting both of these 265 00:12:35,711 --> 00:12:39,295 Dragging them over into the editor here and holding control 266 00:12:39,807 --> 00:12:41,087 And that would generate 267 00:12:41,343 --> 00:12:42,367 On ready 268 00:12:42,879 --> 00:12:45,695 Methods for the SFX lighter and the music player for us 269 00:12:46,463 --> 00:12:50,303 So then the update display Matt I'm going to say as FX later 270 00:12:50,559 --> 00:12:51,583 Dark value 271 00:12:53,887 --> 00:12:54,911 Is equal to 272 00:12:55,167 --> 00:12:57,215 Jetbus volume 4% 273 00:12:57,471 --> 00:13:01,567 Never going to put in the name of our bus which is in quilt as a fax 274 00:13:02,079 --> 00:13:05,919 And we can do the same for music letter some musics lighter that value 275 00:13:06,175 --> 00:13:07,199 Is he go to 276 00:13:07,711 --> 00:13:08,991 Bus 5% 277 00:13:09,503 --> 00:13:10,527 In quotes music 278 00:13:12,319 --> 00:13:13,087 So now 279 00:13:13,343 --> 00:13:14,623 We should have 280 00:13:14,879 --> 00:13:16,927 Every time that we can't update display 281 00:13:17,439 --> 00:13:20,255 The sliders are going to be set to the current 282 00:13:20,767 --> 00:13:26,399 Volume percent of each bus so now let's go ahead and run this seen just this seem here 283 00:13:26,911 --> 00:13:30,751 And your sliders should be at max value here 284 00:13:31,263 --> 00:13:34,847 Which is not with their set to buy the fox that means that our code is working 285 00:13:35,103 --> 00:13:38,943 For now I need to listen for the bus volumes changing 286 00:13:39,455 --> 00:13:42,527 So if we go to rfx later and click on the Node 287 00:13:42,783 --> 00:13:43,551 Time here 288 00:13:44,063 --> 00:13:45,599 We can see that there is 289 00:13:45,855 --> 00:13:48,671 I changed signal underneath the Range here 290 00:13:48,927 --> 00:13:49,439 And so 291 00:13:49,695 --> 00:13:54,303 We can listen for The Slider being changed in a plight that changed to 292 00:13:54,559 --> 00:13:55,327 The 293 00:13:56,095 --> 00:13:56,863 Boss volume 294 00:13:57,631 --> 00:13:58,143 So 295 00:13:58,911 --> 00:14:05,055 Let's go below the window button pressed connection here and we're going to say 296 00:14:05,311 --> 00:14:05,823 Slide 297 00:14:06,079 --> 00:14:08,127 Change dartconnect 298 00:14:08,639 --> 00:14:10,175 Are we going to do on 299 00:14:11,455 --> 00:14:12,735 Let's say audio 300 00:14:13,759 --> 00:14:17,599 Slider changed in Urdu something different working to.do.by 301 00:14:17,855 --> 00:14:19,135 I'm going to bind 302 00:14:19,903 --> 00:14:23,999 SFX and when I'm just going to bind SX4 also going to buy 303 00:14:24,511 --> 00:14:25,023 The slide 304 00:14:26,815 --> 00:14:30,911 Ok now what is this do well first let's define this function so 305 00:14:31,679 --> 00:14:32,191 Down here 306 00:14:32,447 --> 00:14:35,007 Funk on audio slider change 307 00:14:35,519 --> 00:14:37,567 And then let's just right passing here 308 00:14:38,079 --> 00:14:39,871 So we did bind once before 309 00:14:41,151 --> 00:14:41,663 Find 310 00:14:41,919 --> 00:14:42,943 Essentially says 311 00:14:43,455 --> 00:14:45,759 In addition to whatever our humans 312 00:14:46,015 --> 00:14:48,319 The changed signal sounds 313 00:14:48,575 --> 00:14:50,623 Also send these arguments 314 00:14:50,879 --> 00:14:51,391 Right 315 00:14:51,647 --> 00:14:54,975 Now in our case the changed signal does not send any arguments 316 00:14:55,999 --> 00:15:00,351 But were saying send these two arguments in addition and why are we doing 317 00:15:00,863 --> 00:15:01,887 Because 318 00:15:02,911 --> 00:15:04,191 We're going to use this 319 00:15:04,447 --> 00:15:08,287 Function handler for both the SFX and the music slider 320 00:15:08,543 --> 00:15:14,175 And his arguments are going to be used to determine which bus we need to change in which slider we need to change 321 00:15:14,687 --> 00:15:18,271 Or rather which slider we need to pull the value from 322 00:15:19,039 --> 00:15:20,319 So let's go down here 323 00:15:20,575 --> 00:15:22,879 And I'm going to say slider 324 00:15:23,135 --> 00:15:24,671 Which is of type h 325 00:15:25,951 --> 00:15:26,463 Slider 326 00:15:26,975 --> 00:15:29,791 And then our second argument is going to be boss name 327 00:15:30,303 --> 00:15:31,583 Which is going to be of type 328 00:15:31,839 --> 00:15:32,351 String 329 00:15:32,607 --> 00:15:38,751 Now what Are We Gonna Do with that as well let's first write a method called a set volume percent so I'm 330 00:15:39,007 --> 00:15:41,567 Send a copy and paste this get bus volume 4% 331 00:15:42,335 --> 00:15:45,151 I'm going to call this set but the volume percent 332 00:15:45,663 --> 00:15:51,551 And we are going to instead of just returning DB to Linear hear what we're going to do instead 333 00:15:51,807 --> 00:15:53,087 Is we are going to 334 00:15:53,343 --> 00:15:57,951 Has in a percent so let's pass in a present here which is uptight flow 335 00:15:58,719 --> 00:15:59,999 Anna let's do 336 00:16:00,255 --> 00:16:01,791 Volume DB 337 00:16:03,583 --> 00:16:04,863 Is equal to 338 00:16:05,119 --> 00:16:07,935 And we're going to do linear to DB percent 339 00:16:10,239 --> 00:16:12,543 Now instead of this assignment here 340 00:16:13,055 --> 00:16:19,199 We're going to get rid of that and keep the audio server get boss by MTV accept change the to set bus 341 00:16:19,455 --> 00:16:20,479 Volume TV 342 00:16:20,735 --> 00:16:21,759 And this 343 00:16:22,015 --> 00:16:22,783 Method 344 00:16:23,807 --> 00:16:26,623 Takes in the bus index as well as the volume DBA 345 00:16:27,903 --> 00:16:28,415 So 346 00:16:28,927 --> 00:16:33,535 Bus index is the first argument and we're going to pass in that volume DB that we calculate 347 00:16:34,047 --> 00:16:37,375 And then instead of returning something we're just going to remove that and not return any 348 00:16:37,631 --> 00:16:39,679 So I'm grabbing the bus index 349 00:16:39,935 --> 00:16:41,471 Of the bus name it was passing in 350 00:16:41,983 --> 00:16:45,823 We're converting a percentage of Passing into a dB volume 351 00:16:46,079 --> 00:16:50,687 Adam worth setting that DB volume in our audio server at bus index 352 00:16:51,199 --> 00:16:54,015 And that means that on this audio slider change 353 00:16:54,271 --> 00:16:56,319 Weekend simply do this we can say that 354 00:16:56,575 --> 00:16:57,855 Boss volume 4% 355 00:16:58,367 --> 00:17:01,439 We've got our bus name coming in this argument here 356 00:17:01,695 --> 00:17:06,047 And we've got our slider coming in so we can reference the slider.an value 357 00:17:07,071 --> 00:17:09,375 Which is going to be between 0 and 1 358 00:17:09,631 --> 00:17:10,911 And so you can see that 359 00:17:11,167 --> 00:17:17,055 Is SFX later when it's changed or passing in the SX lighter itself as well as two aspects but 360 00:17:17,567 --> 00:17:18,847 What's copy this line 361 00:17:20,383 --> 00:17:21,407 Paste it underneath 362 00:17:21,663 --> 00:17:23,455 But change this instead to 363 00:17:23,711 --> 00:17:24,735 Music slider 364 00:17:25,247 --> 00:17:26,015 And then 365 00:17:26,527 --> 00:17:27,295 Bind 366 00:17:27,807 --> 00:17:28,831 Music slider 367 00:17:29,087 --> 00:17:29,855 And 368 00:17:30,367 --> 00:17:31,647 The music box name 369 00:17:32,159 --> 00:17:34,719 So you can see how we can use the same handler 370 00:17:34,975 --> 00:17:41,119 For both cases by Simply using the bind to determine which slider is actually being charged 371 00:17:41,631 --> 00:17:46,239 Run this scene with F6 or by clicking the wrong currency button 372 00:17:47,519 --> 00:17:49,311 Looks like I used the wrong 373 00:17:49,567 --> 00:17:50,335 Signal here 374 00:17:50,591 --> 00:17:52,383 Which is actually good so 375 00:17:53,151 --> 00:17:56,223 Change does not inmates when you're actually slide in the slide 376 00:17:56,479 --> 00:17:58,527 So we said we just need to change this 377 00:17:59,295 --> 00:18:02,623 Instead of dark changed we need to do that value change 378 00:18:03,903 --> 00:18:04,927 Valuechanged 379 00:18:05,183 --> 00:18:11,327 And the good news is that we don't need a pass in this Library work we still do need to use the band for the bus name but we can get 380 00:18:11,583 --> 00:18:13,887 Rate of the first argument in the start bound for both 381 00:18:14,911 --> 00:18:21,055 Bad but we need to do this we need to scroll down here and we need to change this first argument in on audio slider change 382 00:18:21,311 --> 00:18:22,591 To value 383 00:18:23,103 --> 00:18:24,895 And this is there going to be a float 384 00:18:25,407 --> 00:18:27,967 Animal pass the value in as the second argument here 385 00:18:28,479 --> 00:18:31,039 OK that was my mistake I did not 386 00:18:31,295 --> 00:18:37,439 Notice that this change signal only inmates when min value max value pay doorstep is changed 387 00:18:37,695 --> 00:18:43,071 We wanted value change so that's why I support the read the documentation but lovely that wasn't easy fit 388 00:18:43,583 --> 00:18:48,447 And so now with all that in place let's run a scene and see if I 389 00:18:48,703 --> 00:18:50,751 Music goes down the slide the musically 390 00:18:53,055 --> 00:18:54,847 What happens when you slide the music slider 391 00:18:55,359 --> 00:18:57,919 That volume should go down depending on 392 00:18:58,431 --> 00:18:59,199 How you slide 393 00:19:01,759 --> 00:19:03,295 And if you click the window mode 394 00:19:04,063 --> 00:19:06,623 That should change the window mode from full screen 395 00:19:07,135 --> 00:19:09,439 To windowed and also play the audio 396 00:19:09,951 --> 00:19:14,303 Is it actually great with a test of the sound effects layers working to slide it all the way down 397 00:19:14,815 --> 00:19:16,863 And see if you can hear the the button 398 00:19:19,935 --> 00:19:20,703 I can't hear it 399 00:19:20,959 --> 00:19:22,239 So all that work 400 00:19:22,495 --> 00:19:24,287 Now there's one I'll be a problem here 401 00:19:25,823 --> 00:19:26,591 Which is that 402 00:19:27,359 --> 00:19:28,895 This label is 403 00:19:29,151 --> 00:19:29,663 So 404 00:19:30,175 --> 00:19:32,479 Does SFX volume same music volume 405 00:19:32,991 --> 00:19:36,319 Something to change that label so that it says the proper thing 406 00:19:39,647 --> 00:19:45,791 So our options menu is just about done we just need to make the back button work and we need to hook it 407 00:19:46,047 --> 00:19:50,143 To the main menu and I know this lesson is going along but we're almost done 408 00:19:50,399 --> 00:19:55,775 So what we gonna do is we're going to create a custom signal on the options menu call the signal back 409 00:19:56,287 --> 00:19:56,799 Breasts 410 00:19:58,079 --> 00:19:59,615 And the reason that we're going to do this 411 00:19:59,871 --> 00:20:05,503 Is because the actions when is going to be special in that it can be displayed from the main menu but also from 412 00:20:05,759 --> 00:20:07,039 The game console 413 00:20:07,551 --> 00:20:10,623 We're going to need to be able to manually control 414 00:20:10,879 --> 00:20:12,415 The behaviour of the back button 415 00:20:12,671 --> 00:20:14,207 That's why I was saying bad press 416 00:20:14,719 --> 00:20:16,767 And let's grab a reference 417 00:20:17,023 --> 00:20:17,791 To the back button 418 00:20:18,047 --> 00:20:20,095 Already far back button 419 00:20:20,607 --> 00:20:21,375 Equals 420 00:20:21,887 --> 00:20:23,423 Dollar sign percent 421 00:20:23,935 --> 00:20:24,703 Back button 422 00:20:26,495 --> 00:20:27,263 Just like so 423 00:20:27,775 --> 00:20:29,055 Let's Create 424 00:20:29,311 --> 00:20:33,407 A single connection so at the top of the back button press 425 00:20:33,919 --> 00:20:36,223 Connect onbackpressed 426 00:20:37,503 --> 00:20:38,527 And then down here 427 00:20:39,295 --> 00:20:41,599 What do you funk I'm back pressed 428 00:20:44,159 --> 00:20:46,463 And we're going to do that back 429 00:20:47,231 --> 00:20:49,791 Craft.com it that's it 430 00:20:51,071 --> 00:20:54,143 B r 1000 do let's go to our main menu 431 00:20:55,167 --> 00:21:01,055 And in the on auctions pressed let's do the following first let's preload the option seen so we're going to say 432 00:21:01,311 --> 00:21:04,639 Bar options underscore is equal to preload 433 00:21:04,895 --> 00:21:07,967 And then look for the options menu dot tsyn 434 00:21:08,223 --> 00:21:10,783 Make sure it's not tse and not GDP 435 00:21:11,551 --> 00:21:12,319 And 436 00:21:12,831 --> 00:21:17,440 In our options Prestwood to save options scene is equal to 437 00:21:18,464 --> 00:21:23,584 Or other options instance is equal to options scene 438 00:21:24,608 --> 00:21:26,144 Start instantiated 439 00:21:27,168 --> 00:21:32,288 Let's go in and add that as a child to the current scenes are putting it on top of the main menu 440 00:21:33,312 --> 00:21:34,592 Options instant 441 00:21:34,848 --> 00:21:36,896 Analyst do options instance 442 00:21:38,944 --> 00:21:39,712 Back press 443 00:21:41,504 --> 00:21:42,272 Dartconnect 444 00:21:43,040 --> 00:21:43,552 On 445 00:21:44,064 --> 00:21:45,856 Options closed 446 00:21:46,880 --> 00:21:47,648 Annelids 447 00:21:47,904 --> 00:21:50,464 A new function on options closed 448 00:21:53,280 --> 00:21:54,560 That's right passing here 449 00:21:55,072 --> 00:22:00,960 And what's passed the options instance as a binding to on options clothes so find 450 00:22:01,216 --> 00:22:02,240 Options 451 00:22:02,752 --> 00:22:03,520 Instance 452 00:22:05,568 --> 00:22:06,336 Just like so 453 00:22:06,848 --> 00:22:11,456 And then it will accept that in the on options Close so options instance 454 00:22:12,224 --> 00:22:13,504 Of type node 455 00:22:13,760 --> 00:22:14,784 Just like so 456 00:22:15,040 --> 00:22:21,184 And we're just going to simply do options instance and I'm just going to call this instance instead of in 457 00:22:23,488 --> 00:22:25,536 Options instance IQ free 458 00:22:27,840 --> 00:22:29,376 Alright so little Run the game 459 00:22:29,888 --> 00:22:31,936 And now if I click on the options button 460 00:22:32,448 --> 00:22:34,752 I should see actions overlaid on top 461 00:22:35,008 --> 00:22:36,800 So if I look at my scene tree here 462 00:22:37,312 --> 00:22:41,920 We've got a main menu but then the options menu is on top with the exact same layout here 463 00:22:42,176 --> 00:22:43,200 Which is just fine 464 00:22:43,712 --> 00:22:47,296 Anna let's go back I'm gonna click back here and I'm back to the main menu 465 00:22:48,576 --> 00:22:51,648 So we're all good there and I can click play and go into the game 466 00:22:52,160 --> 00:22:54,976 Alright so that's it for options menu setup 467 00:22:55,232 --> 00:22:59,840 The next step were going to do some filming of the sliders and related 468 00:23:00,096 --> 00:23:01,120 UI elements 33890

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.