mirror of
https://github.com/ifengzp/cocos-awesome.git
synced 2025-10-09 08:36:03 +00:00
feat: 增加其他场景切换效果
This commit is contained in:
@@ -192,7 +192,7 @@
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
769.0305585605815,
|
||||
452.93128617926146,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -2225,7 +2225,7 @@
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "SceneTransition",
|
||||
"_name": "ScreenTransition",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
@@ -2260,8 +2260,8 @@
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
667,
|
||||
375,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -2283,7 +2283,7 @@
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": "eeaY/+TfZLz4P/SykmO5T3"
|
||||
"_id": "e5RQj3G6VEhL2bHSWO3bD2"
|
||||
},
|
||||
{
|
||||
"__type__": "1cd9dHF3nRI24w/zAzyk3Q3",
|
||||
@@ -2295,10 +2295,31 @@
|
||||
"_enabled": true,
|
||||
"time": 0,
|
||||
"materials": [
|
||||
{
|
||||
"__uuid__": "94d8d991-9e84-4d88-89f7-33d14f1bc9bf"
|
||||
},
|
||||
{
|
||||
"__uuid__": "c27b1317-6f94-4d6c-9760-adee279b2ad4"
|
||||
},
|
||||
{
|
||||
"__uuid__": "acd92272-4481-49c6-81ef-5ae28e699ecf"
|
||||
},
|
||||
{
|
||||
"__uuid__": "dbf06bcd-8024-4f08-a535-08f7383edf00"
|
||||
},
|
||||
{
|
||||
"__uuid__": "985a2d90-fd09-4d07-9d94-a50d5af116d9"
|
||||
},
|
||||
{
|
||||
"__uuid__": "a869ac13-ffed-4334-b5df-1251273f2b07"
|
||||
},
|
||||
{
|
||||
"__uuid__": "ee73e8c0-5ff0-486a-bcdf-dec85b04755b"
|
||||
},
|
||||
{
|
||||
"__uuid__": "6dd2566a-a5ef-48ff-a3a2-521163be1e1e"
|
||||
}
|
||||
],
|
||||
"_id": "606YRpjk1JGqOLoeXBmJQ3"
|
||||
"_id": "e6NgBxPOVL9YQp8rpWon4s"
|
||||
}
|
||||
]
|
@@ -13,7 +13,6 @@ enum sceneList {
|
||||
'Specular_gloss' = '镜面光泽效果(shader)',
|
||||
'Metaball' = '融球效果(shader)',
|
||||
'Bullet_Tracking' = '子弹跟踪效果',
|
||||
'SwitchScene__SquaresWire' = '场景切换(Squares Wire)',
|
||||
'Circle_avatar' = '圆形头像(shader)',
|
||||
'Coin_fly_to_wallet' = '金币落袋效果',
|
||||
'Infinite_bg_scroll' = '背景无限滚动',
|
||||
@@ -22,6 +21,14 @@ enum sceneList {
|
||||
'Joystick' = '遥控杆',
|
||||
'Filter' = '颜色滤镜',
|
||||
'Photo_gallery' = '渐变过渡的相册(shader)',
|
||||
'SwitchScene__DoomScreen' = '场景切换效果一',
|
||||
'SwitchScene__GlitchMemories' = '场景切换效果二',
|
||||
'SwitchScene__Morph' = '场景切换效果三',
|
||||
'SwitchScene__Perlin' = '场景切换效果四',
|
||||
'SwitchScene__PolkaDotsCurtain' = '场景切换效果五',
|
||||
'SwitchScene__SquaresWire' = '场景切换效果六',
|
||||
'SwitchScene__Strip' = '场景切换效果七',
|
||||
'SwitchScene__Wind' = '场景切换效果八',
|
||||
}
|
||||
|
||||
@ccclass
|
||||
|
@@ -31,9 +31,10 @@ export default class Transition extends cc.Component {
|
||||
cc.director.on('switchSceneByTransition', this.switchSceneByTransition.bind(this));
|
||||
}
|
||||
|
||||
switchSceneByTransition() {
|
||||
this.materialIndex = this.materialIndex + 1 > this.materials.length ? 0 : this.materialIndex + 1;
|
||||
this.loadScene('Scene/Home/Home', 'Canvas/Main Camera', 'Canvas/Main Camera');
|
||||
switchSceneByTransition(index) {
|
||||
this.materialIndex = Number(index || 0);
|
||||
this.updateSpriteMaterial();
|
||||
setTimeout(() => this.loadScene('Scene/Home/Home', 'Canvas/Main Camera', 'Canvas/Main Camera'));
|
||||
}
|
||||
|
||||
init() {
|
||||
@@ -85,7 +86,8 @@ export default class Transition extends cc.Component {
|
||||
let newMaterial = cc.MaterialVariant.create(this.materials[this.materialIndex], this._sprite);
|
||||
newMaterial.setProperty('texture', this._texture1);
|
||||
newMaterial.setProperty('texture2', this._texture2);
|
||||
newMaterial.setProperty('screenSize', new Float32Array([this._texture2.width, this._texture2.height]));
|
||||
if (this.materialIndex == 6)
|
||||
newMaterial.setProperty('screenSize', new Float32Array([this._texture2.width, this._texture2.height]));
|
||||
|
||||
this._sprite.setMaterial(0, newMaterial);
|
||||
this._spriteMaterial = newMaterial;
|
Reference in New Issue
Block a user