mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2025-10-09 17:55:28 +00:00
[engine] [cocos2d-x] [jsb-adapter] 适配引擎 v2.4.10 版本
This commit is contained in:
@@ -360,6 +360,7 @@ void AudioEngine::onPause(const CustomEvent &event) {
|
||||
if (it->second.state == AudioState::PLAYING)
|
||||
{
|
||||
_audioEngineImpl->pause(it->first);
|
||||
it->second.state = AudioState::PAUSED;
|
||||
_breakAudioID.push_back(it->first);
|
||||
}
|
||||
}
|
||||
@@ -374,7 +375,12 @@ void AudioEngine::onPause(const CustomEvent &event) {
|
||||
void AudioEngine::onResume(const CustomEvent &event) {
|
||||
auto itEnd = _breakAudioID.end();
|
||||
for (auto it = _breakAudioID.begin(); it != itEnd; ++it) {
|
||||
_audioEngineImpl->resume(*it);
|
||||
auto iter = _audioIDInfoMap.find(*it);
|
||||
if (iter != _audioIDInfoMap.end() && iter->second.state == AudioState::PAUSED)
|
||||
{
|
||||
_audioEngineImpl->resume(*it);
|
||||
iter->second.state = AudioState::PLAYING;
|
||||
}
|
||||
}
|
||||
_breakAudioID.clear();
|
||||
|
||||
|
@@ -32,7 +32,7 @@ NS_CC_BEGIN
|
||||
|
||||
CC_DLL const char* cocos2dVersion()
|
||||
{
|
||||
return "2.4.9";
|
||||
return "2.4.10-rc.1";
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
@@ -853,7 +853,10 @@ void WebSocketImpl::close()
|
||||
|
||||
void WebSocketImpl::closeAsync(int code, const std::string &reason)
|
||||
{
|
||||
lws_close_reason(_wsInstance, (lws_close_status)code, (unsigned char*)const_cast<char*>(reason.c_str()), reason.length());
|
||||
if (_wsInstance)
|
||||
{
|
||||
lws_close_reason(_wsInstance, (lws_close_status)code, (unsigned char*)const_cast<char*>(reason.c_str()), reason.length());
|
||||
}
|
||||
closeAsync();
|
||||
}
|
||||
|
||||
|
@@ -46,6 +46,7 @@ import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.Vibrator;
|
||||
import android.os.LocaleList;
|
||||
import android.preference.PreferenceManager.OnActivityResultListener;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
@@ -304,11 +305,19 @@ public class Cocos2dxHelper {
|
||||
}
|
||||
|
||||
public static String getCurrentLanguage() {
|
||||
return Locale.getDefault().getLanguage();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
return LocaleList.getDefault().get(0).getLanguage();
|
||||
} else {
|
||||
return Locale.getDefault().getLanguage();
|
||||
}
|
||||
}
|
||||
|
||||
public static String getCurrentLanguageCode() {
|
||||
return Locale.getDefault().toString();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
return LocaleList.getDefault().get(0).getLanguage();
|
||||
} else {
|
||||
return Locale.getDefault().getLanguage();
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDeviceModel(){
|
||||
|
@@ -478,13 +478,32 @@ static bool WebSocket_close(se::State& s)
|
||||
}
|
||||
else if (argc == 2)
|
||||
{
|
||||
assert(args[0].isNumber());
|
||||
assert(args[1].isString());
|
||||
int reasonCode;
|
||||
std::string reasonString;
|
||||
seval_to_int32(args[0], &reasonCode);
|
||||
seval_to_std_string(args[1], &reasonString);
|
||||
cobj->closeAsync(reasonCode, reasonString);
|
||||
if (args[0].isNumber()) {
|
||||
int reasonCode;
|
||||
if (args[1].isString()) {
|
||||
std::string reasonString;
|
||||
seval_to_int32(args[0], &reasonCode);
|
||||
seval_to_std_string(args[1], &reasonString);
|
||||
cobj->closeAsync(reasonCode, reasonString);
|
||||
} else if (args[1].isNullOrUndefined()) {
|
||||
seval_to_int32(args[0], &reasonCode);
|
||||
cobj->closeAsync(reasonCode, "no_reason");
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
} else if (args[0].isNullOrUndefined()) {
|
||||
if (args[1].isString()) {
|
||||
std::string reasonString;
|
||||
seval_to_std_string(args[1], &reasonString);
|
||||
cobj->closeAsync(1005, reasonString);
|
||||
} else if (args[1].isNullOrUndefined()) {
|
||||
cobj->closeAsync();
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user