-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
181 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,20 +3,20 @@ | |
*Author : LZ | ||
*Date: 2020.2.20 | ||
*Email: [email protected] | ||
*1.1.9.4 | ||
*/ | ||
|
||
#include "UserInformation.h" | ||
#include "GlobalVariable.h" | ||
|
||
const string UserInformation::_clientEdition = "9.9.9.9"; | ||
string UserInformation::_editionName = ""; | ||
bool UserInformation::_updateRequired = false; | ||
DWORD UserInformation::_screenDisplayFrequency = 0; | ||
|
||
UserInformation::UserInformation(): | ||
_isUpdate(false) | ||
, _userName("·ßŵÄС½©Ê¬") | ||
, _userCaveFileNameKey{ "USERNAMEDATA","USERNAMEDATA_2","USERNAMEDATA_3","USERNAMEDATA_4","USERNAMEDATA_5","USERNAMEDATA_6","USERNAMEDATA_7","USERNAMEDATA_8" } | ||
, _systemCaveFileName_difficult{ "WORLD_%d_LEVELS","WORLD_%d_LEVELS_2","WORLD_%d_LEVELS_3","WORLD_%d_LEVELS_4","WORLD_%d_LEVELS_5","WORLD_%d_LEVELS_6","WORLD_%d_LEVELS_7","WORLD_%d_LEVELS_8" } | ||
, _systemCaveFileName{ "WORLD_%d_LEVELS_DIF","WORLD_%d_LEVELS_2_DIF","WORLD_%d_LEVELS_3_DIF","WORLD_%d_LEVELS_4_DIF","WORLD_%d_LEVELS_5_DIF","WORLD_%d_LEVELS_6_DIF","WORLD_%d_LEVELS_7_DIF","WORLD_%d_LEVELS_8_DIF" } | ||
, _userName("") | ||
, _soundEffectVolume(0.5f) | ||
, _backGroundMusicVolume(0.2f) | ||
, _userCaveFileNumber(0) | ||
|
@@ -40,6 +40,16 @@ UserInformation::UserInformation(): | |
, _stretchingShow(CheckBox::EventType::SELECTED) | ||
, _selectWorldName(WorldName::Mordern) | ||
{ | ||
string keyName[] = { "USERNAMEDATA","USERNAMEDATA_2","USERNAMEDATA_3","USERNAMEDATA_4","USERNAMEDATA_5","USERNAMEDATA_6","USERNAMEDATA_7","USERNAMEDATA_8" }; | ||
string fileName[] = { "WORLD_%d_LEVELS","WORLD_%d_LEVELS_2","WORLD_%d_LEVELS_3","WORLD_%d_LEVELS_4","WORLD_%d_LEVELS_5","WORLD_%d_LEVELS_6","WORLD_%d_LEVELS_7","WORLD_%d_LEVELS_8" }; | ||
string dfileName[] = { "WORLD_%d_LEVELS_DIF","WORLD_%d_LEVELS_2_DIF","WORLD_%d_LEVELS_3_DIF","WORLD_%d_LEVELS_4_DIF","WORLD_%d_LEVELS_5_DIF","WORLD_%d_LEVELS_6_DIF","WORLD_%d_LEVELS_7_DIF","WORLD_%d_LEVELS_8_DIF" }; | ||
|
||
for (int i = 0; i < 8; ++i) | ||
{ | ||
_userCaveFileNameKey[i] = keyName[i]; | ||
_systemCaveFileName_difficult[i] = fileName[i]; | ||
_systemCaveFileName[i] = dfileName[i]; | ||
} | ||
} | ||
|
||
UserInformation::~UserInformation() | ||
|
@@ -87,6 +97,11 @@ CheckBox::EventType UserInformation::getIsEaseAnimation() const | |
return _easeAnimation; | ||
} | ||
|
||
CheckBox::EventType UserInformation::getIsVerticalSynchronization() const | ||
{ | ||
return _verticalSynchronization; | ||
} | ||
|
||
map<string, spSkeletonData*>& UserInformation::getAnimationData() | ||
{ | ||
return _animationData; | ||
|
@@ -282,9 +297,15 @@ void UserInformation::setUpdateRequired(const bool updateRequired) | |
|
||
DWORD UserInformation::getScreenDisplayFrequency() | ||
{ | ||
DEVMODE dm; | ||
::EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm); | ||
return dm.dmDisplayFrequency; | ||
if (!_screenDisplayFrequency || | ||
Global::getInstance()->userInformation->getIsSelectFullScreen() == cocos2d::ui::CheckBox::EventType::UNSELECTED) | ||
{ | ||
DEVMODE dm; | ||
dm.dmSize = sizeof(DEVMODE); | ||
::EnumDisplaySettings(nullptr, ENUM_CURRENT_SETTINGS, &dm); | ||
_screenDisplayFrequency = dm.dmDisplayFrequency; | ||
} | ||
return _screenDisplayFrequency; | ||
} | ||
|
||
void UserInformation::setGameDifficulty(const int difficulty) | ||
|
@@ -429,6 +450,11 @@ void UserInformation::setIsEaseAnimation(CheckBox::EventType easeAnimation) | |
_easeAnimation = easeAnimation; | ||
} | ||
|
||
void UserInformation::setIsVerticalSynchronization(CheckBox::EventType verticalSynchronization) | ||
{ | ||
_verticalSynchronization = verticalSynchronization; | ||
} | ||
|
||
void UserInformation::setIsMirrorScene(const bool isMirror) | ||
{ | ||
_isMirrorScene = isMirror; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,9 @@ | |
*Emal: [email protected] | ||
*/ | ||
|
||
#include "Based/LevelData.h" | ||
#include "LoadingScene.h" | ||
#include "tinyxml2/tinyxml2.h" | ||
#include "Based/LevelData.h" | ||
#include "Based/UserInformation.h" | ||
#include "Based/PlayMusic.h" | ||
#include "AudioEngine.h" | ||
|
@@ -72,9 +72,6 @@ void LoadingScene::loadUserData() | |
{ | ||
auto userdefault = UserDefault::getInstance(); | ||
|
||
_userData->createNewUserDataDocument(); | ||
loadUserFileData(); | ||
|
||
/* 读取用户存档名称 */ | ||
for (int i = 0; i < 8; i++) | ||
{ | ||
|
@@ -92,6 +89,9 @@ void LoadingScene::loadUserData() | |
_global->userInformation->setUserName(_global->userInformation->getUserCaveFileName(_global->userInformation->getUserCaveFileNumber())); | ||
_global->userInformation->setIsUpdate(true); | ||
|
||
_userData->createNewUserDataDocument(); | ||
loadUserFileData(); | ||
|
||
/* 显示信息 */ | ||
switch (userdefault->getBoolForKey("SHOWINFORMATION")) | ||
{ | ||
|
@@ -105,31 +105,29 @@ void LoadingScene::loadUserData() | |
break; | ||
} | ||
|
||
/* 是否全屏 */ | ||
switch (userdefault->getBoolForKey("SHOWFULLSCREEN")) | ||
/* 是否高帧率 */ | ||
switch (userdefault->getBoolForKey("SHOWHIGHFPS")) | ||
{ | ||
case true: | ||
((GLViewImpl*)_director->getOpenGLView())->setFullscreen(); | ||
_global->userInformation->setIsSelectFullScreen(cocos2d::ui::CheckBox::EventType::SELECTED); | ||
_director->setAnimationInterval(1.0f / UserInformation::getScreenDisplayFrequency()); | ||
_global->userInformation->setIsSelectHighFPS(cocos2d::ui::CheckBox::EventType::SELECTED); | ||
break; | ||
case false: | ||
((GLViewImpl*)_director->getOpenGLView())->setWindowed(1280, 720); | ||
_global->userInformation->setIsSelectFullScreen(cocos2d::ui::CheckBox::EventType::UNSELECTED); | ||
_director->setAnimationInterval(1.0f / 45); | ||
_global->userInformation->setIsSelectHighFPS(cocos2d::ui::CheckBox::EventType::UNSELECTED); | ||
break; | ||
} | ||
|
||
/* 是否高帧率 */ | ||
switch (userdefault->getBoolForKey("SHOWHIGHFPS")) | ||
/* 是否全屏 */ | ||
switch (userdefault->getBoolForKey("SHOWFULLSCREEN")) | ||
{ | ||
case true: | ||
_director->setAnimationInterval(1.0f / UserInformation::getScreenDisplayFrequency()); | ||
_global->userInformation->setIsSelectHighFPS(cocos2d::ui::CheckBox::EventType::SELECTED); | ||
_global->userInformation->setFps(60); | ||
((GLViewImpl*)_director->getOpenGLView())->setFullscreen(); | ||
_global->userInformation->setIsSelectFullScreen(cocos2d::ui::CheckBox::EventType::SELECTED); | ||
break; | ||
case false: | ||
_director->setAnimationInterval(1.0f / 45); | ||
_global->userInformation->setIsSelectHighFPS(cocos2d::ui::CheckBox::EventType::UNSELECTED); | ||
_global->userInformation->setFps(45); | ||
((GLViewImpl*)_director->getOpenGLView())->setWindowed(1280, 720); | ||
_global->userInformation->setIsSelectFullScreen(cocos2d::ui::CheckBox::EventType::UNSELECTED); | ||
break; | ||
} | ||
|
||
|
@@ -146,6 +144,19 @@ void LoadingScene::loadUserData() | |
break; | ||
} | ||
|
||
/* 是否垂直同步 */ | ||
switch (userdefault->getBoolForKey("VERTICALSYNCHRONIZATION")) | ||
{ | ||
case true: | ||
wglSwapIntervalEXT(1); | ||
_global->userInformation->setIsVerticalSynchronization(CheckBox::EventType::SELECTED); | ||
break; | ||
case false: | ||
_global->userInformation->setIsVerticalSynchronization(CheckBox::EventType::UNSELECTED); | ||
wglSwapIntervalEXT(0); | ||
break; | ||
} | ||
|
||
/* 是否隐藏鼠标 */ | ||
_global->userInformation->setIsSelectCursorNotHide(_userData->openBoolUserData("CURSORHIDE") ? | ||
cocos2d::ui::CheckBox::EventType::SELECTED : cocos2d::ui::CheckBox::EventType::UNSELECTED); | ||
|
@@ -157,6 +168,15 @@ void LoadingScene::loadUserData() | |
|
||
void LoadingScene::loadUserFileData() | ||
{ | ||
if (Global::getInstance()->userInformation->getUserName() == "未命名存档") | ||
{ | ||
UserDefault::getInstance()->setFloatForKey("SOUNDEFFECT", 0.5f); | ||
UserDefault::getInstance()->setFloatForKey("GLOBALMUSIC", 0.2f); | ||
UserDefault::getInstance()->setBoolForKey("SHOWFULLSCREEN", true); | ||
UserDefault::getInstance()->setBoolForKey("SHOWHIGHFPS", true); | ||
UserDefault::getInstance()->setBoolForKey("SHOWINFORMATION", true); | ||
} | ||
|
||
Global::getInstance()->userInformation->setUserCaveFileNumber(UserDefault::getInstance()->getIntegerForKey("USERDATANUMBER")); /* 存档编号 */ | ||
Global::getInstance()->userInformation->setSoundEffectVolume(UserDefault::getInstance()->getFloatForKey("SOUNDEFFECT")); /* 音效 */ | ||
Global::getInstance()->userInformation->setBackGroundMusicVolume(UserDefault::getInstance()->getFloatForKey("GLOBALMUSIC")); /* 音乐 */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.