From b3b1029785cd169be3bcda42ac3440dc70f63496 Mon Sep 17 00:00:00 2001 From: AleaJactaEst Date: Mon, 7 Jun 2021 23:07:44 +0200 Subject: [PATCH] adding some functionnality on main windows [settings, juke blox, select language, information, help/author] --- assets/interfaces/buttons/add.png | Bin 0 -> 879 bytes assets/interfaces/buttons/del.png | Bin 0 -> 897 bytes assets/interfaces/buttons/down.png | Bin 0 -> 897 bytes assets/interfaces/buttons/up.png | Bin 0 -> 885 bytes assets/interfaces/jukebox/auto_off.png | Bin 0 -> 966 bytes assets/interfaces/jukebox/auto_on.png | Bin 0 -> 935 bytes assets/interfaces/jukebox/music_off.png | Bin 0 -> 937 bytes assets/interfaces/jukebox/music_on.png | Bin 0 -> 952 bytes assets/interfaces/jukebox/mute.png | Bin 0 -> 925 bytes assets/interfaces/jukebox/sound_off.png | Bin 0 -> 925 bytes assets/interfaces/jukebox/sound_on.png | Bin 0 -> 941 bytes assets/interfaces/jukebox/soundeffect_off.png | Bin 0 -> 936 bytes assets/interfaces/jukebox/soundeffect_on.png | Bin 0 -> 944 bytes locale/en.po | 36 ++ locale/fr.po | 36 ++ locale/messages.mo | Bin 2285 -> 2903 bytes locale/messages.pot | 37 ++ project.godot | 4 +- ressources/scripts/config/config.gd | 49 +- ressources/scripts/creatures_old.gd | 148 ++--- scenes/connection/connection.gd | 44 +- scenes/interfaces/main_menu/main_menu.gd | 2 +- .../interfaces/music_manager/music_button.gd | 52 +- .../music_manager/music_button.tscn | 60 +- .../interfaces/music_manager/music_manager.gd | 523 +++++++++++++++--- .../music_manager/music_manager.tscn | 168 ++++-- scenes/interfaces/options/option_info.gd | 10 +- scenes/interfaces/options/option_language.gd | 4 +- scenes/interfaces/options/option_news.gd | 3 - scenes/interfaces/options/option_settings.gd | 122 ++-- .../interfaces/options/option_settings.tscn | 50 +- .../options/option_settings_music_box.gd | 28 + .../options/option_settings_music_box.tscn | 21 +- scenes/interfaces/options/options.gd | 37 +- scenes/main/main.gd | 46 +- 35 files changed, 1171 insertions(+), 309 deletions(-) create mode 100644 assets/interfaces/buttons/add.png create mode 100644 assets/interfaces/buttons/del.png create mode 100644 assets/interfaces/buttons/down.png create mode 100644 assets/interfaces/buttons/up.png create mode 100644 assets/interfaces/jukebox/auto_off.png create mode 100644 assets/interfaces/jukebox/auto_on.png create mode 100644 assets/interfaces/jukebox/music_off.png create mode 100644 assets/interfaces/jukebox/music_on.png create mode 100644 assets/interfaces/jukebox/mute.png create mode 100644 assets/interfaces/jukebox/sound_off.png create mode 100644 assets/interfaces/jukebox/sound_on.png create mode 100644 assets/interfaces/jukebox/soundeffect_off.png create mode 100644 assets/interfaces/jukebox/soundeffect_on.png diff --git a/assets/interfaces/buttons/add.png b/assets/interfaces/buttons/add.png new file mode 100644 index 0000000000000000000000000000000000000000..a0b636c160da83c9cf98a452606e86de1b09830d GIT binary patch literal 879 zcmZuvF>94U5FAVp2}CSXNE(ZrO)5(}QC`#m2|;6L5wWqEKVfHKGe5xI#zxt~N=Rv8 zBR1Ql@E`aC*8N@}y!Sp2?r!hcxtX24_b10sc6au70POPV;(714rg`IfuXp~|YhVi} z&rXl}Sj$<2c$jpeaEs5k9BY^-62p}*THM`101Z+qkG5(j7$UqntL~!&=GuWKI zBGL}Yq{b*ar6Aq0lw@>3X0I)^GBO;NMR9OMh0_Yr92zbw#o+KziP;&0#j(U^Zm=<8 zl~DE-XZv$W+gc{(=AWBa6`77`Af?W5rXpx}tjvDD17`L*YNo!T(isZVYQ3&h2E$#4 zDw)ysv9jx)(CcLF%qm|SctzRGy<}}EO}wO^Ifr%U`nX!k)Z}uc9FzxzksDs4g|65Q zMQ$MIC^@O_fibjR?(|1op){jAN2u#u{|&@?e_ABc2%*ypk#IonZyNn+a literal 0 HcmV?d00001 diff --git a/assets/interfaces/buttons/del.png b/assets/interfaces/buttons/del.png new file mode 100644 index 0000000000000000000000000000000000000000..0ad266bb7007e7ed7633ab2d62ab1eacd0f5f2c6 GIT binary patch literal 897 zcmZvaF>6&p5QRtIGe}HO5JhY(TpPhcRIm_4c|ngz2oeOlh$vW`!oOgpV0HWh;tvR^ zrjBK>uv2irzhGhWD#y7u5Z-;)g}Xa@+1c;RnSH;t`CxtZ;;NagEX>4Tx04R}tkv&MmKpe$i)7DCkc+5KnK` z49@$+QC5;w;&b9LlP*a7$aTf#H_k?RNS*z4p`=0!Tk-WaL%ypW>NMaF7kRU=q9c5HdL!4Hf6botEPk8u;9KS>^geSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{00CJ^L_t(I%axNcZc|YZMbFq)EYgq$q!cLBC_6~wNL~Re zU>CG3z>!h85^Y4fKJJz-nl7 zV65%}uYnz49k{08`bnLr%XB_huQML2ef52E=IX8bPVE#;21#C|aH`&`ztpdppQrI( zap?iQQNN_YGS@W4ixdwYh)YI2^;-(2In1Bxsrt4ou6j&+`F#dF2Yvu&z(GWOE|Y%) X>P$u~fi)z600000NkvXXu0mjfYqxxi literal 0 HcmV?d00001 diff --git a/assets/interfaces/buttons/up.png b/assets/interfaces/buttons/up.png new file mode 100644 index 0000000000000000000000000000000000000000..7b824923853500384a67436d64637d4634c301d5 GIT binary patch literal 885 zcmV-*1B(2KP)EX>4Tx04R}tkv&MmKpe$i)7DCkc+5KnK` z49@$+QC5;w;&b9LlP*a7$aTf#H_k?RNS*z4p`=0!Tk-WaL%ypW>NMaF7kRU=q9c5HdL!4Hf6botEPk8u;9KS>^geSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{00B)&L_t(I%axM5N?cJChQEEBXcR0&2+S*(B84w7&tPL2 z!N$jsq_egd3o8RMWxNz(Z7I2QDIGLQ$VCMmlsWTRWSww0oH>%e*s#~-U;ny54b-;U zQ@^SEYKJDM6P5ov^+p}3x!PB|YP*SKQQc6F)bEj8#)Z00gXFGy9~DOxg5rOvuGLlU zslQ7}cj|SJ4T88Jx=@e*wWEHBfTGH|dKiSNKh+cUp`<8RKdDPu2$=#B&GfkDiq7OjvqtnnQH^E`tmjb}exM}Bi600000 LNkvXXu0mjfNh5f) literal 0 HcmV?d00001 diff --git a/assets/interfaces/jukebox/auto_off.png b/assets/interfaces/jukebox/auto_off.png new file mode 100644 index 0000000000000000000000000000000000000000..57148085cc3ba703cae725cf97dbd7347809d664 GIT binary patch literal 966 zcmZuvKWNiY5WcpdmSQC0AShUeHv|U-3u-}xhSYjsV_UQ6qJw|xa0*2z*+dW(9n1#} z;#3gD$t^c@a&Qw;ba3#%MH~b{bSb!;_e-E8`T5|zclWq^-*?~LQ5(u&s0)lGdH_l?SZ+2Wa1{eI4f46hPgzb!4;<#`xXk+Qr_>?bo}SVcp^CY`whI z#_XPVhbIb`zODV9KJ)z0N_pf~<y|D4(?Dap5hwaw-_SeSl&6|bGOE)?v-#j?=`DyFQ*u9U(T3;4? YYX7Sr^XoJ1!bnDf=W5lrm883_dQ!m5S4aUqv!{L_sAw2W0qU*4%%rq|xc!t}o&t#@AD zd-mhS-xkl|%ie-~I{A=$TZ8%i;pJ_?hxIe3cQ5?9^zP4^EZ!bo*%>T-|9J4Z{r=|b aZ!tXb_Mr3o{;R>0ih|`{cjxMZr~d$2i?1F4 literal 0 HcmV?d00001 diff --git a/assets/interfaces/jukebox/music_off.png b/assets/interfaces/jukebox/music_off.png new file mode 100644 index 0000000000000000000000000000000000000000..f4758095a528412469e9691107438aebeac4c214 GIT binary patch literal 937 zcmZvaKWLOe5XC3a7&$on(+IIiv7)GjT38CoMQ*dM>QWwKIAgd)o}wD=Ze}C_sA?(2MNEVu5K)nmQMD^~F%wb%QI+yP zCl@y{3L#L@k}uW5>i95o(g3QWlpq~2Ri+KNs->aoxu(=`bE6T2LW>p)qZ0iq4K2fX_bHm1jRQd*F|$4+Y-*{<$*&hL!rW<=feNGt-C?F=+HlYJ(@^(Z zOVredh0_g2B~mZL;iksS1L5kH`Du9OT}4mAvNGemEZ`9`n>(VWlmrj)waUq4ht=p@Y4j=Uv&s_WRAe%a9 zT)*+-+vlyf=RbC@E^N;%_y0a`pW0tLcQDv}w)pkzpWcP{gSijCQt78x8|&+DHumhK)6PmgoOBk9^p)3VG$L<2NNu`Nf|^FwMae@ zJ4qoTh!!DEsW!F-M7&};D<7>OR^$BdAl$=+-JM-#_V>-quFW^+#_EUaA~J?EGp*dm zt2sK7>-xsEhR7b7Kf5rS$LP%HY>}s^hP#^?NmT_F8q9iuO71eVK3!~TsmRG6E?$JW(<}p_njUmlGmvSkd%m9r z+;c54q&_U1ZfXQI^)g)DV9Y!;9B!E(!ZYtGx*wL6>E&escahoLE;XejxPu?6ob*>N zkG-i>O%9qX4ax$Q;sdpo6xvg6QS*Ta&_e0Z>;a`{f4bElVVF8$**S=2p8dZ8(%+vH zDNZq!bPq8Xnke(zS_nNQNP;?JXJVw5#=hIF=K1c;(u@5YXr$c%gX|kL=3&`b#-|Vq<#q$Q_)k?Y;bN>(uufvibPu)foTr`}3E3 ztJ~L`50AgS^=G?ra(U%Id|O(&|Mf|G`R?SeXR9A;pC;z&W#Q)Y3X9q1%$w=Om4D;k BwT1uy literal 0 HcmV?d00001 diff --git a/assets/interfaces/jukebox/mute.png b/assets/interfaces/jukebox/mute.png new file mode 100644 index 0000000000000000000000000000000000000000..b5e402451f5b9ec8eaf3e69366dcf3115083d6cf GIT binary patch literal 925 zcmZuvziX615S@!bL-fQ}1)Gc_RyJB_p@xfQFdQ)kY_$+}s?wtx%GnQ56bDO*{9$CzFBy@ z@@MALf%jJ@SM}@qt+$=e&wrlzcH!f>jl=WzJI~&2ZXf;q<8^oQ;;|-W}YZ?66WSbnKw literal 0 HcmV?d00001 diff --git a/assets/interfaces/jukebox/sound_off.png b/assets/interfaces/jukebox/sound_off.png new file mode 100644 index 0000000000000000000000000000000000000000..b5e402451f5b9ec8eaf3e69366dcf3115083d6cf GIT binary patch literal 925 zcmZuvziX615S@!bL-fQ}1)Gc_RyJB_p@xfQFdQ)kY_$+}s?wtx%GnQ56bDO*{9$CzFBy@ z@@MALf%jJ@SM}@qt+$=e&wrlzcH!f>jl=WzJI~&2ZXf;q<8^oQ;;|-W}YZ?66WSbnKw literal 0 HcmV?d00001 diff --git a/assets/interfaces/jukebox/sound_on.png b/assets/interfaces/jukebox/sound_on.png new file mode 100644 index 0000000000000000000000000000000000000000..8da562d990ced0c56b3c4c102067e6cf7804c555 GIT binary patch literal 941 zcmZvbKWJ1z5XOfj>TwV_2x-!~MX(SR6a+0acj%{bgct-X#mW?;jR=+o5p06_nvlX) zNCXRm(}^hd5d;yY5Cjnv>>~aF$9Z=U?(Vs;yR(m({e3gD@4DI$|N+g`}M zRn5j&t`AqQ9}^ju`3sAkJVtLuZ;L!dHQe3INUAD;Qi_Y12t`x`A|<10pWMYvNKq9) z%Kw~P+{7qUQ3y)jR12%)!^}xjC7`7Q>8b`WZB+*>4Zw3vso~~Eqf((LC>BPint~`= z7*tmn3X6uq)1x3zdhzZfG?)znmE2`!efrqcQjwEiFJ6SX(<}p_njUmlGmvSkd)}W0 z+;c5aQy&&iH#LHqdKs>6FlHVa4!6t?;hA?8Jq*jr4DzyoyU1*ApPEt<+{4!@C&QJ? z<6tUPlY{0;gR(%S_(-iKg$|Tk)O;iYv`{)Udq62VoNo0-7^Y5Gb`GMM=kRNQ4EHBR zic?G_-9yZUCdz!a7D7)6lAzw$J}@?s#@<^C-HZJ%Hy-a>P3sccrxs_opYwcE4make z*8f~NzSU}Wp6s97;_o}>niF_^`S#|@-EY5+Oz+Gbee-wa=Fj2Bj7h z2H{ZC!h(Q$dK3*UgLwA|nwpIQL2fg%K0|D3smRH%7cauxX_kQsqzBz$rexZ1&-c?% z_gqWV)Q5%B4MrtWFT>%c#>@lZ>X!Lwc;;P2kHfMuqr5EOHZq$#q^6Vv5Ae0h$#~`R zIGRe;-YGT0XSV@11B!t2y`X z&*qc%%g=W%Jo?pK_U459g!oP*IXC0G2j;)(ZlIwkVZ^81NOo=|2qixaA9|6mzn*2GqaE8o0saf!!;49>*Yo(_t|RB zOy#<~a`TMHUYWnzp37tOXY{woQ&hv<&5R@fRV}5sh>1`HA}UfcYU0XW%!Cv`RHgjS z$;C~KLI_l}aoxu(=`bE6T2LW>p)qZ0iq4K4k6_c5B94Ff^$GP6DdY-*{<$)7A-XQWD(9PgG7uE0@RN zRH`Ni%|TPJD5UsUttEvHm0Msw7NN8NU6DPY6pW@@{Sk)2sg|8nLFPI78&pR7lOn|_ z21)l2bD;^C-_}CtDM1p{AKjBv`_h=c(`sHD+$_D?zmir*8|T|6x^MZZCdXzju0?e3 z&VK2&Uv9RJF7*x_yuSUbbNbZBuUm3p`rO0CBhTBb#}}Xceet=qb7gh;Ua!9Se*4G5 r>)U(m+t$0sKX079_2&E9#{G@%vz<=k&xhaZPb-|xH5=;}79RWq`Pa7z literal 0 HcmV?d00001 diff --git a/locale/en.po b/locale/en.po index a6df706..0d51f7c 100644 --- a/locale/en.po +++ b/locale/en.po @@ -118,3 +118,39 @@ msgstr "Add" msgid "OPTION_SETTINGS_SOUND_SELECTION_DELETE" msgstr "Del" + +msgid "JUKEBOX_TITLE" +msgstr "JUKE BOX" + +msgid "JUKEBOX_PREVIOUS" +msgstr "Previous" + +msgid "JUKEBOX_PAUSE" +msgstr "Pause" + +msgid "JUKEBOX_PLAY" +msgstr "Play" + +msgid "JUKEBOX_NEXT" +msgstr "Next" + +msgid "JUKEBOX_SOUND_EFFECT" +msgstr "Sound effect" + +msgid "JUKEBOX_MUSIC" +msgstr "Music" + +msgid "JUKEBOX_AUTO" +msgstr "Music khanat (Auto) or your music" + +msgid "JUKEBOX_MUTE" +msgstr "Mute" + +msgid "OPTION_SETTINGS_SOUND_SELECT_DEVICE" +msgstr "Del" + +msgid "OPTION_TITLE" +msgstr "Settings" + +msgid "JUKEBOX_ADD" +msgstr "Add music(s)" diff --git a/locale/fr.po b/locale/fr.po index c739c0c..24c2b09 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -118,3 +118,39 @@ msgstr "Ajouter" msgid "OPTION_SETTINGS_SOUND_SELECTION_DELETE" msgstr "Supprimer" + +msgid "JUKEBOX_TITLE" +msgstr "JUKE BOX" + +msgid "JUKEBOX_PREVIOUS" +msgstr "Précédent" + +msgid "JUKEBOX_PAUSE" +msgstr "Pause" + +msgid "JUKEBOX_PLAY" +msgstr "Jouer" + +msgid "JUKEBOX_NEXT" +msgstr "Suivant" + +msgid "JUKEBOX_SOUND_EFFECT" +msgstr "Effet sonore" + +msgid "JUKEBOX_MUSIC" +msgstr "Musique" + +msgid "JUKEBOX_AUTO" +msgstr "Jouez votre musique" + +msgid "JUKEBOX_MUTE" +msgstr "Silence" + +msgid "OPTION_SETTINGS_SOUND_SELECT_DEVICE" +msgstr "Supprimer" + +msgid "OPTION_TITLE" +msgstr "Configuration" + +msgid "JUKEBOX_ADD" +msgstr "Ajouter une(des) musique(s)" diff --git a/locale/messages.mo b/locale/messages.mo index 9fa5282568f18e6da9ec52d96116c4e7cf6cb0b4..eb17e2ff4aefc5125a9c538705250720ff790cff 100644 GIT binary patch literal 2903 zcmai#O>Epm6vwAfXbBWbDJ`^oO!+8D>9!3LsB9HfXLmN3dhPAn&PRo0IlGgMTdy7Y zqe*%}y}$*5IP`#^7gTXWh!YYg)EnZ0#EDA~s)U4uI3NTkB>rzb`;n5gqdfoiy?OKA z%$sLtW8cne3}X`V6y(MZ#wy_Pd-1?Hy_2!~!PmhD!L#5)paJdy7nI&n%#{7A(mw?E z!tYaXKlp{3zX|Sx{sZ_hcuVn5W#4gMk!L^n80L?F6z5f?*T6@iUjQj?2)+Pb1 zTS~tQJ`4Rbkm`C990z|^_T9S~I|h9mq&zlAb-e;21$$5N18^7a``NG4= zl>RM9_x!!me*tk+_B%-V{syV<{#Ew9XlmN;A&~m!BuI5S3zEOC*Z^@2y}N$`JPe^h zYx)BrdwYKoq&@Zr-9Pmd-51r4`i%B?5<DabPr8jnEe4D_B-Z_;=YLg!PjH#XvH{ z47TN(RZrAvqB0EN=#C*+UDHjkE=<>JXtq6PHLIg0iaPW-@9NHoiu_Ges|#kzRo+UZ zpXG^UR>RRP)6>nGBUWVQ@t zD`Sl$z6h4|c4<~7X%I(ceref{{H)Xp0~uv}a;#yMn(}f$lclPk$uew)pJpW|@uM{K zvp6YpEzjbvp9L*H4A*%_MlykG8;(&Y_dBxWNWWX=Q5?yEt;}UKR@dudn0xZXsj*5N zWyoA|)>n`#lWW<@mCz5OGrYCzC#lS)T&Gq#J@lh(EXkxKqE_4vqE4BgUJSCaMwlml zSgOTIH$~=^o|;a*a)uW_r^X|GWQtEtoEhtXW3_ghck?u8ji(c=PCryN_&6PKg2xG8 zkMpE(Dm?JaB)(*8sHUH%k~Knq9fd{7;yh(`oJVagmzJp9^bP0uh{H2YSL38zIG@jh zjJc^yBEL(aMm~y2yBsGev(7OiXvqliwZ%Bkm~~0rVX>i5)tMX-ptqoxnu#LyOc*cv z;pmoeSXRY9781kHqt^21*%pS!oDJGCX4BZNOhTEaSh3{iVa8i=v=nquf~Xy@az9-4*Ha!xJd0P@YGLg9Ye5%I PZJajCaJeahk9P2X7I%Lk delta 872 zcmZ9~KS&%w6vy#*dQo$Ur>Eu;|K%=v5fK842o|Oa21Kxkl_H497K$1Rv68G^5>krT zM2m=}u{awG5hRcd&O z-WN0L!Lbr9w9ZnqGVH<{?8PJwx}zSS!pFpyuogdKHLm;kJEj;PVjccL)(q_*H=3A? zM-wur30?RE-(m}nxgow_{0$rM2ex7Xvsn5d`j{N*{{yJ_I5y+5k2f&G`gXvLzPy0# zcw2m6_L9%;VBC*wIFI~n&E3FqsL*uHz{@t>#){YHLv%%z0&?aTug z$l7+L2Y8LD#Ep-Wyj?F&p`NEv^XpNGW!yH8ze3ILMv82`s4eKj1P)=S7mRpd996Pu zA1~uW#$QkitfJ1qSC8+Y65K;=;V;y@f_sh>sJJ~!L`{{}`OucqLTij}ihHU*XX#4f z8C}UKW3^mF@tWqUL{x?U+j9?OTyn5_`cpcEyw|Gjb##anRf*KJM>;4~be(inK;_bx yR?;8Q?ajp8WH6IIil4^vw`Ct<`HvONv6afir= $window_box/scroll_box/musics_box.get_child_count(): + Config.msg_error("Out of range : " + "pos:" + str(pos) + " count:" + str($window_box/scroll_box/musics_box.get_child_count())) + return + self.move_child_id(id, pos + 1) + + +func _on_music_box_up_pressed( id ): + Config.msg_debug("_on_music_box_up_pressed") + var pos = 0 + for child in $window_box/scroll_box/musics_box.get_children(): + if child.get_id() == id: + break + pos += 1 + if pos <= 0: + Config.msg_error("Out of range : " + "pos:" + str(pos)) + return + self.move_child_id(id, pos - 1) + + +func move_child(music_filename, pos): + var ele = null + for child in $window_box/scroll_box/musics_box.get_children(): + if child.get_music() == music_filename: + ele = child + break + if ele: + $window_box/scroll_box/musics_box.move_child(ele, pos) + playlist_music['player'] = $window_box/scroll_box/musics_box.get_children() + + +func move_child_id(id, pos): + var ele = null + for child in $window_box/scroll_box/musics_box.get_children(): + if child.get_id() == id: + ele = child + break + if ele: + $window_box/scroll_box/musics_box.move_child(ele, pos) + playlist_music['player'] = $window_box/scroll_box/musics_box.get_children() + load_music_to_config() + func open(): + Config.msg_debug("Open") + update_playermusic() self.popup() - + + func close(): + Config.msg_debug("Close") self.hide() - + + func toggle(): + Config.msg_debug("toggle") if self.visible: self.close() else: self.open() -func _on_music_pressed( p_filename ): +func _on_music_pressed(): + Config.msg_debug("Music") + + +func _on_music_bis_pressed( p_filename ): Config.msg_debug(p_filename) - #audio_player.stream = load( p_filename ) - #audio_player.set_volume_db(1.0) - #audio_player.play() - - #$music.stream = load( p_filename ) - #$music.play() + + +func _on_previous_pressed(): + Config.msg_debug("Previous") + var previous = null + for child in $window_box/scroll_box/musics_box.get_children(): + if child.get_music() == currentmusic: + if previous != null: + pause = false + play_music(previous.get_music()) + return + previous = child + + +func _on_pause_pressed(): + Config.msg_debug("Pause") + if pause: + return + pause = true + playback_position_before_pause = music_player.get_playback_position( ) + #music_player.stop() + + +func _on_play_pressed(): + Config.msg_debug("Play") + if not pause: + return + music_player.play(playback_position_before_pause) + pause = false + + +func _on_next_pressed(): + Config.msg_debug("Next") + var detected = false + for child in $window_box/scroll_box/musics_box.get_children(): + if child.get_music() == currentmusic: + detected = true + break + if detected: + pause = false + play_music(child.get_music()) + return + + +func _on_sound_pressed(): + Config.msg_debug("Music") + + +func _on_soundeffect_pressed(): + Config.msg_debug("Sound Effect") + + +func _on_auto_pressed(): + Config.msg_debug("Auto") + Config.set_playermusic(not Config.get_playermusic()) + Config.save_config() + emit_signal( "musicplayer_pressed" ) + + +func _on_mute_toggled(button_pressed): + Config.msg_debug("Mute") + MusicManager.set_sound_mute(button_pressed) + emit_signal( "mute_pressed" ) + + +func _on_mute_pressed(): + Config.msg_debug("Button JukeBox Mute") + MusicManager.set_sound_mute(not Config.mute) + emit_signal( "mute_pressed" ) + + +func set_playermusic_on(): + Config.msg_debug("playermusic on") + $window_box/controls_box/h_box_container_3/auto.texture_normal = load ( "res://assets/interfaces/jukebox/auto_on.png") + + +func set_playermusic_off(): + Config.msg_debug("playermusic off") + $window_box/controls_box/h_box_container_3/auto.texture_normal = load ( "res://assets/interfaces/jukebox/auto_off.png") + Config.msg_debug("playermusic off : End") + + +func set_mute_on(): + Config.msg_debug("mute on") + self.disable_execution_mute = true + $window_box/controls_box/h_box_container/mute.texture_normal = load ( "res://assets/interfaces/jukebox/sound_off.png") + self.disable_execution_mute = false + + +func set_mute_off(): + Config.msg_debug("mute off") + self.disable_execution_mute = true + $window_box/controls_box/h_box_container/mute.texture_normal = load ( "res://assets/interfaces/jukebox/sound_on.png") + self.disable_execution_mute = false + + +func _on_add_pressed(): + Config.msg_debug("") + $file_dialog.show() + + +func _on_file_dialog_files_selected(paths): + Config.msg_debug("multi files") + #if self.slots_number > 0: + # self.slots[self.slots_number - 1].disable_down() + for path in paths: + var found = false + for child in $window_box/scroll_box/musics_box.get_children(): + if child.get_music() == path: + found = true + break + if found: + continue + Config.msg_debug("file: "+ path) + MusicManager.add_music(path) + self.next_id += 1 + self.open() + + +func update_playermusic(): + Config.msg_debug("update_playermusic") + if Config.get_playermusic(): + #Config.msg_debug("update_playermusic: player music") + set_playermusic_on() + for child in $window_box/scroll_box/musics_box.get_children(): + if child.get_music() == currentmusic: + #Config.msg_debug("update_playermusic: player music : on " + child.get_music()) + child.set_play() + elif Config.mute: + child.set_disabled() + else: + #Config.msg_debug("update_playermusic: player music : off " + child.get_music()) + child.set_unplay() + else: + #Config.msg_debug("update_playermusic: khanat music") + set_playermusic_off() + for child in $window_box/scroll_box/musics_box.get_children(): + child.set_disabled() + if last_update_playermusic != Config.get_playermusic(): + Config.msg_debug("*** last_update_playermusic different ***") + load_playlist() + last_update_playermusic = Config.get_playermusic() + Config.msg_debug("update_playermusic : End") + + +func _on_check_button_toggled(button_pressed): + Config.msg_debug("_on_check_button_toggled") + #Config.set_playermusic(not Config.get_playermusic()) + Config.set_playermusic(button_pressed) + emit_signal( "musicplayer_toggled" , not Config.playermusic ) + + +func _on_music_manager_musicplayer_pressed(): + Config.msg_debug("Signal musicplayer_pressed recieved on MusicManager") + update_playermusic() + + +func _on_music_manager_mute_pressed(): + Config.msg_debug("Signal mute_pressed") + update_playermusic() + if Config.mute: + set_mute_on() + else: + set_mute_off() + + +func _on_signal_mute_pressed(): + Config.msg_debug(" Received signal mute") + update_playermusic() + if Config.mute: + set_mute_on() + else: + set_mute_off() + + +func _on_signal_musicplayer_pressed(): + Config.msg_debug(" Received signal musicplayer") + update_playermusic() diff --git a/scenes/interfaces/music_manager/music_manager.tscn b/scenes/interfaces/music_manager/music_manager.tscn index 38e4f4a..22ff3be 100644 --- a/scenes/interfaces/music_manager/music_manager.tscn +++ b/scenes/interfaces/music_manager/music_manager.tscn @@ -1,29 +1,48 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://assets/interfaces/music_manager/play.png" type="Texture" id=1] [ext_resource path="res://assets/interfaces/music_manager/previous.png" type="Texture" id=2] [ext_resource path="res://assets/interfaces/music_manager/next.png" type="Texture" id=3] [ext_resource path="res://assets/interfaces/music_manager/pause.png" type="Texture" id=4] [ext_resource path="res://scenes/interfaces/music_manager/music_manager.gd" type="Script" id=5] +[ext_resource path="res://assets/interfaces/jukebox/soundeffect_on.png" type="Texture" id=6] +[ext_resource path="res://assets/interfaces/jukebox/music_on.png" type="Texture" id=7] +[ext_resource path="res://assets/interfaces/jukebox/sound_on.png" type="Texture" id=8] +[ext_resource path="res://assets/interfaces/jukebox/auto_on.png" type="Texture" id=9] +[ext_resource path="res://assets/interfaces/buttons/add.png" type="Texture" id=10] [node name="music_manager" type="WindowDialog"] -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -64.0 -margin_top = -64.0 -margin_right = 64.0 -margin_bottom = 64.0 +anchor_left = 0.45 +anchor_top = 0.411 +anchor_right = 0.817 +anchor_bottom = 0.651 +margin_top = 0.0799866 +margin_right = 0.23999 +margin_bottom = 0.279968 rect_min_size = Vector2( 256, 128 ) -popup_exclusive = true -window_title = "Juke box" +window_title = "JUKEBOX_TITLE" resizable = true script = ExtResource( 5 ) __meta__ = { "_edit_use_anchors_": false } +[node name="file_dialog" type="FileDialog" parent="."] +margin_right = 538.0 +margin_bottom = 326.0 +popup_exclusive = true +window_title = "Ouvrir un ou plusieurs fichiers" +resizable = true +mode = 1 +access = 2 +filters = PoolStringArray( "*.mp3,*.ogg" ) +show_hidden_files = true +current_dir = "/home/aleajactaest/Projets/khanat/khanat-client-new" +current_path = "/home/aleajactaest/Projets/khanat/khanat-client-new/" +__meta__ = { +"_edit_use_anchors_": false +} + [node name="window_box" type="VBoxContainer" parent="."] anchor_right = 1.0 anchor_bottom = 1.0 @@ -32,45 +51,126 @@ __meta__ = { } [node name="controls_box" type="HBoxContainer" parent="window_box"] -margin_left = 90.0 -margin_right = 166.0 +margin_right = 470.0 +margin_bottom = 16.0 +size_flags_horizontal = 3 + +[node name="h_box_container_4" type="HBoxContainer" parent="window_box/controls_box"] +margin_right = 152.0 +margin_bottom = 16.0 +size_flags_horizontal = 7 + +[node name="add" type="TextureButton" parent="window_box/controls_box/h_box_container_4"] +margin_left = 68.0 +margin_right = 84.0 +margin_bottom = 16.0 +hint_tooltip = "JUKEBOX_ADD" +size_flags_horizontal = 6 +texture_normal = ExtResource( 10 ) + +[node name="h_box_container" type="HBoxContainer" parent="window_box/controls_box"] +margin_left = 224.0 +margin_right = 240.0 margin_bottom = 16.0 size_flags_horizontal = 6 -[node name="previous" type="TextureButton" parent="window_box/controls_box"] +[node name="mute" type="TextureButton" parent="window_box/controls_box/h_box_container"] margin_right = 16.0 margin_bottom = 16.0 -texture_normal = ExtResource( 2 ) +hint_tooltip = "JUKEBOX_MUTE" +size_flags_horizontal = 5 +texture_normal = ExtResource( 8 ) +__meta__ = { +"_edit_use_anchors_": false +} -[node name="pause" type="TextureButton" parent="window_box/controls_box"] +[node name="h_box_container_2" type="HBoxContainer" parent="window_box/controls_box"] +margin_left = 313.0 +margin_right = 313.0 +margin_bottom = 16.0 + +[node name="previous" type="TextureButton" parent="window_box/controls_box/h_box_container_2"] +visible = false +margin_right = 16.0 +margin_bottom = 16.0 +hint_tooltip = "JUKEBOX_PREVIOUS" +texture_normal = ExtResource( 2 ) +__meta__ = { +"_editor_description_": "" +} + +[node name="pause" type="TextureButton" parent="window_box/controls_box/h_box_container_2"] +visible = false +margin_right = 16.0 +margin_bottom = 16.0 +hint_tooltip = "JUKEBOX_PAUSE" +texture_normal = ExtResource( 4 ) + +[node name="play" type="TextureButton" parent="window_box/controls_box/h_box_container_2"] +visible = false +margin_right = 16.0 +margin_bottom = 16.0 +hint_tooltip = "JUKEBOX_PLAY" +texture_normal = ExtResource( 1 ) + +[node name="next" type="TextureButton" parent="window_box/controls_box/h_box_container_2"] +visible = false margin_left = 20.0 margin_right = 36.0 margin_bottom = 16.0 -texture_normal = ExtResource( 4 ) - -[node name="play" type="TextureButton" parent="window_box/controls_box"] -margin_left = 40.0 -margin_right = 56.0 -margin_bottom = 16.0 -texture_normal = ExtResource( 1 ) - -[node name="next" type="TextureButton" parent="window_box/controls_box"] -margin_left = 60.0 -margin_right = 76.0 -margin_bottom = 16.0 +hint_tooltip = "JUKEBOX_NEXT" texture_normal = ExtResource( 3 ) +[node name="h_box_container_3" type="HBoxContainer" parent="window_box/controls_box"] +margin_left = 385.0 +margin_right = 401.0 +margin_bottom = 16.0 +size_flags_horizontal = 6 + +[node name="soundeffect" type="TextureButton" parent="window_box/controls_box/h_box_container_3"] +visible = false +margin_right = 16.0 +margin_bottom = 40.0 +hint_tooltip = "JUKEBOX_SOUND_EFFECT" +texture_normal = ExtResource( 6 ) + +[node name="music" type="TextureButton" parent="window_box/controls_box/h_box_container_3"] +visible = false +margin_right = 16.0 +margin_bottom = 40.0 +hint_tooltip = "JUKEBOX_MUSIC" +texture_normal = ExtResource( 7 ) + +[node name="auto" type="TextureButton" parent="window_box/controls_box/h_box_container_3"] +margin_right = 16.0 +margin_bottom = 16.0 +hint_tooltip = "JUKEBOX_AUTO" +texture_normal = ExtResource( 9 ) + [node name="scroll_box" type="ScrollContainer" parent="window_box"] margin_top = 20.0 -margin_right = 256.0 -margin_bottom = 128.0 +margin_right = 470.0 +margin_bottom = 173.0 size_flags_horizontal = 3 size_flags_vertical = 3 [node name="musics_box" type="VBoxContainer" parent="window_box/scroll_box"] -margin_left = 128.0 -margin_right = 128.0 -size_flags_horizontal = 6 -size_flags_vertical = 2 +margin_right = 470.0 +margin_bottom = 153.0 +size_flags_horizontal = 7 +size_flags_vertical = 3 [node name="music" type="AudioStreamPlayer" parent="."] + +[connection signal="musicplayer_pressed" from="." to="." method="_on_music_manager_musicplayer_pressed"] +[connection signal="mute_pressed" from="." to="." method="_on_music_manager_mute_pressed"] +[connection signal="files_selected" from="file_dialog" to="." method="_on_file_dialog_files_selected"] +[connection signal="pressed" from="window_box/controls_box/h_box_container_4/add" to="." method="_on_add_pressed"] +[connection signal="pressed" from="window_box/controls_box/h_box_container/mute" to="." method="_on_mute_pressed"] +[connection signal="pressed" from="window_box/controls_box/h_box_container_2/previous" to="." method="_on_previous_pressed"] +[connection signal="pressed" from="window_box/controls_box/h_box_container_2/pause" to="." method="_on_pause_pressed"] +[connection signal="pressed" from="window_box/controls_box/h_box_container_2/play" to="." method="_on_play_pressed"] +[connection signal="pressed" from="window_box/controls_box/h_box_container_2/next" to="." method="_on_next_pressed"] +[connection signal="pressed" from="window_box/controls_box/h_box_container_3/soundeffect" to="." method="_on_soundeffect_pressed"] +[connection signal="pressed" from="window_box/controls_box/h_box_container_3/music" to="." method="_on_music_pressed"] +[connection signal="pressed" from="window_box/controls_box/h_box_container_3/auto" to="." method="_on_auto_pressed"] diff --git a/scenes/interfaces/options/option_info.gd b/scenes/interfaces/options/option_info.gd index fac0803..95a685c 100644 --- a/scenes/interfaces/options/option_info.gd +++ b/scenes/interfaces/options/option_info.gd @@ -18,12 +18,10 @@ func read_license(key): return true return false + func load_license(): var current_locale = TranslationServer.get_locale() var root_language = current_locale.split('_')[0] - var file = File.new() - var filenews = "" - if read_license(current_locale): pass elif read_license(root_language): @@ -31,6 +29,7 @@ func load_license(): elif read_license(""): pass + func read_authors(key): var file = File.new() var filenews = "" @@ -51,16 +50,13 @@ func read_authors(key): func load_authors(): var current_locale = TranslationServer.get_locale() var root_language = current_locale.split('_')[0] - var file = File.new() - var filenews = "" - if read_authors(current_locale): pass elif read_authors(root_language): pass elif read_authors(""): pass - + # Called when the node enters the scene tree for the first time. func _ready(): diff --git a/scenes/interfaces/options/option_language.gd b/scenes/interfaces/options/option_language.gd index e776457..80214f0 100644 --- a/scenes/interfaces/options/option_language.gd +++ b/scenes/interfaces/options/option_language.gd @@ -34,12 +34,10 @@ func _ready(): func _on_option_button_item_selected(index): - var id = 0 for key in TranslationServer.get_loaded_locales(): - if id == $window_dialog/margin_container/v_box_container/option_button.get_selected(): + if index == $window_dialog/margin_container/v_box_container/option_button.get_selected(): TranslationServer.set_locale(key) return - id += 1 func _on_button_pressed(): diff --git a/scenes/interfaces/options/option_news.gd b/scenes/interfaces/options/option_news.gd index e95436d..68f2557 100644 --- a/scenes/interfaces/options/option_news.gd +++ b/scenes/interfaces/options/option_news.gd @@ -28,9 +28,6 @@ func read_news(key): func load_news(): var current_locale = TranslationServer.get_locale() var root_language = current_locale.split('_')[0] - var file = File.new() - var filenews = "" - if read_news(current_locale): pass elif read_news(root_language): diff --git a/scenes/interfaces/options/option_settings.gd b/scenes/interfaces/options/option_settings.gd index baaa5b2..4aac741 100644 --- a/scenes/interfaces/options/option_settings.gd +++ b/scenes/interfaces/options/option_settings.gd @@ -1,10 +1,15 @@ extends Control signal mute_pressed +signal musicplayer_pressed -var slots_number = 0 -var slots = {} +onready var audiodevice_list = get_node("window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_7/audiodevice") + +#var slots_number = 0 +#var slots = {} var firstime = false +var disable_execution_mute:bool = false + # Called when the node enters the scene tree for the first time. func _ready(): @@ -62,23 +67,48 @@ func _ready(): # Mute #$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_2/mute.pressed = Config.mute update_mute() + # List audio device + for item in AudioServer.get_device_list(): + $window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_7/audiodevice.add_item(item) + #audiodevice_list.add_item(item) + var device = AudioServer.get_device() + for i in range(audiodevice_list.get_item_count()): + if device == audiodevice_list.get_item_text(i): + audiodevice_list.select(i) + break + MusicManager.connect("musicplayer_pressed", self, "_on_signal_musicplayer_pressed") + #$option.connect("mute_pressed", self, "update_mute") + MusicManager.connect("mute_pressed", self, "_on_signal_mute_pressed") + MusicManager.connect_ext("musicplayer_pressed", self ) + MusicManager.connect_ext("mute_pressed", self ) + + +func connect_ext( signal_name, target): + Config.msg_debug("Connect external [signal:" + signal_name + ", func:" + "_on_signal_" + signal_name + "]") + target.connect( signal_name, self, "_on_signal_" + signal_name ) + func update_mute(): Config.msg_debug("") $window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_2/mute.pressed = Config.mute + func _on_fullscreen_toggled(button_pressed): Config.set_window_fullscreen(button_pressed) + func _on_borderless_toggled(button_pressed): Config.set_window_borderless(button_pressed) + func _on_resizable_toggled(button_pressed): Config.set_window_resizable(button_pressed) + func _on_window_maximized_toggled(button_pressed): Config.set_window_maximized(button_pressed) + func _on_screen_value_changed(value): Config.set_current_screen(value) @@ -90,6 +120,7 @@ func _on_screen_value_changed(value): # SCREEN_ORIENTATION_SENSOR_PORTRAIT = 5 Uses portrait or reverse portrait based on the hardware sensor. # SCREEN_ORIENTATION_SENSOR = 6 Uses most suitable orientation based on + func _on_orientation_value_changed(value): # display/window/handheld/orientation #print(OS.screen_orientation) @@ -101,43 +132,10 @@ func _on_orientation_value_changed(value): Config.set_screen_orientation(value) #OS.set_screen_orientation(value) + func _on_always_on_top_toggled(button_pressed): Config.set_window_always_on_top(button_pressed) -func _on_add_music_pressed(): - pass # Replace with function body. - $file_dialog.show() - - -func _on_file_dialog_files_selected(paths): - print("multi files") - for path in paths: - var found = false - for slot in self.slots: - if self.slots[slot].music_filename == path: - found = true - continue - if found: - continue - var music_box = preload( "res://scenes/interfaces/options/option_settings_music_box.tscn" ).instance() - music_box.get_node( "label" ).text = path - #music_box.enable.pressed = true - #music_box.zone = "All" - music_box.slot = self.slots_number - music_box.music_filename = path - #creature_box.connect( "select_pressed", self, "_on_creature_box_select_pressed" ) - music_box.connect( "delete_pressed", self, "_on_music_box_delete_pressed" ) - $window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/scroll_container/list_music.add_child(music_box) - MusicManager.add_music(path) - self.slots[ self.slots_number ] = music_box - self.slots_number += 1 - -func _on_music_box_delete_pressed( slot ): - if self.slots[ slot ].music_filename: - #var dir = Directory.new() - #dir.remove( "user://creatures/" + self.slots[ slot ].creature_filename ) - pass - self.slots[ slot ].queue_free() func _on_default_toggled(button_pressed): if button_pressed: @@ -150,36 +148,78 @@ func _on_default_toggled(button_pressed): Config.disable_window_default() Config.set_video_default(button_pressed) + func _on_font_value_changed(value): - var valueint = int(value) - Config.set_font_size(value) + Config.set_font_size(int(value)) + func _on_sound_lvl_global_value_changed(value): MusicManager.set_level_global(int(value)) + func _on_sound_lvl_music_value_changed(value): MusicManager.set_level_music(int(value)) + func _on_sound_lvl_effect_value_changed(value): MusicManager.set_level_effect(int(value)) + func _on_ok_pressed(): $file_dialog.hide() $window_dialog.hide() Config.save_config() + func _on_window_dialog_hide(): $file_dialog.hide() if firstime: Config.save_config() + func _on_window_dialog_draw(): firstime = true + func _on_mute_toggled(button_pressed): - Config.msg_debug("") + Config.msg_debug("Option/Setting push mute") + if self.disable_execution_mute: + return MusicManager.set_sound_mute(button_pressed) emit_signal( "mute_pressed" ) -#func _on_control_mute_pressed(): -# update_mute() + +func _on_button_pressed(): + MusicManager.open() + + +func _on_musicplayer_pressed(): + Config.msg_debug("") + Config.set_playermusic(not Config.get_playermusic()) + Config.save_config() + emit_signal( "musicplayer_pressed") + + +func _on_audiodevice_item_selected(index): + Config.msg_debug("TODO") + + +func _on_control_musicplayer_pressed(): + Config.msg_debug("Option/setting signal received musicplayer") + + +func _on_control_mute_pressed(): + Config.msg_debug("