Commit e6a58718 authored by liujiangnan's avatar liujiangnan

feat: 摩天轮滚动效果

parent b9610f59
import { RandomInt } from "../script/util";
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property
rotate: number = 10;
basePos: cc.Vec2;
start() {
this.basePos = this.node.getPosition();
this.float();
}
float() {
const rotation = RandomInt(this.rotate, -this.rotate);
cc.tween(this.node)
.to(RandomInt(2, 4), {
angle: rotation,
}, { easing: 'sineInOut' })
.to(RandomInt(2, 4), {
angle: -rotation,
}, { easing: 'sineInOut' })
.call(() => {
this.float();
})
.start();
}
}
{
"ver": "1.0.8",
"uuid": "d11b3378-e2e7-45c2-aba9-672280474f96",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
......@@ -78,13 +78,13 @@
"_active": true,
"_components": [
{
"__id__": 56
"__id__": 61
},
{
"__id__": 57
"__id__": 62
},
{
"__id__": 58
"__id__": 63
}
],
"_prefab": null,
......@@ -245,22 +245,22 @@
"__id__": 6
},
{
"__id__": 44
"__id__": 49
},
{
"__id__": 47
"__id__": 52
},
{
"__id__": 51
"__id__": 56
}
],
"_active": true,
"_components": [
{
"__id__": 54
"__id__": 59
},
{
"__id__": 55
"__id__": 60
}
],
"_prefab": null,
......@@ -323,25 +323,25 @@
"__id__": 7
},
{
"__id__": 14
"__id__": 15
},
{
"__id__": 21
"__id__": 23
},
{
"__id__": 28
"__id__": 31
},
{
"__id__": 35
"__id__": 39
}
],
"_active": true,
"_components": [
{
"__id__": 42
"__id__": 47
},
{
"__id__": 43
"__id__": 48
}
],
"_prefab": null,
......@@ -414,6 +414,9 @@
},
{
"__id__": 13
},
{
"__id__": 14
}
],
"_prefab": null,
......@@ -678,7 +681,7 @@
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_isTrimmedMode": false,
"_atlas": null,
"_id": "40TXFdXUVK85d2sQFmpF24"
},
......@@ -750,6 +753,17 @@
"_N$target": null,
"_id": "d8Hnt37aNGXZtTAZ7vxo1n"
},
{
"__type__": "d11b3N44udFwqupZyKAR0+W",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"rotate": 10,
"_id": "b0qNLToulLGoOj8/2FRtbR"
},
{
"__type__": "cc.Node",
"_name": "star_1",
......@@ -759,19 +773,22 @@
},
"_children": [
{
"__id__": 15
"__id__": 16
},
{
"__id__": 17
"__id__": 18
}
],
"_active": true,
"_components": [
{
"__id__": 19
"__id__": 20
},
{
"__id__": 20
"__id__": 21
},
{
"__id__": 22
}
],
"_prefab": null,
......@@ -827,13 +844,13 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 14
"__id__": 15
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 16
"__id__": 17
}
],
"_prefab": null,
......@@ -889,7 +906,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 15
"__id__": 16
},
"_enabled": true,
"_materials": [
......@@ -921,13 +938,13 @@
"_name": "lock",
"_objFlags": 0,
"_parent": {
"__id__": 14
"__id__": 15
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 18
"__id__": 19
}
],
"_prefab": null,
......@@ -983,7 +1000,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
"__id__": 18
},
"_enabled": true,
"_materials": [
......@@ -1015,7 +1032,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
"__id__": 15
},
"_enabled": true,
"_materials": [
......@@ -1045,7 +1062,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
"__id__": 15
},
"_enabled": true,
"_normalMaterial": null,
......@@ -1108,6 +1125,17 @@
"_N$target": null,
"_id": "60VUZZkj5AfYKtRclmmHpY"
},
{
"__type__": "d11b3N44udFwqupZyKAR0+W",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 15
},
"_enabled": true,
"rotate": 10,
"_id": "5dxBgU9p5HeKQnuhXJ7gx2"
},
{
"__type__": "cc.Node",
"_name": "star_2",
......@@ -1117,19 +1145,22 @@
},
"_children": [
{
"__id__": 22
"__id__": 24
},
{
"__id__": 24
"__id__": 26
}
],
"_active": true,
"_components": [
{
"__id__": 26
"__id__": 28
},
{
"__id__": 27
"__id__": 29
},
{
"__id__": 30
}
],
"_prefab": null,
......@@ -1185,13 +1216,13 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 21
"__id__": 23
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 23
"__id__": 25
}
],
"_prefab": null,
......@@ -1247,7 +1278,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
"__id__": 24
},
"_enabled": true,
"_materials": [
......@@ -1279,13 +1310,13 @@
"_name": "lock",
"_objFlags": 0,
"_parent": {
"__id__": 21
"__id__": 23
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 25
"__id__": 27
}
],
"_prefab": null,
......@@ -1341,7 +1372,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 24
"__id__": 26
},
"_enabled": true,
"_materials": [
......@@ -1373,7 +1404,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
"__id__": 23
},
"_enabled": true,
"_materials": [
......@@ -1403,7 +1434,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
"__id__": 23
},
"_enabled": true,
"_normalMaterial": null,
......@@ -1466,6 +1497,17 @@
"_N$target": null,
"_id": "5frveIvU9DSaPXx28UMQSn"
},
{
"__type__": "d11b3N44udFwqupZyKAR0+W",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 23
},
"_enabled": true,
"rotate": 10,
"_id": "723U90GXpOu4gJ9z+q7QLG"
},
{
"__type__": "cc.Node",
"_name": "star_3",
......@@ -1475,19 +1517,22 @@
},
"_children": [
{
"__id__": 29
"__id__": 32
},
{
"__id__": 31
"__id__": 34
}
],
"_active": true,
"_components": [
{
"__id__": 33
"__id__": 36
},
{
"__id__": 34
"__id__": 37
},
{
"__id__": 38
}
],
"_prefab": null,
......@@ -1543,13 +1588,13 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 28
"__id__": 31
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 30
"__id__": 33
}
],
"_prefab": null,
......@@ -1605,7 +1650,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 29
"__id__": 32
},
"_enabled": true,
"_materials": [
......@@ -1637,13 +1682,13 @@
"_name": "lock",
"_objFlags": 0,
"_parent": {
"__id__": 28
"__id__": 31
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 32
"__id__": 35
}
],
"_prefab": null,
......@@ -1699,7 +1744,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 31
"__id__": 34
},
"_enabled": true,
"_materials": [
......@@ -1731,7 +1776,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 28
"__id__": 31
},
"_enabled": true,
"_materials": [
......@@ -1761,7 +1806,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 28
"__id__": 31
},
"_enabled": true,
"_normalMaterial": null,
......@@ -1824,6 +1869,17 @@
"_N$target": null,
"_id": "c3lPs0AzVHTaa8dNpPnQCS"
},
{
"__type__": "d11b3N44udFwqupZyKAR0+W",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 31
},
"_enabled": true,
"rotate": 10,
"_id": "42QO8Pq7xAs7o0RT/PuAuj"
},
{
"__type__": "cc.Node",
"_name": "star_4",
......@@ -1833,19 +1889,22 @@
},
"_children": [
{
"__id__": 36
"__id__": 40
},
{
"__id__": 38
"__id__": 42
}
],
"_active": true,
"_components": [
{
"__id__": 40
"__id__": 44
},
{
"__id__": 41
"__id__": 45
},
{
"__id__": 46
}
],
"_prefab": null,
......@@ -1901,13 +1960,13 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 35
"__id__": 39
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 37
"__id__": 41
}
],
"_prefab": null,
......@@ -1963,7 +2022,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 36
"__id__": 40
},
"_enabled": true,
"_materials": [
......@@ -1995,13 +2054,13 @@
"_name": "lock",
"_objFlags": 0,
"_parent": {
"__id__": 35
"__id__": 39
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 39
"__id__": 43
}
],
"_prefab": null,
......@@ -2057,7 +2116,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 38
"__id__": 42
},
"_enabled": true,
"_materials": [
......@@ -2089,7 +2148,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 35
"__id__": 39
},
"_enabled": true,
"_materials": [
......@@ -2119,7 +2178,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 35
"__id__": 39
},
"_enabled": true,
"_normalMaterial": null,
......@@ -2182,6 +2241,17 @@
"_N$target": null,
"_id": "c8+Go/aBlNcYywwkIKuu8b"
},
{
"__type__": "d11b3N44udFwqupZyKAR0+W",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 39
},
"_enabled": true,
"rotate": 10,
"_id": "0f0jSnhb5Po5QrEgifeAWD"
},
{
"__type__": "cc.Sprite",
"_name": "",
......@@ -2252,10 +2322,10 @@
"_active": true,
"_components": [
{
"__id__": 45
"__id__": 50
},
{
"__id__": 46
"__id__": 51
}
],
"_prefab": null,
......@@ -2311,7 +2381,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 44
"__id__": 49
},
"_enabled": true,
"_materials": [
......@@ -2343,7 +2413,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 44
"__id__": 49
},
"_enabled": true,
"alignMode": 1,
......@@ -2376,13 +2446,13 @@
"_active": true,
"_components": [
{
"__id__": 48
"__id__": 53
},
{
"__id__": 49
"__id__": 54
},
{
"__id__": 50
"__id__": 55
}
],
"_prefab": null,
......@@ -2438,7 +2508,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 47
"__id__": 52
},
"_enabled": true,
"_materials": [
......@@ -2470,7 +2540,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 47
"__id__": 52
},
"_enabled": true,
"alignMode": 1,
......@@ -2497,7 +2567,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 47
"__id__": 52
},
"_enabled": true,
"_normalMaterial": null,
......@@ -2558,7 +2628,7 @@
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 47
"__id__": 52
},
"_id": "57sri6u3tM1YhZPPIbspjz"
},
......@@ -2573,10 +2643,10 @@
"_active": true,
"_components": [
{
"__id__": 52
"__id__": 57
},
{
"__id__": 53
"__id__": 58
}
],
"_prefab": null,
......@@ -2632,7 +2702,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 51
"__id__": 56
},
"_enabled": true,
"_materials": [
......@@ -2664,7 +2734,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 51
"__id__": 56
},
"_enabled": true,
"alignMode": 1,
......
import { asyncCallNetworkApiGet, asyncCallNetworkApiPost, asyncDelay, buttonOnClick, onHomeworkFinish } from "../script/util";
import { asyncCallNetworkApiGet, asyncCallNetworkApiPost, asyncDelay, buttonOnClick, onHomeworkFinish, jumpToBundle } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
const { ccclass, property } = cc._decorator;
......@@ -23,6 +23,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
return null;
}
showTips(tips) {
const middleLayer = cc.find('middleLayer');
if (!middleLayer) {
console.log(tips);
return;
}
middleLayer.getComponent('middleLayer').showTips(tips);
}
async onLoadEnd() {
const middleLayer = cc.find('middleLayer');
......@@ -35,20 +44,24 @@ export default class SceneComponent extends MyCocosSceneComponent {
});
const kidData = JSON.parse(kidDataStr);
if(!kidData.data || !kidData.data.id) {
middleLayer.getComponent('middleLayer').showTips("用户登录失效,请重新登录");
middleLayer.getComponent('middleLayer').loadOnlineBundle("NJ_login");
this.showTips("用户登录失效,请重新登录");
jumpToBundle("NJ_login");
return;
}
const btnReturn = cc.find('Canvas/bg/btn_return');
buttonOnClick(btnReturn, () => {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
middleLayer.getComponent('middleLayer').loadOnlineBundle('NJ_YouLeChang');
}
jumpToBundle('NJ_YouLeChang');
});
const pid = middleLayer.getComponent('middleLayer').getData('NJ_MoTianLun');
// 播放背景音乐
cc.audioEngine.stopMusic();
cc.audioEngine.playMusic(this.bgMusic1, true);
if(!middleLayer) {
return;
}
const pid = middleLayer.getComponent('middleLayer').getData('NJ_MoTianLun');
const classDataStr = await asyncCallNetworkApiGet('/api/syllabus/v1/list', {
pid: pid
});
......@@ -63,7 +76,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
return { id: row.id, locked: locked };
});
console.log(ballData);
ballData.forEach((data, idx) => {
if (idx >= 5) {
......@@ -108,9 +120,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
});
});
// 播放背景音乐
cc.audioEngine.stopMusic();
cc.audioEngine.playMusic(this.bgMusic1, true);
}
protected update(dt: number): void {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment