[engine] [cocos2d-x] [jsb-adapter] 适配引擎 v2.4.10 版本

This commit is contained in:
SmallMain 2022-10-01 17:51:47 +08:00
parent 0740917436
commit e2077e59b5
31 changed files with 200 additions and 141 deletions

View File

@ -360,6 +360,7 @@ void AudioEngine::onPause(const CustomEvent &event) {
if (it->second.state == AudioState::PLAYING) if (it->second.state == AudioState::PLAYING)
{ {
_audioEngineImpl->pause(it->first); _audioEngineImpl->pause(it->first);
it->second.state = AudioState::PAUSED;
_breakAudioID.push_back(it->first); _breakAudioID.push_back(it->first);
} }
} }
@ -374,7 +375,12 @@ void AudioEngine::onPause(const CustomEvent &event) {
void AudioEngine::onResume(const CustomEvent &event) { void AudioEngine::onResume(const CustomEvent &event) {
auto itEnd = _breakAudioID.end(); auto itEnd = _breakAudioID.end();
for (auto it = _breakAudioID.begin(); it != itEnd; ++it) { 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(); _breakAudioID.clear();

View File

@ -32,7 +32,7 @@ NS_CC_BEGIN
CC_DLL const char* cocos2dVersion() CC_DLL const char* cocos2dVersion()
{ {
return "2.4.9"; return "2.4.10-rc.1";
} }
NS_CC_END NS_CC_END

View File

@ -853,7 +853,10 @@ void WebSocketImpl::close()
void WebSocketImpl::closeAsync(int code, const std::string &reason) 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(); closeAsync();
} }

View File

@ -46,6 +46,7 @@ import android.os.Build;
import android.os.Environment; import android.os.Environment;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import android.os.Vibrator; import android.os.Vibrator;
import android.os.LocaleList;
import android.preference.PreferenceManager.OnActivityResultListener; import android.preference.PreferenceManager.OnActivityResultListener;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
@ -304,11 +305,19 @@ public class Cocos2dxHelper {
} }
public static String getCurrentLanguage() { 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() { 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(){ public static String getDeviceModel(){

View File

@ -478,13 +478,32 @@ static bool WebSocket_close(se::State& s)
} }
else if (argc == 2) else if (argc == 2)
{ {
assert(args[0].isNumber()); if (args[0].isNumber()) {
assert(args[1].isString()); int reasonCode;
int reasonCode; if (args[1].isString()) {
std::string reasonString; std::string reasonString;
seval_to_int32(args[0], &reasonCode); seval_to_int32(args[0], &reasonCode);
seval_to_std_string(args[1], &reasonString); seval_to_std_string(args[1], &reasonString);
cobj->closeAsync(reasonCode, 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 else
{ {

View File

@ -1,6 +1,6 @@
{ {
"name": "cocos2d-x-lite", "name": "cocos2d-x-lite",
"version": "2.4.9", "version": "2.4.10-rc.1",
"description": "Cocos2d-x, compact version", "description": "Cocos2d-x, compact version",
"main": "gulpfile.js", "main": "gulpfile.js",
"devDependencies": { "devDependencies": {

View File

@ -25,7 +25,6 @@
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask" android:launchMode="singleTask"
android:taskAffinity=""
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@ -37,15 +37,6 @@ public class AppActivity extends Cocos2dxActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(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 // DO OTHER INITIALIZATION BELOW
SDKWrapper.getInstance().init(this); SDKWrapper.getInstance().init(this);

View File

@ -25,7 +25,6 @@
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask" android:launchMode="singleTask"
android:taskAffinity=""
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@ -37,15 +37,6 @@ public class AppActivity extends Cocos2dxActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(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 // DO OTHER INITIALIZATION BELOW
SDKWrapper.getInstance().init(this); SDKWrapper.getInstance().init(this);

View File

@ -148,6 +148,6 @@ For details below:
* [Official site](https://www.cocos.com/products#CocosCreator) * [Official site](https://www.cocos.com/products#CocosCreator)
* [Download](https://www.cocos.com/creator) * [Download](https://www.cocos.com/creator)
* [Documentation](https://docs.cocos.com/creator/manual/) * [Documentation](https://docs.cocos.com/creator/2.4/manual/)
* [API References](https://docs.cocos.com/creator/api/) * [API References](https://docs.cocos.com/creator/2.4/api/)
* [Forum](https://discuss.cocos2d-x.org/c/creator) * [Forum](https://discuss.cocos2d-x.org/c/creator)

25
engine/api.d.ts vendored
View File

@ -1,10 +1,21 @@
/** Running in the editor. */
declare let CC_JSB: boolean declare const CC_EDITOR: boolean;
declare let CC_NATIVERENDERER: boolean /** Preview in browser or simulator. */
declare let CC_EDITOR: boolean declare const CC_PREVIEW: boolean;
declare let CC_PREVIEW: boolean /** Running in the editor or preview. */
declare let CC_TEST: boolean declare const CC_DEV: boolean;
declare let CC_DEBUG: boolean /** Running in the editor or preview, or build in debug mode. */
declare const CC_DEBUG: boolean;
/** Running in published project. */
declare const CC_BUILD: boolean;
/** Running in native platforms (mobile app, desktop app, or simulator). */
declare const CC_JSB: boolean;
/** Running in runtime environments. */
declare const CC_RUNTIME: boolean;
/** Running in the engine's unit test. */
declare const CC_TEST: boolean;
/** Running in the WeChat Mini Game. */
declare const CC_WECHATGAME: boolean;
declare let cc: { declare let cc: {
// polyfills: { // polyfills: {

View File

@ -218,7 +218,7 @@ Tween.stopAllByTarget = function (target) {
* Insert an action or tween to this sequence * Insert an action or tween to this sequence
* !#zh * !#zh
* 插入一个 action 或者 tween 到队列中 * 插入一个 action 或者 tween 到队列中
* @method then * @method then
* @param {Action|Tween} other * @param {Action|Tween} other
* @return {Tween} * @return {Tween}
* @typescript then(other: Action|Tween<T>): Tween<T> * @typescript then(other: Action|Tween<T>): Tween<T>
@ -294,6 +294,7 @@ Tween.prototype.start = function () {
Tween.prototype.stop = function () { Tween.prototype.stop = function () {
if (this._finalAction) { if (this._finalAction) {
cc.director.getActionManager().removeAction(this._finalAction); cc.director.getActionManager().removeAction(this._finalAction);
this._finalAction = null;
} }
return this; return this;
}; };
@ -414,7 +415,7 @@ Object.assign(Tween.prototype, {
*/ */
flipX () { flipX () {
return this.call(() => { this._target.scaleX *= -1; }, this); return this.call(() => { this._target.scaleX *= -1; }, this);
}, },
/** /**
* !#en Flips target's scaleY * !#en Flips target's scaleY
@ -703,4 +704,4 @@ cc.tween = function (target) {
}; };
cc.Tween = Tween; cc.Tween = Tween;

View File

@ -845,7 +845,7 @@ cc.Director.prototype = {
// Update // Update
if (!this._paused) { if (!this._paused) {
this.emit(cc.Director.EVENT_BEFORE_UPDATE); this.emit(cc.Director.EVENT_BEFORE_UPDATE, deltaTime);
this._compScheduler.startPhase(); this._compScheduler.startPhase();
this._compScheduler.updatePhase(deltaTime); this._compScheduler.updatePhase(deltaTime);
@ -856,15 +856,15 @@ cc.Director.prototype = {
this._compScheduler.lateUpdatePhase(deltaTime); this._compScheduler.lateUpdatePhase(deltaTime);
this.emit(cc.Director.EVENT_AFTER_UPDATE); this.emit(cc.Director.EVENT_AFTER_UPDATE, deltaTime);
} }
// Render // Render
this.emit(cc.Director.EVENT_BEFORE_DRAW); this.emit(cc.Director.EVENT_BEFORE_DRAW, deltaTime);
renderer.render(this._scene, deltaTime); renderer.render(this._scene, deltaTime);
// After draw // After draw
this.emit(cc.Director.EVENT_AFTER_DRAW); this.emit(cc.Director.EVENT_AFTER_DRAW, deltaTime);
this._totalFrames++; this._totalFrames++;
@ -877,35 +877,36 @@ cc.Director.prototype = {
// calculate "global" dt // calculate "global" dt
this.calculateDeltaTime(now); this.calculateDeltaTime(now);
const deltaTime = this._deltaTime;
// Update // Update
if (!this._paused) { if (!this._paused) {
// before update // before update
this.emit(cc.Director.EVENT_BEFORE_UPDATE); this.emit(cc.Director.EVENT_BEFORE_UPDATE, deltaTime);
// Call start for new added components // Call start for new added components
this._compScheduler.startPhase(); this._compScheduler.startPhase();
// Update for components // Update for components
this._compScheduler.updatePhase(this._deltaTime); this._compScheduler.updatePhase(deltaTime);
// Engine update with scheduler // Engine update with scheduler
this._scheduler.update(this._deltaTime); this._scheduler.update(deltaTime);
// Late update for components // Late update for components
this._compScheduler.lateUpdatePhase(this._deltaTime); this._compScheduler.lateUpdatePhase(deltaTime);
// User can use this event to do things after update // User can use this event to do things after update
this.emit(cc.Director.EVENT_AFTER_UPDATE); this.emit(cc.Director.EVENT_AFTER_UPDATE, deltaTime);
// Destroy entities that have been removed recently // Destroy entities that have been removed recently
Obj._deferredDestroy(); Obj._deferredDestroy();
} }
// Render // Render
this.emit(cc.Director.EVENT_BEFORE_DRAW); this.emit(cc.Director.EVENT_BEFORE_DRAW, deltaTime);
renderer.render(this._scene, this._deltaTime); renderer.render(this._scene, deltaTime);
// After draw // After draw
this.emit(cc.Director.EVENT_AFTER_DRAW); this.emit(cc.Director.EVENT_AFTER_DRAW, deltaTime);
eventManager.frameUpdateListeners(); eventManager.frameUpdateListeners();
this._totalFrames++; this._totalFrames++;

View File

@ -149,6 +149,7 @@ export abstract class CacheManager {
* url * url
* *
* @method removeCache * @method removeCache
* @param {string} originUrl
*/ */
public abstract removeCache (originUrl: string): void; public abstract removeCache (originUrl: string): void;
} }

View File

@ -677,7 +677,7 @@ Object.defineProperties(cc, {
if (CC_DEBUG) { if (CC_DEBUG) {
if (onceWarns.loader) { if (onceWarns.loader) {
onceWarns.loader = false; onceWarns.loader = false;
cc.log('cc.loader is deprecated, use cc.assetManager instead please. See https://docs.cocos.com/creator/manual/zh/release-notes/asset-manager-upgrade-guide.html'); cc.log('cc.loader is deprecated, use cc.assetManager instead please. See https://docs.cocos.com/creator/2.4/manual/zh/release-notes/asset-manager-upgrade-guide.html');
} }
} }
return loader; return loader;

View File

@ -383,11 +383,11 @@ let SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
} }
if (!self._originalSize) { if (!self._originalSize) {
self.setOriginalSize(cc.size(w, h)); self._originalSize = cc.size(w, h);
} }
if (!self._offset) { if (!self._offset) {
self.setOffset(cc.v2(0, 0)); self._offset = cc.v2(0, 0);
} }
self._calculateUV(); self._calculateUV();

View File

@ -674,6 +674,18 @@ let Label = cc.Class({
this._super(); this._super();
}, },
onRestore: CC_EDITOR && function () {
// Because undo/redo will not call onEnable/onDisable,
// we need call onEnable/onDisable manually to active/disactive children nodes.
if (this.enabledInHierarchy) {
this.node._renderComponent = null;
this.onEnable();
}
else {
this.onDisable();
}
},
_nodeSizeChanged () { _nodeSizeChanged () {
// Because the content size is automatically updated when overflow is NONE. // Because the content size is automatically updated when overflow is NONE.
// And this will conflict with the alignment of the CCWidget. // And this will conflict with the alignment of the CCWidget.

View File

@ -62,6 +62,7 @@ var MotionStreak = cc.Class({
ctor () { ctor () {
this._points = []; this._points = [];
this._lastWPos = new cc.Vec2(); this._lastWPos = new cc.Vec2();
this._lastWPosUpdated = false;
}, },
properties: { properties: {
@ -313,8 +314,7 @@ var MotionStreak = cc.Class({
reset () { reset () {
this._points.length = 0; this._points.length = 0;
this._assembler && this._assembler._renderData.clear(); this._assembler && this._assembler._renderData.clear();
this._lastWPos.x = 0; this._lastWPosUpdated = false;
this._lastWPos.y = 0;
if (CC_EDITOR) { if (CC_EDITOR) {
cc.engine.repaintInEditMode(); cc.engine.repaintInEditMode();
} }

View File

@ -68,14 +68,14 @@ function ConvexPartition(vertices) {
var list = []; var list = [];
var d, lowerDist, upperDist; var d, lowerDist, upperDist;
var p; var p;
var lowerInt = cc.v2(); var lowerInt = null;
var upperInt = cc.v2(); // intersection points var upperInt = null; // intersection points
var lowerIndex = 0, upperIndex = 0; var lowerIndex = 0, upperIndex = 0;
var lowerPoly, upperPoly; var lowerPoly, upperPoly;
for (var i = 0; i < vertices.length; ++i) { for (var i = 0; i < vertices.length; ++i) {
if (Reflex(i, vertices)) { if (Reflex(i, vertices)) {
lowerDist = upperDist = 10e7; // std::numeric_limits<qreal>::max(); lowerDist = upperDist = Number.MAX_SAFE_INTEGER || 9999999999999; // std::numeric_limits<qreal>::max();
for (var j = 0; j < vertices.length; ++j) { for (var j = 0; j < vertices.length; ++j) {
// if line intersects with an edge // if line intersects with an edge
if (Left(At(i - 1, vertices), At(i, vertices), At(j, vertices)) && if (Left(At(i - 1, vertices), At(i, vertices), At(j, vertices)) &&

View File

@ -316,12 +316,12 @@ cc.macro = {
/** /**
* !#en * !#en
* Whether to clear the original image cache after uploaded a texture to GPU. If cleared, [Dynamic Atlas](https://docs.cocos.com/creator/manual/en/advanced-topics/dynamic-atlas.html) will not be supported. * Whether to clear the original image cache after uploaded a texture to GPU. If cleared, [Dynamic Atlas](https://docs.cocos.com/creator/2.4/manual/en/advanced-topics/dynamic-atlas.html) will not be supported.
* Normally you don't need to enable this option on the web platform, because Image object doesn't consume too much memory. * Normally you don't need to enable this option on the web platform, because Image object doesn't consume too much memory.
* But on WeChat Game platform, the current version cache decoded data in Image object, which has high memory usage. * But on WeChat Game platform, the current version cache decoded data in Image object, which has high memory usage.
* So we enabled this option by default on WeChat, so that we can release Image cache immediately after uploaded to GPU. * So we enabled this option by default on WeChat, so that we can release Image cache immediately after uploaded to GPU.
* !#zh * !#zh
* 是否在将贴图上传至 GPU 之后删除原始图片缓存删除之后图片将无法进行 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。 * 是否在将贴图上传至 GPU 之后删除原始图片缓存删除之后图片将无法进行 [动态合图](https://docs.cocos.com/creator/2.4/manual/zh/advanced-topics/dynamic-atlas.html)。
* Web 平台你通常不需要开启这个选项因为在 Web 平台 Image 对象所占用的内存很小 * Web 平台你通常不需要开启这个选项因为在 Web 平台 Image 对象所占用的内存很小
* 但是在微信小游戏平台的当前版本Image 对象会缓存解码后的图片数据它所占用的内存空间很大 * 但是在微信小游戏平台的当前版本Image 对象会缓存解码后的图片数据它所占用的内存空间很大
* 所以我们在微信平台默认开启了这个选项这样我们就可以在上传 GL 贴图之后立即释放 Image 对象的内存避免过高的内存占用 * 所以我们在微信平台默认开启了这个选项这样我们就可以在上传 GL 贴图之后立即释放 Image 对象的内存避免过高的内存占用

View File

@ -32,8 +32,8 @@ function beforeSceneLoad() {
let _enabled = false; let _enabled = false;
/** /**
* !#en Manage Dynamic Atlas Manager. Dynamic Atlas Manager is used for merging textures at runtime, see [Dynamic Atlas](https://docs.cocos.com/creator/manual/en/advanced-topics/dynamic-atlas.html) for details. * !#en Manage Dynamic Atlas Manager. Dynamic Atlas Manager is used for merging textures at runtime, see [Dynamic Atlas](https://docs.cocos.com/creator/2.4/manual/en/advanced-topics/dynamic-atlas.html) for details.
* !#zh 管理动态图集动态图集用于在运行时对贴图进行合并详见 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。 * !#zh 管理动态图集动态图集用于在运行时对贴图进行合并详见 [动态合图](https://docs.cocos.com/creator/2.4/manual/zh/advanced-topics/dynamic-atlas.html)。
* @class DynamicAtlasManager * @class DynamicAtlasManager
*/ */
let dynamicAtlasManager = { let dynamicAtlasManager = {
@ -41,8 +41,8 @@ let dynamicAtlasManager = {
Rect: Rect, Rect: Rect,
/** /**
* !#en Enable or disable the dynamic atlas, see [Dynamic Atlas](https://docs.cocos.com/creator/manual/en/advanced-topics/dynamic-atlas.html) for details. * !#en Enable or disable the dynamic atlas, see [Dynamic Atlas](https://docs.cocos.com/creator/2.4/manual/en/advanced-topics/dynamic-atlas.html) for details.
* !#zh 开启或者关闭动态图集详见 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。 * !#zh 开启或者关闭动态图集详见 [动态合图](https://docs.cocos.com/creator/2.4/manual/zh/advanced-topics/dynamic-atlas.html)。
* @property enabled * @property enabled
* @type {Boolean} * @type {Boolean}
*/ */
@ -192,6 +192,7 @@ let dynamicAtlasManager = {
* !#zh 添加碎图进入动态图集 * !#zh 添加碎图进入动态图集
* @method insertSpriteFrame * @method insertSpriteFrame
* @param {SpriteFrame} spriteFrame * @param {SpriteFrame} spriteFrame
* @return {Object} frame
*/ */
insertSpriteFrame(spriteFrame) { insertSpriteFrame(spriteFrame) {
if (CC_EDITOR) return null; if (CC_EDITOR) return null;

View File

@ -25,6 +25,8 @@
import MotionStreakAssembler from "./motion-streak"; import MotionStreakAssembler from "./motion-streak";
import { vfmtPosUvColorTexId } from '../../webgl/vertex-format'; import { vfmtPosUvColorTexId } from '../../webgl/vertex-format';
import Mat4 from '../../../value-types/mat4';
const MotionStreak = require('../../../components/CCMotionStreak'); const MotionStreak = require('../../../components/CCMotionStreak');
const RenderFlow = require('../../render-flow'); const RenderFlow = require('../../render-flow');
@ -47,6 +49,7 @@ Point.prototype.setDir = function (x, y) {
let _normal = cc.v2(); let _normal = cc.v2();
let _vec2 = cc.v2(); let _vec2 = cc.v2();
let _worldMat = new Mat4();
function normal (out, dir) { function normal (out, dir) {
//get perpendicular //get perpendicular
@ -74,14 +77,14 @@ export default class MultiMotionStreakAssembler extends MotionStreakAssembler {
let stroke = comp._stroke / 2; let stroke = comp._stroke / 2;
let node = comp.node; let node = comp.node;
let matrix = node._worldMatrix.m; node.getWorldMatrix(_worldMat);
let tx = matrix[12], ty = matrix[13]; let tx = _worldMat.m[12], ty = _worldMat.m[13];
let points = comp._points; let points = comp._points;
let lastPos = comp._lastWPos; let lastPos = comp._lastWPos;
let fadeTime = comp._fadeTime; let fadeTime = comp._fadeTime;
let moved = lastPos.x !== tx || lastPos.y !== ty; let moved = comp._lastWPosUpdated && (lastPos.x !== tx || lastPos.y !== ty);
if (moved) { if (moved) {
let cur; let cur;
let newHead = false; let newHead = false;
@ -126,7 +129,8 @@ export default class MultiMotionStreakAssembler extends MotionStreakAssembler {
lastPos.x = tx; lastPos.x = tx;
lastPos.y = ty; lastPos.y = ty;
comp._lastWPosUpdated = true;
if (points.length < 2) { if (points.length < 2) {
return; return;
} }

View File

@ -24,6 +24,7 @@
****************************************************************************/ ****************************************************************************/
import Assembler2D from '../../assembler-2d'; import Assembler2D from '../../assembler-2d';
import Mat4 from '../../../value-types/mat4';
const RenderFlow = require('../../render-flow'); const RenderFlow = require('../../render-flow');
@ -48,6 +49,7 @@ let _tangent = cc.v2();
let _miter = cc.v2(); let _miter = cc.v2();
let _normal = cc.v2(); let _normal = cc.v2();
let _vec2 = cc.v2(); let _vec2 = cc.v2();
let _worldMat = new Mat4();
function normal (out, dir) { function normal (out, dir) {
//get perpendicular //get perpendicular
@ -91,14 +93,14 @@ export default class MotionStreakAssembler extends Assembler2D {
let stroke = comp._stroke / 2; let stroke = comp._stroke / 2;
let node = comp.node; let node = comp.node;
let matrix = node._worldMatrix.m; node.getWorldMatrix(_worldMat);
let tx = matrix[12], ty = matrix[13]; let tx = _worldMat.m[12], ty = _worldMat.m[13];
let points = comp._points; let points = comp._points;
let lastPos = comp._lastWPos; let lastPos = comp._lastWPos;
let fadeTime = comp._fadeTime; let fadeTime = comp._fadeTime;
let moved = lastPos.x !== tx || lastPos.y !== ty; let moved = comp._lastWPosUpdated && (lastPos.x !== tx || lastPos.y !== ty);
if (moved) { if (moved) {
let cur; let cur;
let newHead = false; let newHead = false;
@ -143,7 +145,8 @@ export default class MotionStreakAssembler extends Assembler2D {
lastPos.x = tx; lastPos.x = tx;
lastPos.y = ty; lastPos.y = ty;
comp._lastWPosUpdated = true;
if (points.length < 2) { if (points.length < 2) {
return; return;
} }

View File

@ -820,6 +820,18 @@ var ParticleSystem = cc.Class({
} }
}, },
onRestore: CC_EDITOR && function () {
// Because undo/redo will not call onEnable/onDisable,
// we need call onEnable/onDisable manually to active/disactive children nodes.
if (this.enabledInHierarchy) {
this.node._renderComponent = null;
this.onEnable();
}
else {
this.onDisable();
}
},
_startPreview: CC_EDITOR && function () { _startPreview: CC_EDITOR && function () {
if (this.preview) { if (this.preview) {
this.resetSystem(); this.resetSystem();

View File

@ -1,33 +1,33 @@
module.exports = { module.exports = {
'COMPONENT': { 'COMPONENT': {
"help_url": { "help_url": {
"audiosource": "https://docs.cocos.com/creator/manual/en/components/audiosource.html", "audiosource": "https://docs.cocos.com/creator/2.4/manual/en/components/audiosource.html",
"animation": "https://docs.cocos.com/creator/manual/en/components/animation.html", "animation": "https://docs.cocos.com/creator/2.4/manual/en/components/animation.html",
"sprite": "https://docs.cocos.com/creator/manual/en/components/sprite.html", "sprite": "https://docs.cocos.com/creator/2.4/manual/en/components/sprite.html",
"label": "https://docs.cocos.com/creator/manual/en/components/label.html", "label": "https://docs.cocos.com/creator/2.4/manual/en/components/label.html",
"canvas": "https://docs.cocos.com/creator/manual/en/components/canvas.html", "canvas": "https://docs.cocos.com/creator/2.4/manual/en/components/canvas.html",
"spine": "https://docs.cocos.com/creator/manual/en/components/spine.html", "spine": "https://docs.cocos.com/creator/2.4/manual/en/components/spine.html",
"widget": "https://docs.cocos.com/creator/manual/en/components/widget.html", "widget": "https://docs.cocos.com/creator/2.4/manual/en/components/widget.html",
"button": "https://docs.cocos.com/creator/manual/en/components/button.html", "button": "https://docs.cocos.com/creator/2.4/manual/en/components/button.html",
"progressbar": "https://docs.cocos.com/creator/manual/en/components/progress.html", "progressbar": "https://docs.cocos.com/creator/2.4/manual/en/components/progress.html",
"mask": "https://docs.cocos.com/creator/manual/en/components/mask.html", "mask": "https://docs.cocos.com/creator/2.4/manual/en/components/mask.html",
"scrollview": "https://docs.cocos.com/creator/manual/en/components/scrollview.html", "scrollview": "https://docs.cocos.com/creator/2.4/manual/en/components/scrollview.html",
"scrollbar": "https://docs.cocos.com/creator/manual/en/components/scrollbar.html", "scrollbar": "https://docs.cocos.com/creator/2.4/manual/en/components/scrollbar.html",
"layout": "https://docs.cocos.com/creator/manual/en/components/layout.html", "layout": "https://docs.cocos.com/creator/2.4/manual/en/components/layout.html",
"tiledmap": "https://docs.cocos.com/creator/manual/en/components/tiledmap.html", "tiledmap": "https://docs.cocos.com/creator/2.4/manual/en/components/tiledmap.html",
"editbox": "https://docs.cocos.com/creator/manual/en/components/editbox.html", "editbox": "https://docs.cocos.com/creator/2.4/manual/en/components/editbox.html",
"videoplayer": "https://docs.cocos.com/creator/manual/en/components/videoplayer.html", "videoplayer": "https://docs.cocos.com/creator/2.4/manual/en/components/videoplayer.html",
"motionStreak": "https://docs.cocos.com/creator/manual/en/components/motion-streak.html", "motionStreak": "https://docs.cocos.com/creator/2.4/manual/en/components/motion-streak.html",
"richtext": "https://docs.cocos.com/creator/manual/en/components/richtext.html", "richtext": "https://docs.cocos.com/creator/2.4/manual/en/components/richtext.html",
"pageview": "https://docs.cocos.com/creator/manual/en/components/pageview.html", "pageview": "https://docs.cocos.com/creator/2.4/manual/en/components/pageview.html",
"pageviewIndicator": "https://docs.cocos.com/creator/manual/en/components/pageviewindicator.html", "pageviewIndicator": "https://docs.cocos.com/creator/2.4/manual/en/components/pageviewindicator.html",
"toggle": "https://docs.cocos.com/creator/manual/en/components/toggle.html", "toggle": "https://docs.cocos.com/creator/2.4/manual/en/components/toggle.html",
"toggleGroup": "https://docs.cocos.com/creator/manual/en/components/toggleGroup.html", "toggleGroup": "https://docs.cocos.com/creator/2.4/manual/en/components/toggleGroup.html",
"toggleContainer": "https://docs.cocos.com/creator/manual/en/components/toggleContainer.html", "toggleContainer": "https://docs.cocos.com/creator/2.4/manual/en/components/toggleContainer.html",
"slider": "https://docs.cocos.com/creator/manual/en/components/slider.html", "slider": "https://docs.cocos.com/creator/2.4/manual/en/components/slider.html",
"block_input_events": "https://docs.cocos.com/creator/manual/en/components/block-input-events.html", "block_input_events": "https://docs.cocos.com/creator/2.4/manual/en/components/block-input-events.html",
"subcontext_view": "https://docs.cocos.com/creator/manual/en/publish/publish-wechatgame-sub-domain.html", "subcontext_view": "https://docs.cocos.com/creator/2.4/manual/en/publish/publish-wechatgame-sub-domain.html",
"safe_area": "https://docs.cocos.com/creator/manual/en/components/safearea.html" "safe_area": "https://docs.cocos.com/creator/2.4/manual/en/components/safearea.html"
}, },
"animation": { "animation": {
"default_clip": "When checking, the deault animation clip is automatically played.", "default_clip": "When checking, the deault animation clip is automatically played.",

View File

@ -1,33 +1,33 @@
module.exports = { module.exports = {
'COMPONENT': { 'COMPONENT': {
"help_url": { "help_url": {
"audiosource": "https://docs.cocos.com/creator/manual/zh/components/audiosource.html", "audiosource": "https://docs.cocos.com/creator/2.4/manual/zh/components/audiosource.html",
"animation": "https://docs.cocos.com/creator/manual/zh/components/animation.html", "animation": "https://docs.cocos.com/creator/2.4/manual/zh/components/animation.html",
"sprite": "https://docs.cocos.com/creator/manual/zh/components/sprite.html", "sprite": "https://docs.cocos.com/creator/2.4/manual/zh/components/sprite.html",
"label": "https://docs.cocos.com/creator/manual/zh/components/label.html", "label": "https://docs.cocos.com/creator/2.4/manual/zh/components/label.html",
"canvas": "https://docs.cocos.com/creator/manual/zh/components/canvas.html", "canvas": "https://docs.cocos.com/creator/2.4/manual/zh/components/canvas.html",
"spine": "https://docs.cocos.com/creator/manual/zh/components/spine.html", "spine": "https://docs.cocos.com/creator/2.4/manual/zh/components/spine.html",
"widget": "https://docs.cocos.com/creator/manual/zh/components/widget.html", "widget": "https://docs.cocos.com/creator/2.4/manual/zh/components/widget.html",
"button": "https://docs.cocos.com/creator/manual/zh/components/button.html", "button": "https://docs.cocos.com/creator/2.4/manual/zh/components/button.html",
"progressbar": "https://docs.cocos.com/creator/manual/zh/components/progress.html", "progressbar": "https://docs.cocos.com/creator/2.4/manual/zh/components/progress.html",
"mask": "https://docs.cocos.com/creator/manual/zh/components/mask.html", "mask": "https://docs.cocos.com/creator/2.4/manual/zh/components/mask.html",
"scrollview": "https://docs.cocos.com/creator/manual/zh/components/scrollview.html", "scrollview": "https://docs.cocos.com/creator/2.4/manual/zh/components/scrollview.html",
"scrollbar": "https://docs.cocos.com/creator/manual/zh/components/scrollbar.html", "scrollbar": "https://docs.cocos.com/creator/2.4/manual/zh/components/scrollbar.html",
"layout": "https://docs.cocos.com/creator/manual/zh/components/layout.html", "layout": "https://docs.cocos.com/creator/2.4/manual/zh/components/layout.html",
"tiledmap": "https://docs.cocos.com/creator/manual/zh/components/tiledmap.html", "tiledmap": "https://docs.cocos.com/creator/2.4/manual/zh/components/tiledmap.html",
"editbox": "https://docs.cocos.com/creator/manual/zh/components/editbox.html", "editbox": "https://docs.cocos.com/creator/2.4/manual/zh/components/editbox.html",
"videoplayer": "https://docs.cocos.com/creator/manual/zh/components/videoplayer.html", "videoplayer": "https://docs.cocos.com/creator/2.4/manual/zh/components/videoplayer.html",
"motionStreak": "https://docs.cocos.com/creator/manual/zh/components/motion-streak.html", "motionStreak": "https://docs.cocos.com/creator/2.4/manual/zh/components/motion-streak.html",
"richtext": "https://docs.cocos.com/creator/manual/zh/components/richtext.html", "richtext": "https://docs.cocos.com/creator/2.4/manual/zh/components/richtext.html",
"pageview": "https://docs.cocos.com/creator/manual/zh/components/pageview.html", "pageview": "https://docs.cocos.com/creator/2.4/manual/zh/components/pageview.html",
"pageviewIndicator": "https://docs.cocos.com/creator/manual/zh/components/pageviewindicator.html", "pageviewIndicator": "https://docs.cocos.com/creator/2.4/manual/zh/components/pageviewindicator.html",
"toggle": "https://docs.cocos.com/creator/manual/zh/components/toggle.html", "toggle": "https://docs.cocos.com/creator/2.4/manual/zh/components/toggle.html",
"toggleGroup": "https://docs.cocos.com/creator/manual/zh/components/toggleGroup.html", "toggleGroup": "https://docs.cocos.com/creator/2.4/manual/zh/components/toggleGroup.html",
"toggleContainer": "https://docs.cocos.com/creator/manual/zh/components/toggleContainer.html", "toggleContainer": "https://docs.cocos.com/creator/2.4/manual/zh/components/toggleContainer.html",
"slider": "https://docs.cocos.com/creator/manual/zh/components/slider.html", "slider": "https://docs.cocos.com/creator/2.4/manual/zh/components/slider.html",
"block_input_events": "https://docs.cocos.com/creator/manual/zh/components/block-input-events.html", "block_input_events": "https://docs.cocos.com/creator/2.4/manual/zh/components/block-input-events.html",
"subcontext_view": "https://docs.cocos.com/creator/manual/zh/publish/publish-wechatgame-sub-domain.html", "subcontext_view": "https://docs.cocos.com/creator/2.4/manual/zh/publish/publish-wechatgame-sub-domain.html",
"safe_area": "https://docs.cocos.com/creator/manual/zh/components/safearea.html", "safe_area": "https://docs.cocos.com/creator/2.4/manual/zh/components/safearea.html",
}, },
'animation': { 'animation': {
'default_clip': '在勾选自动播放或调用 play() 时默认播放的动画 clip。', 'default_clip': '在勾选自动播放或调用 play() 时默认播放的动画 clip。',

View File

@ -1,6 +1,6 @@
{ {
"name": "cocos-creator-js", "name": "cocos-creator-js",
"version": "2.4.9", "version": "2.4.10",
"description": "Cocos Creator is a complete package of game development tools and workflow, including a game engine, resource management, scene editing, game preview, debug and publish one project to multiple platforms.", "description": "Cocos Creator is a complete package of game development tools and workflow, including a game engine, resource management, scene editing, game preview, debug and publish one project to multiple platforms.",
"homepage": "https://www.cocos.com", "homepage": "https://www.cocos.com",
"license": "MIT", "license": "MIT",

View File

@ -132,7 +132,7 @@ function defineDeprecatedMacroGetter (name, defaultValue) {
recommandedUsage = 'cc.sys.platform === cc.sys.WECHAT_GAME_SUB'; recommandedUsage = 'cc.sys.platform === cc.sys.WECHAT_GAME_SUB';
} }
else if (name === 'CC_WECHATGAME') { else if (name === 'CC_WECHATGAME') {
recommandedUsage = 'cc.sys.platform === cc.sys.WECHAT_GAME'; recommandedUsage = 'cc.sys.platform === cc.sys.WECHAT_GAME';
} }
else if (name === 'CC_QQPLAY') { else if (name === 'CC_QQPLAY') {
recommandedUsage = 'cc.sys.platform === cc.sys.QQ_PLAY'; recommandedUsage = 'cc.sys.platform === cc.sys.QQ_PLAY';
@ -185,7 +185,7 @@ else {
defineMacro('CC_JSB', defined('jsb') && !CC_RUNTIME); defineMacro('CC_JSB', defined('jsb') && !CC_RUNTIME);
} }
// deprecated // deprecated
const WECHATGAMESUB = !!(defined('wx') && wx.getSharedCanvas); const WECHATGAMESUB = !!(defined('wx') && wx.getSharedCanvas);
const WECHATGAME = !!(defined('wx') && (wx.getSystemInfoSync || wx.getSharedCanvas)); const WECHATGAME = !!(defined('wx') && (wx.getSystemInfoSync || wx.getSharedCanvas));
const QQPLAY = defined('bk'); const QQPLAY = defined('bk');
@ -211,5 +211,5 @@ if (CC_DEV) {
* If you post a bug to forum, please attach this flag. * If you post a bug to forum, please attach this flag.
* @property {String} ENGINE_VERSION * @property {String} ENGINE_VERSION
*/ */
const engineVersion = '2.4.9'; const engineVersion = '2.4.10';
_global['CocosEngine'] = cc.ENGINE_VERSION = engineVersion; _global['CocosEngine'] = cc.ENGINE_VERSION = engineVersion;

View File

@ -3,8 +3,6 @@ let proto = cc.MotionStreak.__assembler__.MultiMotionStreakAssembler.prototype;
let _update = proto.update; let _update = proto.update;
cc.js.mixin(proto, { cc.js.mixin(proto, {
update (comp, dt) { update (comp, dt) {
comp.node._updateWorldMatrix();
_update.call(this, comp, dt); _update.call(this, comp, dt);
let { iData, usedVertices } = this._renderData._flexBuffer; let { iData, usedVertices } = this._renderData._flexBuffer;

View File

@ -11,8 +11,6 @@ cc.js.mixin(proto, {
this.ignoreOpacityFlag(); this.ignoreOpacityFlag();
}, },
update (comp, dt) { update (comp, dt) {
comp.node._updateWorldMatrix();
_update.call(this, comp, dt); _update.call(this, comp, dt);
let { iData, usedVertices } = this._renderData._flexBuffer; let { iData, usedVertices } = this._renderData._flexBuffer;