Commit 4d38d9db authored by 徐行's avatar 徐行

加入跑马灯

parent bbbb6e38
...@@ -58,7 +58,7 @@ export class VHFillNumCtr extends Component { ...@@ -58,7 +58,7 @@ export class VHFillNumCtr extends Component {
private itemPosIfoArr: ItemPosIfo[] = []; private itemPosIfoArr: ItemPosIfo[] = [];
private row = 4; private row = 4;
private column = 4; private column = 4;
private level = 4; private level = 1;
private levelData: VHFillNumCfg = null!; private levelData: VHFillNumCfg = null!;
private selNum = 0; private selNum = 0;
......
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "c5428188-a2b0-46a8-bac5-47e675e18b4f",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}
{
"ver": "1.0.21",
"importer": "image",
"imported": true,
"uuid": "99d6b97c-88c0-4e9c-bc13-b470c88a510a",
"files": [
".png",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "99d6b97c-88c0-4e9c-bc13-b470c88a510a@6c48a",
"displayName": "切换APP也许会让你的做题结果丢失哦~",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "99d6b97c-88c0-4e9c-bc13-b470c88a510a"
},
"ver": "1.0.21",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "99d6b97c-88c0-4e9c-bc13-b470c88a510a@f9941",
"displayName": "切换APP也许会让你的做题结果丢失哦~",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 419,
"height": 23,
"rawWidth": 419,
"rawHeight": 23,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "99d6b97c-88c0-4e9c-bc13-b470c88a510a@6c48a",
"atlasUuid": ""
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"redirect": "99d6b97c-88c0-4e9c-bc13-b470c88a510a@f9941"
}
}
{
"ver": "1.0.21",
"importer": "image",
"imported": true,
"uuid": "9444e2cf-8fd8-4043-917a-f152c9aeb0c0",
"files": [
".png",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "9444e2cf-8fd8-4043-917a-f152c9aeb0c0@6c48a",
"displayName": "千万不要走开或切换APP哦~",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "9444e2cf-8fd8-4043-917a-f152c9aeb0c0"
},
"ver": "1.0.21",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "9444e2cf-8fd8-4043-917a-f152c9aeb0c0@f9941",
"displayName": "千万不要走开或切换APP哦~",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 298,
"height": 23,
"rawWidth": 298,
"rawHeight": 23,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "9444e2cf-8fd8-4043-917a-f152c9aeb0c0@6c48a",
"atlasUuid": ""
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"redirect": "9444e2cf-8fd8-4043-917a-f152c9aeb0c0@f9941"
}
}
{
"ver": "1.0.21",
"importer": "image",
"imported": true,
"uuid": "822b9ab9-244e-4fa3-9780-596c5fbf0039",
"files": [
".png",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "822b9ab9-244e-4fa3-9780-596c5fbf0039@6c48a",
"displayName": "如果有错题,还可以记录一下哦~备份",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "822b9ab9-244e-4fa3-9780-596c5fbf0039"
},
"ver": "1.0.21",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "822b9ab9-244e-4fa3-9780-596c5fbf0039@f9941",
"displayName": "如果有错题,还可以记录一下哦~备份",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 348,
"height": 24,
"rawWidth": 348,
"rawHeight": 24,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "822b9ab9-244e-4fa3-9780-596c5fbf0039@6c48a",
"atlasUuid": ""
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"redirect": "822b9ab9-244e-4fa3-9780-596c5fbf0039@f9941"
}
}
{
"ver": "1.0.21",
"importer": "image",
"imported": true,
"uuid": "dc691ce3-f255-4d8c-8de8-26f2f1666db3",
"files": [
".png",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "dc691ce3-f255-4d8c-8de8-26f2f1666db3@6c48a",
"displayName": "扭扭脖子,闭闭眼睛,休息一下~",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "dc691ce3-f255-4d8c-8de8-26f2f1666db3"
},
"ver": "1.0.21",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "dc691ce3-f255-4d8c-8de8-26f2f1666db3@f9941",
"displayName": "扭扭脖子,闭闭眼睛,休息一下~",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 349,
"height": 24,
"rawWidth": 349,
"rawHeight": 24,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "dc691ce3-f255-4d8c-8de8-26f2f1666db3@6c48a",
"atlasUuid": ""
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"redirect": "dc691ce3-f255-4d8c-8de8-26f2f1666db3@f9941"
}
}
{
"ver": "1.0.21",
"importer": "image",
"imported": true,
"uuid": "cfbb7123-fce2-48cc-b00e-3cc3f931b302",
"files": [
".png",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "cfbb7123-fce2-48cc-b00e-3cc3f931b302@6c48a",
"displayName": "请稍等一下哦,其他同学正在作答~备份",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "cfbb7123-fce2-48cc-b00e-3cc3f931b302"
},
"ver": "1.0.21",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "cfbb7123-fce2-48cc-b00e-3cc3f931b302@f9941",
"displayName": "请稍等一下哦,其他同学正在作答~备份",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 372,
"height": 24,
"rawWidth": 372,
"rawHeight": 24,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "cfbb7123-fce2-48cc-b00e-3cc3f931b302@6c48a",
"atlasUuid": ""
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"redirect": "cfbb7123-fce2-48cc-b00e-3cc3f931b302@f9941"
}
}
{
"ver": "1.0.21",
"importer": "image",
"imported": true,
"uuid": "a71dbc5b-62e4-4018-8af0-6493983a687b",
"files": [
".png",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "a71dbc5b-62e4-4018-8af0-6493983a687b@6c48a",
"displayName": "课程还在继续,极客小队需要你的帮助~",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "a71dbc5b-62e4-4018-8af0-6493983a687b"
},
"ver": "1.0.21",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "a71dbc5b-62e4-4018-8af0-6493983a687b@f9941",
"displayName": "课程还在继续,极客小队需要你的帮助~",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 420,
"height": 24,
"rawWidth": 420,
"rawHeight": 24,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "a71dbc5b-62e4-4018-8af0-6493983a687b@6c48a",
"atlasUuid": ""
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"redirect": "a71dbc5b-62e4-4018-8af0-6493983a687b@f9941"
}
}
import { _decorator, Component, Node, UITransform, MaskComponent, Mask, v3, CCBoolean, CCFloat } from 'cc';
const { ccclass, property } = _decorator;
/**
* Predefined variables
* Name = HorseRaceLamp
* DateTime = Thu Apr 14 2022 13:33:51 GMT+0800 (GMT+08:00)
* Author = 天道纵横
* FileBasename = HorseRaceLamp.ts
* FileBasenameNoExtension = HorseRaceLamp
* URL = db://assets/script/HorseRaceLamp.ts
* ManualUrl = https://docs.cocos.com/creator/3.3/manual/zh/
*
*/
@ccclass('HorseRaceLamp')
export class HorseRaceLamp extends Component {
@property(CCBoolean)
isVertical: boolean = true; //是不是竖着
@property(CCFloat)
speed: number = 8;
@property(CCFloat)
spacing: number = 10;
private _height = 1;
private _width = 1;
start() {
// [3]
this.node.layer = 1 << 25;
if (this.node.children.length == 0) return;
for (let i = 0; i < this.node.children.length; ++i) {
this._height = this.node.children[i].getComponent(UITransform).height > this._height ? this.node.children[i].getComponent(UITransform).height : this._height;
this._width = this.node.children[i].getComponent(UITransform).width > this._width ? this.node.children[i].getComponent(UITransform).width : this._width;
}
this._height += this.spacing;
this._width += this.spacing;
this.node.getComponent(UITransform).width = this._width;
this.node.getComponent(UITransform).height = this._height;
if (!this.node.getComponent(MaskComponent)) {
let mask = this.node.addComponent(MaskComponent);
}
for (let i = 0; i < this.node.children.length; ++i) {
if (this.isVertical) {
this.node.children[i].setPosition(v3(0, 0 - i * this._height, 0));
}
else {
this.node.children[i].setPosition(v3(0 + i * this._width, 0, 0));
}
}
}
update(deltaTime: number) {
// [4]
if (this.node.children.length == 1) return;
for (let i = 0; i < this.node.children.length; ++i) {
let pos = this.node.children[i].getPosition();
if (this.isVertical) {
let minY = 0;
for (let i = 0; i < this.node.children.length; ++i) {
if (minY > this.node.children[i].getPosition().y) {
minY = this.node.children[i].getPosition().y;
}
}
this.node.children[i].setPosition(v3(0, pos.y + this.speed * deltaTime, 0));
if (this.node.children[i].getPosition().y >= this._height) {
minY = minY - this._height;
this.node.children[i].setPosition(v3(0, minY));
}
}
else {
let minX = 0;
for (let i = 0; i < this.node.children.length; ++i) {
if (minX < this.node.children[i].getPosition().x) {
minX = this.node.children[i].getPosition().x;
}
}
this.node.children[i].setPosition(v3(pos.x - this.speed * deltaTime, 0, 0));
if (this.node.children[i].getPosition().x <= this._width) {
minX = minX + this._width;
this.node.children[i].setPosition(v3(minX, 0));
}
}
}
}
}
/**
* [1] Class member could be defined like this.
* [2] Use `property` decorator if your want the member to be serializable.
* [3] Your initialization goes here.
* [4] Your update function goes here.
*
* Learn more about scripting: https://docs.cocos.com/creator/3.3/manual/zh/scripting/
* Learn more about CCClass: https://docs.cocos.com/creator/3.3/manual/zh/scripting/ccclass.html
* Learn more about life-cycle callbacks: https://docs.cocos.com/creator/3.3/manual/zh/scripting/life-cycle-callbacks.html
*/
{
"ver": "4.0.22",
"importer": "typescript",
"imported": true,
"uuid": "21fc9dc7-c304-4af4-95fd-de98d1c8ce06",
"files": [],
"subMetas": {},
"userData": {}
}
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