[add] init

This commit is contained in:
2022-03-07 09:15:59 +08:00
commit cbcd795667
421 changed files with 61342 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
const { ccclass, property } = cc._decorator;
@ccclass
export default class BackHomeBtn extends cc.Component {
static instance: BackHomeBtn = null;
onLoad() {
cc.game.addPersistRootNode(this.node);
BackHomeBtn.instance = this;
this.toggleActive(false);
}
toggleActive(flag: boolean) {
this.node.active = flag;
}
backToHome() {
this.toggleActive(false);
cc.director.loadScene('Home');
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "f673b6fd-1d6c-4444-a3f8-ad4361ce0e36",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

2223
assets/Scene/Home/Home.fire Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
{
"ver": "1.2.6",
"uuid": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}
}

125
assets/Scene/Home/Home.ts Normal file
View File

@@ -0,0 +1,125 @@
import BackHomeBtn from './BackHomeBtn';
const { ccclass, property } = cc._decorator;
const LOAD_SCENE_MIN_SEC: number = 1.2;
enum sceneList {
'Water_spread' = '水波扩散效果shader',
'Specular_gloss' = '镜面光泽效果shader',
'Dissolve_color' = '溶解效果shader',
'Follow_spot' = '追光效果shader',
'Metaball' = '融球效果shader',
'Circle_avatar' = '圆形头像shader',
'Scratch_ticket' = '刮刮卡实现',
'Coin_fly_to_wallet' = '金币落袋效果',
'Moving_ghost' = '移动残影效果',
'Magnifying_mirror' = '放大镜效果',
'Typer' = '打字机效果',
'Bullet_Tracking' = '子弹跟踪效果',
'Infinite_bg_scroll' = '背景无限滚动',
'Change_clothes' = '换装',
'Screen_vibrating' = '震屏效果+动画恢复第一帧',
'Joystick' = '遥控杆',
'Filter' = '颜色滤镜',
'Mosaic' = '马赛克/像素风shader',
'Photo_gallery' = '渐变过渡的相册shader'
}
@ccclass
export default class Home extends cc.Component {
@property(cc.Node)
loadingNode: cc.Node = null;
@property(cc.ProgressBar)
loadingProgress: cc.ProgressBar = null;
@property(cc.Node)
scrollContent: cc.Node = null;
@property(cc.Prefab)
scrollItemPrefab: cc.Prefab = null;
onLoad() {
this.initScrollItem();
}
start() {
this.judgeJump();
}
judgeJump() {
const sceneName = this.getQueryStringByName('sceneName');
const isSameVisit = window['isSameVisit'];
if (!sceneName) return;
if (isSameVisit) return;
if (sceneList[sceneName]) {
window['isSameVisit'] = true;
this.loadScene(sceneName);
}
}
getQueryStringByName(name) {
let result = window.location.search.match(new RegExp('[?&]' + name + '=([^&]+)', 'i'));
return result == null || result.length < 1 ? '' : result[1];
}
initScrollItem() {
for (let key in sceneList) {
let scrollItem = cc.instantiate(this.scrollItemPrefab);
scrollItem.getChildByName('label').getComponent(cc.Label).string = sceneList[key];
scrollItem.on(
cc.Node.EventType.TOUCH_END,
() => {
cc.tween(scrollItem)
.to(0.1, { scale: 1.05 })
.to(0.1, { scale: 1 })
.start();
this.loadScene(key);
},
this
);
this.scrollContent.addChild(scrollItem);
}
}
beginLoad: boolean = false;
finishLoadFlag: boolean = false;
loadTime: number = 0;
loadSceneName: string = '';
loadScene(key) {
if (this.beginLoad) return;
this.loadingProgress.progress = 0;
this.loadingNode.active = true;
this.beginLoad = true;
this.loadSceneName = key;
cc.director.preloadScene(
key,
(completedCount, totalCount) => {
// 还是做假进度条吧,缓存之后太快了,一闪而过的体验不好
// this.loadingProgress.progress = completedCount / totalCount;
},
(error, asset) => {
if (!error) {
this.finishLoadFlag = true;
} else {
this.loadingNode.active = false;
this.beginLoad = false;
this.loadTime = 0;
}
}
);
}
update(dt) {
if (!this.beginLoad) return;
if (this.loadTime >= LOAD_SCENE_MIN_SEC && this.finishLoadFlag) {
this.loadingProgress.progress = 1;
BackHomeBtn.instance.toggleActive(true);
cc.director.loadScene(this.loadSceneName);
} else {
this.loadTime += dt;
this.loadingProgress.progress = Math.min(this.loadTime / LOAD_SCENE_MIN_SEC, this.finishLoadFlag ? 1 : 0.9);
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "e1b90feb-a217-4493-849d-9a611900d683",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,230 @@
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "item",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [
{
"__id__": 5
}
],
"_prefab": {
"__id__": 6
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 600,
"height": 80
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-50,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 42.84
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_useOriginalSize": false,
"_string": "",
"_N$string": "",
"_fontSize": 34,
"_lineHeight": 34,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "3c27b0d3-bf66-47a2-b6a8-09ca24132944"
},
"fileId": "5fsPWB4+dB6ofv9Y3zSWuP",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "847da4e2-76e3-4ff9-9314-713438721842"
},
"_type": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "3c27b0d3-bf66-47a2-b6a8-09ca24132944"
},
"fileId": "42ek6+2rFCX6JVYDIZhLy9",
"sync": false
}
]

View File

@@ -0,0 +1,8 @@
{
"ver": "1.2.6",
"uuid": "3c27b0d3-bf66-47a2-b6a8-09ca24132944",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}

View File

@@ -0,0 +1,6 @@
{
"ver": "1.0.1",
"uuid": "7b81d4e8-ec84-4716-968d-500ac1d78a54",
"isGroup": false,
"subMetas": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 KiB

View File

@@ -0,0 +1,36 @@
{
"ver": "2.3.4",
"uuid": "faefe167-15a3-45f1-8281-920ba11dd0f6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1350,
"height": 1350,
"platformSettings": {},
"subMetas": {
"avatar": {
"ver": "1.0.4",
"uuid": "ee4860e7-78d7-4f1a-a1e2-e2c9201ef1b0",
"rawTextureUuid": "faefe167-15a3-45f1-8281-920ba11dd0f6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1350,
"height": 1350,
"rawWidth": 1350,
"rawHeight": 1350,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -0,0 +1,36 @@
{
"ver": "2.3.4",
"uuid": "e39bafdb-a71e-4fd7-8450-1fa436d9c50a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 200,
"height": 200,
"platformSettings": {},
"subMetas": {
"back": {
"ver": "1.0.4",
"uuid": "714299b3-6ffd-4ba5-a166-296176854549",
"rawTextureUuid": "e39bafdb-a71e-4fd7-8450-1fa436d9c50a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 3,
"offsetY": 3,
"trimX": 23,
"trimY": 7,
"width": 160,
"height": 180,
"rawWidth": 200,
"rawHeight": 200,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -0,0 +1,36 @@
{
"ver": "2.3.4",
"uuid": "2451b5cb-c23f-44c9-99c7-49da350ca9b1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 345,
"height": 132,
"platformSettings": {},
"subMetas": {
"btn": {
"ver": "1.0.4",
"uuid": "847da4e2-76e3-4ff9-9314-713438721842",
"rawTextureUuid": "2451b5cb-c23f-44c9-99c7-49da350ca9b1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0.5,
"trimX": 0,
"trimY": 0,
"width": 345,
"height": 131,
"rawWidth": 345,
"rawHeight": 132,
"borderTop": 61.5,
"borderBottom": 59.5,
"borderLeft": 114,
"borderRight": 127,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -0,0 +1,36 @@
{
"ver": "2.3.4",
"uuid": "b7a2debd-36ee-4af0-abf4-1fbde3a8cb9a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 258,
"height": 258,
"platformSettings": {},
"subMetas": {
"ewm": {
"ver": "1.0.4",
"uuid": "802b4004-09af-4e51-9f68-21dbc96a0e02",
"rawTextureUuid": "b7a2debd-36ee-4af0-abf4-1fbde3a8cb9a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 258,
"height": 258,
"rawWidth": 258,
"rawHeight": 258,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

View File

@@ -0,0 +1,36 @@
{
"ver": "2.3.4",
"uuid": "8e1ba190-72f0-4014-9bd1-03fd704b1ae2",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2,
"height": 2,
"platformSettings": {},
"subMetas": {
"singleColor": {
"ver": "1.0.4",
"uuid": "0f531716-c3f6-47e8-be65-4248dfca78d8",
"rawTextureUuid": "8e1ba190-72f0-4014-9bd1-03fd704b1ae2",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 2,
"height": 2,
"rawWidth": 2,
"rawHeight": 2,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}