Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile
Commits
ffd9a43b
Commit
ffd9a43b
authored
Nov 15, 2019
by
Unicorn369
Committed by
fallenstardust
Dec 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
cb8715a6
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
256 additions
and
123 deletions
+256
-123
Classes/gframe/deck_con.cpp
Classes/gframe/deck_con.cpp
+39
-32
Classes/gframe/drawing.cpp
Classes/gframe/drawing.cpp
+1
-0
Classes/gframe/duelclient.cpp
Classes/gframe/duelclient.cpp
+74
-26
Classes/gframe/event_handler.cpp
Classes/gframe/event_handler.cpp
+66
-33
Classes/gframe/game.cpp
Classes/gframe/game.cpp
+14
-10
Classes/gframe/menu_handler.cpp
Classes/gframe/menu_handler.cpp
+26
-21
Classes/gframe/sound_manager.cpp
Classes/gframe/sound_manager.cpp
+30
-1
Classes/gframe/sound_manager.h
Classes/gframe/sound_manager.h
+6
-0
No files found.
Classes/gframe/deck_con.cpp
View file @
ffd9a43b
This diff is collapsed.
Click to expand it.
Classes/gframe/drawing.cpp
View file @
ffd9a43b
...
...
@@ -1135,6 +1135,7 @@ void Game::HideElement(irr::gui::IGUIElement * win, bool set_action) {
fadingList
.
push_back
(
fu
);
}
void
Game
::
PopupElement
(
irr
::
gui
::
IGUIElement
*
element
,
int
hideframe
)
{
mainGame
->
soundManager
->
PlayDialogSound
(
element
);
element
->
getParent
()
->
bringToFront
(
element
);
if
(
!
is_building
)
dField
.
panel
=
element
;
...
...
Classes/gframe/duelclient.cpp
View file @
ffd9a43b
This diff is collapsed.
Click to expand it.
Classes/gframe/event_handler.cpp
View file @
ffd9a43b
This diff is collapsed.
Click to expand it.
Classes/gframe/game.cpp
View file @
ffd9a43b
...
...
@@ -81,8 +81,8 @@ bool Game::Initialize() {
setPositionFix
(
appPosition
);
device
->
setProcessReceiver
(
this
);
soundEffectPlayer
=
new
AndroidSoundEffectPlayer
(
app
);
soundEffectPlayer
->
setSEEnabled
(
options
->
isSoundEffectEnabled
());
//
soundEffectPlayer = new AndroidSoundEffectPlayer(app);
//
soundEffectPlayer->setSEEnabled(options->isSoundEffectEnabled());
app
->
onInputEvent
=
android
::
handleInput
;
ILogger
*
logger
=
device
->
getLogger
();
// logger->setLogLevel(ELL_WARNING);
...
...
@@ -433,7 +433,7 @@ bool Game::Initialize() {
scrSoundVolume
=
env
->
addScrollBar
(
true
,
rect
<
s32
>
(
posX
+
110
*
xScale
,
posY
,
posX
+
250
*
xScale
,
posY
+
30
*
yScale
),
tabHelper
,
SCROLL_VOLUME
);
scrSoundVolume
->
setMax
(
100
);
scrSoundVolume
->
setMin
(
0
);
scrSoundVolume
->
setPos
(
gameConf
.
sound_volume
*
100
);
scrSoundVolume
->
setPos
(
gameConf
.
sound_volume
);
scrSoundVolume
->
setLargeStep
(
1
);
scrSoundVolume
->
setSmallStep
(
1
);
posY
+=
60
;
...
...
@@ -442,7 +442,7 @@ bool Game::Initialize() {
scrMusicVolume
=
env
->
addScrollBar
(
true
,
rect
<
s32
>
(
posX
+
110
*
xScale
,
posY
,
posX
+
250
*
xScale
,
posY
+
30
*
yScale
),
tabHelper
,
SCROLL_VOLUME
);
scrMusicVolume
->
setMax
(
100
);
scrMusicVolume
->
setMin
(
0
);
scrMusicVolume
->
setPos
(
gameConf
.
music_volume
*
100
);
scrMusicVolume
->
setPos
(
gameConf
.
music_volume
);
scrMusicVolume
->
setLargeStep
(
1
);
scrMusicVolume
->
setSmallStep
(
1
);
elmTabHelperLast
=
chkEnableMusic
;
...
...
@@ -959,7 +959,7 @@ bool Game::Initialize() {
btnCancelOrFinish
=
env
->
addButton
(
rect
<
s32
>
(
205
*
xScale
,
220
*
yScale
,
305
*
xScale
,
275
*
yScale
),
0
,
BUTTON_CANCEL_OR_FINISH
,
dataManager
.
GetSysString
(
1295
));
btnCancelOrFinish
->
setVisible
(
false
);
soundManager
=
Utils
::
make_unique
<
SoundManager
>
();
if
(
!
soundManager
->
Init
(
gameConf
.
sound_volume
,
gameConf
.
music_volume
,
gameConf
.
enable_sound
,
gameConf
.
enable_music
,
nullptr
))
{
if
(
!
soundManager
->
Init
(
(
double
)
gameConf
.
sound_volume
/
100
,
(
double
)
gameConf
.
music_volume
/
100
,
gameConf
.
enable_sound
,
gameConf
.
enable_music
,
nullptr
))
{
chkEnableSound
->
setChecked
(
false
);
chkEnableSound
->
setEnabled
(
false
);
chkEnableSound
->
setVisible
(
false
);
...
...
@@ -1226,7 +1226,7 @@ void Game::MainLoop() {
usleep
(
500000
);
#endif
SaveConfig
();
delete
soundEffectPlayer
;
//
delete soundEffectPlayer;
usleep
(
500000
);
// device->drop();
}
...
...
@@ -1526,10 +1526,10 @@ void Game::SaveConfig() {
gameConf
.
enable_music
=
chkEnableMusic
->
isChecked
()
?
1
:
0
;
android
::
saveIntSetting
(
appMain
,
"enable_music"
,
gameConf
.
enable_music
);
//gameConf.sound_volume =
//
android::saveIntSetting(appMain, "sound_volume", gameConf.sound_volume);
//gameConf.music_volume =
//
android::saveIntSetting(appMain, "music_volume", gameConf.music_volume);
gameConf
.
sound_volume
=
(
double
)
scrSoundVolume
->
getPos
();
android
::
saveIntSetting
(
appMain
,
"sound_volume"
,
gameConf
.
sound_volume
);
gameConf
.
music_volume
=
(
double
)
scrMusicVolume
->
getPos
();
android
::
saveIntSetting
(
appMain
,
"music_volume"
,
gameConf
.
music_volume
);
//gameConf.control_mode = control_mode->isChecked()?1:0;
// android::saveIntSetting(appMain, "control_mode", gameConf.control_mode);
...
...
@@ -1638,10 +1638,12 @@ void Game::AddChatMsg(const wchar_t* msg, int player) {
chatType
[
0
]
=
player
;
switch
(
player
)
{
case
0
:
//from host
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
CHAT
);
chatMsg
[
0
].
append
(
dInfo
.
hostname
);
chatMsg
[
0
].
append
(
L": "
);
break
;
case
1
:
//from client
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
CHAT
);
chatMsg
[
0
].
append
(
dInfo
.
clientname
);
chatMsg
[
0
].
append
(
L": "
);
break
;
...
...
@@ -1650,6 +1652,7 @@ void Game::AddChatMsg(const wchar_t* msg, int player) {
chatMsg
[
0
].
append
(
L": "
);
break
;
case
3
:
//client tag
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
CHAT
);
chatMsg
[
0
].
append
(
dInfo
.
clientname_tag
);
chatMsg
[
0
].
append
(
L": "
);
break
;
...
...
@@ -1658,6 +1661,7 @@ void Game::AddChatMsg(const wchar_t* msg, int player) {
chatMsg
[
0
].
append
(
L": "
);
break
;
case
8
:
//system custom message, no prefix.
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
CHAT
);
chatMsg
[
0
].
append
(
L"[System]: "
);
break
;
case
9
:
//error message
...
...
Classes/gframe/menu_handler.cpp
View file @
ffd9a43b
...
...
@@ -55,15 +55,19 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
switch
(
event
.
GUIEvent
.
EventType
)
{
case
irr
:
:
gui
::
EGET_BUTTON_CLICKED
:
{
if
(
id
<
110
)
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
else
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
switch
(
id
)
{
case
BUTTON_MODE_EXIT
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
SaveConfig
();
mainGame
->
device
->
closeDevice
();
break
;
}
case
BUTTON_LAN_MODE
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
...
...
@@ -92,6 +96,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int
status
=
evutil_getaddrinfo
(
hostname
,
port
,
&
hints
,
&
answer
);
if
(
status
!=
0
)
{
mainGame
->
gMutex
.
lock
();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1412
));
mainGame
->
gMutex
.
unlock
();
break
;
...
...
@@ -112,7 +117,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_JOIN_CANCEL
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
HideElement
(
mainGame
->
wLanWindow
);
mainGame
->
ShowElement
(
mainGame
->
wMainMenu
);
if
(
exit_on_return
)
...
...
@@ -120,12 +125,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_LAN_REFRESH
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
DuelClient
::
BeginRefreshHost
();
break
;
}
case
BUTTON_CREATE_HOST
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
btnHostConfirm
->
setEnabled
(
true
);
mainGame
->
btnHostCancel
->
setEnabled
(
true
);
mainGame
->
HideElement
(
mainGame
->
wLanWindow
);
...
...
@@ -133,7 +138,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_HOST_CONFIRM
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
bot_mode
=
false
;
BufferIO
::
CopyWStr
(
mainGame
->
ebServerName
->
getText
(),
mainGame
->
gameConf
.
gamename
,
20
);
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
...
...
@@ -147,7 +152,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_HOST_CANCEL
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
...
...
@@ -156,18 +161,18 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_HP_DUELIST
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
DuelClient
::
SendPacketToServer
(
CTOS_HS_TODUELIST
);
break
;
}
case
BUTTON_HP_OBSERVER
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
DuelClient
::
SendPacketToServer
(
CTOS_HS_TOOBSERVER
);
break
;
}
case
BUTTON_HP_KICK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
int
id
=
0
;
while
(
id
<
4
)
{
if
(
mainGame
->
btnHostPrepKick
[
id
]
==
caller
)
...
...
@@ -180,7 +185,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_HP_READY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
if
(
mainGame
->
cbCategorySelect
->
getSelected
()
==
-
1
||
mainGame
->
cbDeckSelect
->
getSelected
()
==
-
1
||
!
deckManager
.
LoadDeck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
))
{
break
;
...
...
@@ -192,19 +197,19 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_HP_NOTREADY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
DuelClient
::
SendPacketToServer
(
CTOS_HS_NOTREADY
);
mainGame
->
cbCategorySelect
->
setEnabled
(
true
);
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
break
;
}
case
BUTTON_HP_START
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
DuelClient
::
SendPacketToServer
(
CTOS_HS_START
);
break
;
}
case
BUTTON_HP_CANCEL
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
DuelClient
::
StopClient
();
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
...
...
@@ -223,7 +228,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_REPLAY_MODE
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
HideElement
(
mainGame
->
wMainMenu
);
mainGame
->
ShowElement
(
mainGame
->
wReplay
);
mainGame
->
ebRepStartTurn
->
setText
(
L"1"
);
...
...
@@ -232,7 +237,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_SINGLE_MODE
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
HideElement
(
mainGame
->
wMainMenu
);
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
mainGame
->
RefreshSingleplay
();
...
...
@@ -240,7 +245,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_LOAD_REPLAY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
if
(
mainGame
->
lstReplayList
->
getSelected
()
==
-
1
)
break
;
if
(
!
ReplayMode
::
cur_replay
.
OpenReplay
(
mainGame
->
lstReplayList
->
getListItem
(
mainGame
->
lstReplayList
->
getSelected
())))
...
...
@@ -293,7 +298,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_CANCEL_REPLAY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
HideElement
(
mainGame
->
wReplay
);
mainGame
->
ShowElement
(
mainGame
->
wMainMenu
);
break
;
...
...
@@ -406,7 +411,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_LOAD_SINGLEPLAY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
if
(
mainGame
->
lstSinglePlayList
->
getSelected
()
==
-
1
)
break
;
mainGame
->
singleSignal
.
SetNoWait
(
false
);
...
...
@@ -414,14 +419,14 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_CANCEL_SINGLEPLAY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
HideElement
(
mainGame
->
wSinglePlay
);
mainGame
->
ShowElement
(
mainGame
->
wMainMenu
);
break
;
}
case
BUTTON_DECK_EDIT
:
{
mainGame
->
RefreshCategoryDeck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
if
(
mainGame
->
cbDBCategory
->
getSelected
()
!=
-
1
&&
mainGame
->
cbDBDecks
->
getSelected
()
!=
-
1
)
{
deckManager
.
LoadDeck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
mainGame
->
ebDeckname
->
setText
(
L""
);
...
...
Classes/gframe/sound_manager.cpp
View file @
ffd9a43b
#include "sound_manager.h"
#include "config.h"
#include "game.h"
namespace
ygo
{
...
...
@@ -80,12 +81,40 @@ void SoundManager::PlaySoundEffect(SFX sound) {
{
DICE
,
"./sound/diceroll.wav"
},
{
NEXT_TURN
,
"./sound/nextturn.wav"
},
{
PHASE
,
"./sound/phase.wav"
},
{
BUTTON
,
"./sound/button.wav"
},
{
INFO
,
"./sound/info.wav"
},
{
QUESTION
,
"./sound/question.wav"
},
{
CARD_PICK
,
"./sound/cardpick.wav"
},
{
CARD_DROP
,
"./sound/carddrop.wav"
},
{
PLAYER_ENTER
,
"./sound/playerenter.wav"
},
{
CHAT
,
"./sound/chatmessage.wav"
}
};
if
(
!
soundsEnabled
)
return
;
if
(
sfx
)
sfx
->
play
(
fx
.
at
(
sound
),
false
);
}
void
SoundManager
::
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
)
{
if
(
element
==
mainGame
->
wMessage
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
}
else
if
(
element
==
mainGame
->
wQuery
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wSurrender
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wOptions
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wANAttribute
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wANCard
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wANNumber
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wANRace
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wReplaySave
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wFTSelect
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
}
void
SoundManager
::
PlayMusic
(
const
std
::
string
&
song
,
bool
loop
)
{
if
(
!
musicEnabled
)
return
;
StopBGM
();
...
...
@@ -98,7 +127,7 @@ void SoundManager::PlayBGM(BGM scene) {
bgm_scene
=
scene
;
int
bgm
=
(
std
::
uniform_int_distribution
<>
(
0
,
count
-
1
))(
rnd
);
std
::
string
BGMName
=
"./sound/BGM/"
+
list
[
bgm
];
PlayMusic
(
BGMName
,
tru
e
);
PlayMusic
(
BGMName
,
fals
e
);
}
}
void
SoundManager
::
StopBGM
()
{
...
...
Classes/gframe/sound_manager.h
View file @
ffd9a43b
...
...
@@ -32,6 +32,11 @@ public:
DICE
,
NEXT_TURN
,
PHASE
,
BUTTON
,
INFO
,
QUESTION
,
CARD_PICK
,
CARD_DROP
,
PLAYER_ENTER
,
CHAT
};
...
...
@@ -48,6 +53,7 @@ public:
bool
Init
(
double
sounds_volume
,
double
music_volume
,
bool
sounds_enabled
,
bool
music_enabled
,
void
*
payload
=
nullptr
);
void
RefreshBGMList
();
void
PlaySoundEffect
(
SFX
sound
);
void
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
);
void
PlayMusic
(
const
std
::
string
&
song
,
bool
loop
);
void
PlayBGM
(
BGM
scene
);
void
StopBGM
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment