mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2024-12-25 03:08:29 +00:00
[engine] [cocos2d-x] [jsb-adapter] 适配引擎 v2.4.10 版本
This commit is contained in:
parent
0740917436
commit
e2077e59b5
@ -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);
|
||||
|
||||
|
@ -148,6 +148,6 @@ For details below:
|
||||
|
||||
* [Official site](https://www.cocos.com/products#CocosCreator)
|
||||
* [Download](https://www.cocos.com/creator)
|
||||
* [Documentation](https://docs.cocos.com/creator/manual/)
|
||||
* [API References](https://docs.cocos.com/creator/api/)
|
||||
* [Documentation](https://docs.cocos.com/creator/2.4/manual/)
|
||||
* [API References](https://docs.cocos.com/creator/2.4/api/)
|
||||
* [Forum](https://discuss.cocos2d-x.org/c/creator)
|
||||
|
25
engine/api.d.ts
vendored
25
engine/api.d.ts
vendored
@ -1,10 +1,21 @@
|
||||
|
||||
declare let CC_JSB: boolean
|
||||
declare let CC_NATIVERENDERER: boolean
|
||||
declare let CC_EDITOR: boolean
|
||||
declare let CC_PREVIEW: boolean
|
||||
declare let CC_TEST: boolean
|
||||
declare let CC_DEBUG: boolean
|
||||
/** Running in the editor. */
|
||||
declare const CC_EDITOR: boolean;
|
||||
/** Preview in browser or simulator. */
|
||||
declare const CC_PREVIEW: boolean;
|
||||
/** Running in the editor or preview. */
|
||||
declare const CC_DEV: 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: {
|
||||
// polyfills: {
|
||||
|
@ -218,7 +218,7 @@ Tween.stopAllByTarget = function (target) {
|
||||
* Insert an action or tween to this sequence
|
||||
* !#zh
|
||||
* 插入一个 action 或者 tween 到队列中
|
||||
* @method then
|
||||
* @method then
|
||||
* @param {Action|Tween} other
|
||||
* @return {Tween}
|
||||
* @typescript then(other: Action|Tween<T>): Tween<T>
|
||||
@ -294,6 +294,7 @@ Tween.prototype.start = function () {
|
||||
Tween.prototype.stop = function () {
|
||||
if (this._finalAction) {
|
||||
cc.director.getActionManager().removeAction(this._finalAction);
|
||||
this._finalAction = null;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
@ -414,7 +415,7 @@ Object.assign(Tween.prototype, {
|
||||
*/
|
||||
flipX () {
|
||||
return this.call(() => { this._target.scaleX *= -1; }, this);
|
||||
|
||||
|
||||
},
|
||||
/**
|
||||
* !#en Flips target's scaleY
|
||||
@ -703,4 +704,4 @@ cc.tween = function (target) {
|
||||
};
|
||||
|
||||
cc.Tween = Tween;
|
||||
|
||||
|
||||
|
@ -845,7 +845,7 @@ cc.Director.prototype = {
|
||||
|
||||
// Update
|
||||
if (!this._paused) {
|
||||
this.emit(cc.Director.EVENT_BEFORE_UPDATE);
|
||||
this.emit(cc.Director.EVENT_BEFORE_UPDATE, deltaTime);
|
||||
|
||||
this._compScheduler.startPhase();
|
||||
this._compScheduler.updatePhase(deltaTime);
|
||||
@ -856,15 +856,15 @@ cc.Director.prototype = {
|
||||
|
||||
this._compScheduler.lateUpdatePhase(deltaTime);
|
||||
|
||||
this.emit(cc.Director.EVENT_AFTER_UPDATE);
|
||||
this.emit(cc.Director.EVENT_AFTER_UPDATE, deltaTime);
|
||||
}
|
||||
|
||||
// Render
|
||||
this.emit(cc.Director.EVENT_BEFORE_DRAW);
|
||||
this.emit(cc.Director.EVENT_BEFORE_DRAW, deltaTime);
|
||||
renderer.render(this._scene, deltaTime);
|
||||
|
||||
// After draw
|
||||
this.emit(cc.Director.EVENT_AFTER_DRAW);
|
||||
this.emit(cc.Director.EVENT_AFTER_DRAW, deltaTime);
|
||||
|
||||
this._totalFrames++;
|
||||
|
||||
@ -877,35 +877,36 @@ cc.Director.prototype = {
|
||||
// calculate "global" dt
|
||||
this.calculateDeltaTime(now);
|
||||
|
||||
const deltaTime = this._deltaTime;
|
||||
// Update
|
||||
if (!this._paused) {
|
||||
// before update
|
||||
this.emit(cc.Director.EVENT_BEFORE_UPDATE);
|
||||
this.emit(cc.Director.EVENT_BEFORE_UPDATE, deltaTime);
|
||||
|
||||
// Call start for new added components
|
||||
this._compScheduler.startPhase();
|
||||
|
||||
// Update for components
|
||||
this._compScheduler.updatePhase(this._deltaTime);
|
||||
this._compScheduler.updatePhase(deltaTime);
|
||||
// Engine update with scheduler
|
||||
this._scheduler.update(this._deltaTime);
|
||||
this._scheduler.update(deltaTime);
|
||||
|
||||
// Late update for components
|
||||
this._compScheduler.lateUpdatePhase(this._deltaTime);
|
||||
this._compScheduler.lateUpdatePhase(deltaTime);
|
||||
|
||||
// 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
|
||||
Obj._deferredDestroy();
|
||||
}
|
||||
|
||||
// Render
|
||||
this.emit(cc.Director.EVENT_BEFORE_DRAW);
|
||||
renderer.render(this._scene, this._deltaTime);
|
||||
this.emit(cc.Director.EVENT_BEFORE_DRAW, deltaTime);
|
||||
renderer.render(this._scene, deltaTime);
|
||||
|
||||
// After draw
|
||||
this.emit(cc.Director.EVENT_AFTER_DRAW);
|
||||
this.emit(cc.Director.EVENT_AFTER_DRAW, deltaTime);
|
||||
|
||||
eventManager.frameUpdateListeners();
|
||||
this._totalFrames++;
|
||||
|
@ -149,6 +149,7 @@ export abstract class CacheManager {
|
||||
* 通过原始 url 移除缓存
|
||||
*
|
||||
* @method removeCache
|
||||
* @param {string} originUrl
|
||||
*/
|
||||
public abstract removeCache (originUrl: string): void;
|
||||
}
|
||||
|
@ -677,7 +677,7 @@ Object.defineProperties(cc, {
|
||||
if (CC_DEBUG) {
|
||||
if (onceWarns.loader) {
|
||||
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;
|
||||
|
@ -383,11 +383,11 @@ let SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
}
|
||||
|
||||
if (!self._originalSize) {
|
||||
self.setOriginalSize(cc.size(w, h));
|
||||
self._originalSize = cc.size(w, h);
|
||||
}
|
||||
|
||||
if (!self._offset) {
|
||||
self.setOffset(cc.v2(0, 0));
|
||||
self._offset = cc.v2(0, 0);
|
||||
}
|
||||
|
||||
self._calculateUV();
|
||||
|
@ -674,6 +674,18 @@ let Label = cc.Class({
|
||||
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 () {
|
||||
// Because the content size is automatically updated when overflow is NONE.
|
||||
// And this will conflict with the alignment of the CCWidget.
|
||||
|
@ -62,6 +62,7 @@ var MotionStreak = cc.Class({
|
||||
ctor () {
|
||||
this._points = [];
|
||||
this._lastWPos = new cc.Vec2();
|
||||
this._lastWPosUpdated = false;
|
||||
},
|
||||
|
||||
properties: {
|
||||
@ -313,8 +314,7 @@ var MotionStreak = cc.Class({
|
||||
reset () {
|
||||
this._points.length = 0;
|
||||
this._assembler && this._assembler._renderData.clear();
|
||||
this._lastWPos.x = 0;
|
||||
this._lastWPos.y = 0;
|
||||
this._lastWPosUpdated = false;
|
||||
if (CC_EDITOR) {
|
||||
cc.engine.repaintInEditMode();
|
||||
}
|
||||
|
@ -68,14 +68,14 @@ function ConvexPartition(vertices) {
|
||||
var list = [];
|
||||
var d, lowerDist, upperDist;
|
||||
var p;
|
||||
var lowerInt = cc.v2();
|
||||
var upperInt = cc.v2(); // intersection points
|
||||
var lowerInt = null;
|
||||
var upperInt = null; // intersection points
|
||||
var lowerIndex = 0, upperIndex = 0;
|
||||
var lowerPoly, upperPoly;
|
||||
|
||||
for (var i = 0; i < vertices.length; ++i) {
|
||||
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) {
|
||||
// if line intersects with an edge
|
||||
if (Left(At(i - 1, vertices), At(i, vertices), At(j, vertices)) &&
|
||||
|
@ -316,12 +316,12 @@ cc.macro = {
|
||||
|
||||
/**
|
||||
* !#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.
|
||||
* 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.
|
||||
* !#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 对象所占用的内存很小。
|
||||
* 但是在微信小游戏平台的当前版本,Image 对象会缓存解码后的图片数据,它所占用的内存空间很大。
|
||||
* 所以我们在微信平台默认开启了这个选项,这样我们就可以在上传 GL 贴图之后立即释放 Image 对象的内存,避免过高的内存占用。
|
||||
|
@ -32,8 +32,8 @@ function beforeSceneLoad() {
|
||||
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.
|
||||
* !#zh 管理动态图集。动态图集用于在运行时对贴图进行合并,详见 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。
|
||||
* !#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/2.4/manual/zh/advanced-topics/dynamic-atlas.html)。
|
||||
* @class DynamicAtlasManager
|
||||
*/
|
||||
let dynamicAtlasManager = {
|
||||
@ -41,8 +41,8 @@ let dynamicAtlasManager = {
|
||||
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.
|
||||
* !#zh 开启或者关闭动态图集,详见 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。
|
||||
* !#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/2.4/manual/zh/advanced-topics/dynamic-atlas.html)。
|
||||
* @property enabled
|
||||
* @type {Boolean}
|
||||
*/
|
||||
@ -192,6 +192,7 @@ let dynamicAtlasManager = {
|
||||
* !#zh 添加碎图进入动态图集。
|
||||
* @method insertSpriteFrame
|
||||
* @param {SpriteFrame} spriteFrame
|
||||
* @return {Object} frame
|
||||
*/
|
||||
insertSpriteFrame(spriteFrame) {
|
||||
if (CC_EDITOR) return null;
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
import MotionStreakAssembler from "./motion-streak";
|
||||
import { vfmtPosUvColorTexId } from '../../webgl/vertex-format';
|
||||
import Mat4 from '../../../value-types/mat4';
|
||||
|
||||
const MotionStreak = require('../../../components/CCMotionStreak');
|
||||
const RenderFlow = require('../../render-flow');
|
||||
|
||||
@ -47,6 +49,7 @@ Point.prototype.setDir = function (x, y) {
|
||||
|
||||
let _normal = cc.v2();
|
||||
let _vec2 = cc.v2();
|
||||
let _worldMat = new Mat4();
|
||||
|
||||
function normal (out, dir) {
|
||||
//get perpendicular
|
||||
@ -74,14 +77,14 @@ export default class MultiMotionStreakAssembler extends MotionStreakAssembler {
|
||||
let stroke = comp._stroke / 2;
|
||||
|
||||
let node = comp.node;
|
||||
let matrix = node._worldMatrix.m;
|
||||
let tx = matrix[12], ty = matrix[13];
|
||||
node.getWorldMatrix(_worldMat);
|
||||
let tx = _worldMat.m[12], ty = _worldMat.m[13];
|
||||
|
||||
let points = comp._points;
|
||||
let lastPos = comp._lastWPos;
|
||||
let fadeTime = comp._fadeTime;
|
||||
|
||||
let moved = lastPos.x !== tx || lastPos.y !== ty;
|
||||
let moved = comp._lastWPosUpdated && (lastPos.x !== tx || lastPos.y !== ty);
|
||||
if (moved) {
|
||||
let cur;
|
||||
let newHead = false;
|
||||
@ -126,7 +129,8 @@ export default class MultiMotionStreakAssembler extends MotionStreakAssembler {
|
||||
|
||||
lastPos.x = tx;
|
||||
lastPos.y = ty;
|
||||
|
||||
comp._lastWPosUpdated = true;
|
||||
|
||||
if (points.length < 2) {
|
||||
return;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import Assembler2D from '../../assembler-2d';
|
||||
import Mat4 from '../../../value-types/mat4';
|
||||
|
||||
const RenderFlow = require('../../render-flow');
|
||||
|
||||
@ -48,6 +49,7 @@ let _tangent = cc.v2();
|
||||
let _miter = cc.v2();
|
||||
let _normal = cc.v2();
|
||||
let _vec2 = cc.v2();
|
||||
let _worldMat = new Mat4();
|
||||
|
||||
function normal (out, dir) {
|
||||
//get perpendicular
|
||||
@ -91,14 +93,14 @@ export default class MotionStreakAssembler extends Assembler2D {
|
||||
let stroke = comp._stroke / 2;
|
||||
|
||||
let node = comp.node;
|
||||
let matrix = node._worldMatrix.m;
|
||||
let tx = matrix[12], ty = matrix[13];
|
||||
node.getWorldMatrix(_worldMat);
|
||||
let tx = _worldMat.m[12], ty = _worldMat.m[13];
|
||||
|
||||
let points = comp._points;
|
||||
let lastPos = comp._lastWPos;
|
||||
let fadeTime = comp._fadeTime;
|
||||
|
||||
let moved = lastPos.x !== tx || lastPos.y !== ty;
|
||||
let moved = comp._lastWPosUpdated && (lastPos.x !== tx || lastPos.y !== ty);
|
||||
if (moved) {
|
||||
let cur;
|
||||
let newHead = false;
|
||||
@ -143,7 +145,8 @@ export default class MotionStreakAssembler extends Assembler2D {
|
||||
|
||||
lastPos.x = tx;
|
||||
lastPos.y = ty;
|
||||
|
||||
comp._lastWPosUpdated = true;
|
||||
|
||||
if (points.length < 2) {
|
||||
return;
|
||||
}
|
||||
|
@ -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 () {
|
||||
if (this.preview) {
|
||||
this.resetSystem();
|
||||
|
@ -1,33 +1,33 @@
|
||||
module.exports = {
|
||||
'COMPONENT': {
|
||||
"help_url": {
|
||||
"audiosource": "https://docs.cocos.com/creator/manual/en/components/audiosource.html",
|
||||
"animation": "https://docs.cocos.com/creator/manual/en/components/animation.html",
|
||||
"sprite": "https://docs.cocos.com/creator/manual/en/components/sprite.html",
|
||||
"label": "https://docs.cocos.com/creator/manual/en/components/label.html",
|
||||
"canvas": "https://docs.cocos.com/creator/manual/en/components/canvas.html",
|
||||
"spine": "https://docs.cocos.com/creator/manual/en/components/spine.html",
|
||||
"widget": "https://docs.cocos.com/creator/manual/en/components/widget.html",
|
||||
"button": "https://docs.cocos.com/creator/manual/en/components/button.html",
|
||||
"progressbar": "https://docs.cocos.com/creator/manual/en/components/progress.html",
|
||||
"mask": "https://docs.cocos.com/creator/manual/en/components/mask.html",
|
||||
"scrollview": "https://docs.cocos.com/creator/manual/en/components/scrollview.html",
|
||||
"scrollbar": "https://docs.cocos.com/creator/manual/en/components/scrollbar.html",
|
||||
"layout": "https://docs.cocos.com/creator/manual/en/components/layout.html",
|
||||
"tiledmap": "https://docs.cocos.com/creator/manual/en/components/tiledmap.html",
|
||||
"editbox": "https://docs.cocos.com/creator/manual/en/components/editbox.html",
|
||||
"videoplayer": "https://docs.cocos.com/creator/manual/en/components/videoplayer.html",
|
||||
"motionStreak": "https://docs.cocos.com/creator/manual/en/components/motion-streak.html",
|
||||
"richtext": "https://docs.cocos.com/creator/manual/en/components/richtext.html",
|
||||
"pageview": "https://docs.cocos.com/creator/manual/en/components/pageview.html",
|
||||
"pageviewIndicator": "https://docs.cocos.com/creator/manual/en/components/pageviewindicator.html",
|
||||
"toggle": "https://docs.cocos.com/creator/manual/en/components/toggle.html",
|
||||
"toggleGroup": "https://docs.cocos.com/creator/manual/en/components/toggleGroup.html",
|
||||
"toggleContainer": "https://docs.cocos.com/creator/manual/en/components/toggleContainer.html",
|
||||
"slider": "https://docs.cocos.com/creator/manual/en/components/slider.html",
|
||||
"block_input_events": "https://docs.cocos.com/creator/manual/en/components/block-input-events.html",
|
||||
"subcontext_view": "https://docs.cocos.com/creator/manual/en/publish/publish-wechatgame-sub-domain.html",
|
||||
"safe_area": "https://docs.cocos.com/creator/manual/en/components/safearea.html"
|
||||
"audiosource": "https://docs.cocos.com/creator/2.4/manual/en/components/audiosource.html",
|
||||
"animation": "https://docs.cocos.com/creator/2.4/manual/en/components/animation.html",
|
||||
"sprite": "https://docs.cocos.com/creator/2.4/manual/en/components/sprite.html",
|
||||
"label": "https://docs.cocos.com/creator/2.4/manual/en/components/label.html",
|
||||
"canvas": "https://docs.cocos.com/creator/2.4/manual/en/components/canvas.html",
|
||||
"spine": "https://docs.cocos.com/creator/2.4/manual/en/components/spine.html",
|
||||
"widget": "https://docs.cocos.com/creator/2.4/manual/en/components/widget.html",
|
||||
"button": "https://docs.cocos.com/creator/2.4/manual/en/components/button.html",
|
||||
"progressbar": "https://docs.cocos.com/creator/2.4/manual/en/components/progress.html",
|
||||
"mask": "https://docs.cocos.com/creator/2.4/manual/en/components/mask.html",
|
||||
"scrollview": "https://docs.cocos.com/creator/2.4/manual/en/components/scrollview.html",
|
||||
"scrollbar": "https://docs.cocos.com/creator/2.4/manual/en/components/scrollbar.html",
|
||||
"layout": "https://docs.cocos.com/creator/2.4/manual/en/components/layout.html",
|
||||
"tiledmap": "https://docs.cocos.com/creator/2.4/manual/en/components/tiledmap.html",
|
||||
"editbox": "https://docs.cocos.com/creator/2.4/manual/en/components/editbox.html",
|
||||
"videoplayer": "https://docs.cocos.com/creator/2.4/manual/en/components/videoplayer.html",
|
||||
"motionStreak": "https://docs.cocos.com/creator/2.4/manual/en/components/motion-streak.html",
|
||||
"richtext": "https://docs.cocos.com/creator/2.4/manual/en/components/richtext.html",
|
||||
"pageview": "https://docs.cocos.com/creator/2.4/manual/en/components/pageview.html",
|
||||
"pageviewIndicator": "https://docs.cocos.com/creator/2.4/manual/en/components/pageviewindicator.html",
|
||||
"toggle": "https://docs.cocos.com/creator/2.4/manual/en/components/toggle.html",
|
||||
"toggleGroup": "https://docs.cocos.com/creator/2.4/manual/en/components/toggleGroup.html",
|
||||
"toggleContainer": "https://docs.cocos.com/creator/2.4/manual/en/components/toggleContainer.html",
|
||||
"slider": "https://docs.cocos.com/creator/2.4/manual/en/components/slider.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/2.4/manual/en/publish/publish-wechatgame-sub-domain.html",
|
||||
"safe_area": "https://docs.cocos.com/creator/2.4/manual/en/components/safearea.html"
|
||||
},
|
||||
"animation": {
|
||||
"default_clip": "When checking, the deault animation clip is automatically played.",
|
||||
|
@ -1,33 +1,33 @@
|
||||
module.exports = {
|
||||
'COMPONENT': {
|
||||
"help_url": {
|
||||
"audiosource": "https://docs.cocos.com/creator/manual/zh/components/audiosource.html",
|
||||
"animation": "https://docs.cocos.com/creator/manual/zh/components/animation.html",
|
||||
"sprite": "https://docs.cocos.com/creator/manual/zh/components/sprite.html",
|
||||
"label": "https://docs.cocos.com/creator/manual/zh/components/label.html",
|
||||
"canvas": "https://docs.cocos.com/creator/manual/zh/components/canvas.html",
|
||||
"spine": "https://docs.cocos.com/creator/manual/zh/components/spine.html",
|
||||
"widget": "https://docs.cocos.com/creator/manual/zh/components/widget.html",
|
||||
"button": "https://docs.cocos.com/creator/manual/zh/components/button.html",
|
||||
"progressbar": "https://docs.cocos.com/creator/manual/zh/components/progress.html",
|
||||
"mask": "https://docs.cocos.com/creator/manual/zh/components/mask.html",
|
||||
"scrollview": "https://docs.cocos.com/creator/manual/zh/components/scrollview.html",
|
||||
"scrollbar": "https://docs.cocos.com/creator/manual/zh/components/scrollbar.html",
|
||||
"layout": "https://docs.cocos.com/creator/manual/zh/components/layout.html",
|
||||
"tiledmap": "https://docs.cocos.com/creator/manual/zh/components/tiledmap.html",
|
||||
"editbox": "https://docs.cocos.com/creator/manual/zh/components/editbox.html",
|
||||
"videoplayer": "https://docs.cocos.com/creator/manual/zh/components/videoplayer.html",
|
||||
"motionStreak": "https://docs.cocos.com/creator/manual/zh/components/motion-streak.html",
|
||||
"richtext": "https://docs.cocos.com/creator/manual/zh/components/richtext.html",
|
||||
"pageview": "https://docs.cocos.com/creator/manual/zh/components/pageview.html",
|
||||
"pageviewIndicator": "https://docs.cocos.com/creator/manual/zh/components/pageviewindicator.html",
|
||||
"toggle": "https://docs.cocos.com/creator/manual/zh/components/toggle.html",
|
||||
"toggleGroup": "https://docs.cocos.com/creator/manual/zh/components/toggleGroup.html",
|
||||
"toggleContainer": "https://docs.cocos.com/creator/manual/zh/components/toggleContainer.html",
|
||||
"slider": "https://docs.cocos.com/creator/manual/zh/components/slider.html",
|
||||
"block_input_events": "https://docs.cocos.com/creator/manual/zh/components/block-input-events.html",
|
||||
"subcontext_view": "https://docs.cocos.com/creator/manual/zh/publish/publish-wechatgame-sub-domain.html",
|
||||
"safe_area": "https://docs.cocos.com/creator/manual/zh/components/safearea.html",
|
||||
"audiosource": "https://docs.cocos.com/creator/2.4/manual/zh/components/audiosource.html",
|
||||
"animation": "https://docs.cocos.com/creator/2.4/manual/zh/components/animation.html",
|
||||
"sprite": "https://docs.cocos.com/creator/2.4/manual/zh/components/sprite.html",
|
||||
"label": "https://docs.cocos.com/creator/2.4/manual/zh/components/label.html",
|
||||
"canvas": "https://docs.cocos.com/creator/2.4/manual/zh/components/canvas.html",
|
||||
"spine": "https://docs.cocos.com/creator/2.4/manual/zh/components/spine.html",
|
||||
"widget": "https://docs.cocos.com/creator/2.4/manual/zh/components/widget.html",
|
||||
"button": "https://docs.cocos.com/creator/2.4/manual/zh/components/button.html",
|
||||
"progressbar": "https://docs.cocos.com/creator/2.4/manual/zh/components/progress.html",
|
||||
"mask": "https://docs.cocos.com/creator/2.4/manual/zh/components/mask.html",
|
||||
"scrollview": "https://docs.cocos.com/creator/2.4/manual/zh/components/scrollview.html",
|
||||
"scrollbar": "https://docs.cocos.com/creator/2.4/manual/zh/components/scrollbar.html",
|
||||
"layout": "https://docs.cocos.com/creator/2.4/manual/zh/components/layout.html",
|
||||
"tiledmap": "https://docs.cocos.com/creator/2.4/manual/zh/components/tiledmap.html",
|
||||
"editbox": "https://docs.cocos.com/creator/2.4/manual/zh/components/editbox.html",
|
||||
"videoplayer": "https://docs.cocos.com/creator/2.4/manual/zh/components/videoplayer.html",
|
||||
"motionStreak": "https://docs.cocos.com/creator/2.4/manual/zh/components/motion-streak.html",
|
||||
"richtext": "https://docs.cocos.com/creator/2.4/manual/zh/components/richtext.html",
|
||||
"pageview": "https://docs.cocos.com/creator/2.4/manual/zh/components/pageview.html",
|
||||
"pageviewIndicator": "https://docs.cocos.com/creator/2.4/manual/zh/components/pageviewindicator.html",
|
||||
"toggle": "https://docs.cocos.com/creator/2.4/manual/zh/components/toggle.html",
|
||||
"toggleGroup": "https://docs.cocos.com/creator/2.4/manual/zh/components/toggleGroup.html",
|
||||
"toggleContainer": "https://docs.cocos.com/creator/2.4/manual/zh/components/toggleContainer.html",
|
||||
"slider": "https://docs.cocos.com/creator/2.4/manual/zh/components/slider.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/2.4/manual/zh/publish/publish-wechatgame-sub-domain.html",
|
||||
"safe_area": "https://docs.cocos.com/creator/2.4/manual/zh/components/safearea.html",
|
||||
},
|
||||
'animation': {
|
||||
'default_clip': '在勾选自动播放或调用 play() 时默认播放的动画 clip。',
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"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.",
|
||||
"homepage": "https://www.cocos.com",
|
||||
"license": "MIT",
|
||||
|
@ -132,7 +132,7 @@ function defineDeprecatedMacroGetter (name, defaultValue) {
|
||||
recommandedUsage = 'cc.sys.platform === cc.sys.WECHAT_GAME_SUB';
|
||||
}
|
||||
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') {
|
||||
recommandedUsage = 'cc.sys.platform === cc.sys.QQ_PLAY';
|
||||
@ -185,7 +185,7 @@ else {
|
||||
defineMacro('CC_JSB', defined('jsb') && !CC_RUNTIME);
|
||||
}
|
||||
|
||||
// deprecated
|
||||
// deprecated
|
||||
const WECHATGAMESUB = !!(defined('wx') && wx.getSharedCanvas);
|
||||
const WECHATGAME = !!(defined('wx') && (wx.getSystemInfoSync || wx.getSharedCanvas));
|
||||
const QQPLAY = defined('bk');
|
||||
@ -211,5 +211,5 @@ if (CC_DEV) {
|
||||
* If you post a bug to forum, please attach this flag.
|
||||
* @property {String} ENGINE_VERSION
|
||||
*/
|
||||
const engineVersion = '2.4.9';
|
||||
const engineVersion = '2.4.10';
|
||||
_global['CocosEngine'] = cc.ENGINE_VERSION = engineVersion;
|
||||
|
@ -3,8 +3,6 @@ let proto = cc.MotionStreak.__assembler__.MultiMotionStreakAssembler.prototype;
|
||||
let _update = proto.update;
|
||||
cc.js.mixin(proto, {
|
||||
update (comp, dt) {
|
||||
comp.node._updateWorldMatrix();
|
||||
|
||||
_update.call(this, comp, dt);
|
||||
|
||||
let { iData, usedVertices } = this._renderData._flexBuffer;
|
||||
|
@ -11,8 +11,6 @@ cc.js.mixin(proto, {
|
||||
this.ignoreOpacityFlag();
|
||||
},
|
||||
update (comp, dt) {
|
||||
comp.node._updateWorldMatrix();
|
||||
|
||||
_update.call(this, comp, dt);
|
||||
|
||||
let { iData, usedVertices } = this._renderData._flexBuffer;
|
||||
|
Loading…
Reference in New Issue
Block a user