mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2025-11-24 01:47:34 +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
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cocos2d-x-lite",
|
||||
"version": "2.4.9",
|
||||
"version": "2.4.10-rc.1",
|
||||
"description": "Cocos2d-x, compact version",
|
||||
"main": "gulpfile.js",
|
||||
"devDependencies": {
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
android:label="@string/app_name"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:launchMode="singleTask"
|
||||
android:taskAffinity=""
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -37,15 +37,6 @@ public class AppActivity extends Cocos2dxActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Workaround in
|
||||
// https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
|
||||
if (!isTaskRoot()) {
|
||||
// Android launched another instance of the root activity into an existing task
|
||||
// so just quietly finish and go away, dropping the user back into the activity
|
||||
// at the top of the stack (ie: the last state of this task)
|
||||
// Don't need to finish it again since it's finished in super.onCreate .
|
||||
return;
|
||||
}
|
||||
// DO OTHER INITIALIZATION BELOW
|
||||
SDKWrapper.getInstance().init(this);
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
android:label="@string/app_name"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:launchMode="singleTask"
|
||||
android:taskAffinity=""
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -37,15 +37,6 @@ public class AppActivity extends Cocos2dxActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Workaround in
|
||||
// https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
|
||||
if (!isTaskRoot()) {
|
||||
// Android launched another instance of the root activity into an existing task
|
||||
// so just quietly finish and go away, dropping the user back into the activity
|
||||
// at the top of the stack (ie: the last state of this task)
|
||||
// Don't need to finish it again since it's finished in super.onCreate .
|
||||
return;
|
||||
}
|
||||
// DO OTHER INITIALIZATION BELOW
|
||||
SDKWrapper.getInstance().init(this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user