feat: add booster

main
tiendat3699 2024-03-27 18:00:23 +07:00
parent e5b6cb1e32
commit 339bb55642
30 changed files with 2528 additions and 1159 deletions

View File

@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "dbeb478b-2f4c-4307-9a55-7342461c65f4",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@ -0,0 +1,330 @@
[
{
"__type__": "cc.Prefab",
"_name": "CumulativeBooster",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "CumulativeBooster",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [
{
"__id__": 8
},
{
"__id__": 10
},
{
"__id__": 12
},
{
"__id__": 14
}
],
"_prefab": {
"__id__": 16
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -202.337,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "Sprite",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
},
{
"__id__": 5
}
],
"_prefab": {
"__id__": 7
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 4
},
"_contentSize": {
"__type__": "cc.Size",
"width": 104,
"height": 87
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "48qdc0dJ5PwaJGgbJlIldY"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 6
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "461cbbbe-573a-4553-9ddc-f8723c11206a@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f2AlHL9HlCkZ2P2tFSgZM/"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "99zWDiJvZPpJVRFmhMOLws",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 9
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 80
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "6bAOnxBGhIIqgJEkV8yqp1"
},
{
"__type__": "366a4horc9BIpj097ERzLW3",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 11
},
"_collider": {
"__id__": 12
},
"time": 10,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f4W1WDiHtNkaAloE7yUyI6"
},
{
"__type__": "cc.BoxCollider2D",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 13
},
"tag": 0,
"_group": 2,
"_density": 1,
"_sensor": true,
"_friction": 0.2,
"_restitution": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_size": {
"__type__": "cc.Size",
"width": 100,
"height": 80
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "05/UHTO9dAkZ4S5cDk8lpn"
},
{
"__type__": "cc.RigidBody2D",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 15
},
"enabledContactListener": true,
"bullet": false,
"awakeOnLoad": true,
"_group": 2,
"_type": 1,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "76wquyK7pCTZTexuJap3by"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "04M51kNIhABrWjOmAN7uJ4",
"instance": null,
"targetOverrides": null
}
]

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.43",
"importer": "prefab",
"imported": true,
"uuid": "fefef5ec-f5cc-45f8-8e6f-4489f610b249",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "CumulativeBooster"
}
}

View File

@ -321,7 +321,7 @@
"__uuid__": "1f602e14-2769-4903-b4d2-b0977eeaf36b",
"__expectedType__": "cc.AudioClip"
},
"_score": 2,
"_score": 10,
"_bonusTime": 0,
"_id": ""
},

View File

@ -321,7 +321,7 @@
"__uuid__": "1f602e14-2769-4903-b4d2-b0977eeaf36b",
"__expectedType__": "cc.AudioClip"
},
"_score": 1,
"_score": 5,
"_bonusTime": 0,
"_id": ""
},

File diff suppressed because it is too large Load Diff

View File

@ -56,7 +56,7 @@ export default class BEConnector {
this.deviceInfo = url.get('deviceInfo');
this.numberTicket = parseInt(url.get('numberTicket'));
this.maxScore = parseInt(url.get('maxScore'));
this.maxScore = parseInt(url.get('maxScore')) || 99999;
this.currentScore = parseInt(url.get('currentScore')) || 0;
this.mileStone = url.get('mileStone');
this.gameURL = ENV_CONFIG[url.get('env')];

View File

@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "d404fb8f-f4c8-4ae6-a7da-3b89343e5730",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@ -0,0 +1,25 @@
import { _decorator, CCFloat, Collider2D, Component, Contact2DType } from 'cc';
import ObjectPool from '../Pool/ObjectPool';
import { EventManger } from '../Manager/EventManger';
import GameEvent from '../Events/GameEvent';
const { ccclass, property } = _decorator;
@ccclass('BoosterBase')
export class BoosterBase extends Component {
@property({ type: Collider2D, visible: true })
private _collider: Collider2D;
@property(CCFloat)
protected time: number = 10;
protected onLoad(): void {
this._collider.on(Contact2DType.BEGIN_CONTACT, this.onContactBegin, this);
}
private onContactBegin(self: Collider2D, other: Collider2D) {
this.BoosterActive();
EventManger.instance.emit(GameEvent.ObjectRelease, this.node);
ObjectPool.release(this.node);
}
protected BoosterActive?(): void;
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "bb9b8f8a-1352-4dbb-855a-3cb5e5129ae0",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,12 @@
import { _decorator, Component, Node } from 'cc';
import { BoosterBase } from './BoosterBase';
import { GameManager } from '../Manager/GameManager';
import BoosterType from '../Enum/BoosterType';
const { ccclass, property } = _decorator;
@ccclass('CumulativeBooster')
export class CumulativeBooster extends BoosterBase {
protected BoosterActive(): void {
GameManager.instance.ActiveBooster(BoosterType.CumulativeBar, this.time);
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "366a4868-adcf-4122-98f4-f7b111ccb5b7",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,5 @@
enum BoosterType {
CumulativeBar,
}
export default BoosterType;

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "ad60a7cb-b367-456c-8253-4018e5ffeb9b",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -1,6 +1,7 @@
enum ScoreType {
Goal,
DestroyObject,
Combo,
}
export default ScoreType;

View File

@ -0,0 +1,75 @@
import { _decorator, CCInteger, clamp, Component, lerp, Sprite } from 'cc';
import { EventManger } from '../Manager/EventManger';
import GameEvent from '../Events/GameEvent';
import ScoreType from '../Enum/ScoreType';
import Utilities from '../Utilities';
import { GameManager } from '../Manager/GameManager';
import BoosterType from '../Enum/BoosterType';
const { ccclass, property } = _decorator;
@ccclass('CumulativeBar')
export class CumulativeBar extends Component {
@property({ type: Sprite, visible: true })
private _fillBar: Sprite;
@property({ type: CCInteger, visible: true })
private _maxValue = 1000;
private _currentValue = 0;
private _fillValue = 0;
private _active = false;
private _timer = 0;
protected onLoad(): void {
this._fillBar.fillRange = 0;
EventManger.instance.on(GameEvent.Score, this.onScore, this);
EventManger.instance.on(GameEvent.BoosterActive, this.onBoosterActive, this);
EventManger.instance.on(GameEvent.BoosterDisable, this.onBoosterDisable, this);
}
protected update(dt: number): void {
if (Math.abs(this._fillValue - this._fillBar.fillRange) >= 0.001) {
this._fillBar.fillRange = lerp(this._fillBar.fillRange, this._fillValue, dt * 3);
}
if (!this._active && this._currentValue > 0) {
this._timer += dt;
if (this._timer >= 1) {
this._timer = 0;
this._currentValue -= 25;
if (this._currentValue < 0) {
this._currentValue = 0;
}
this._fillValue = -clamp(this._currentValue / 2 / this._maxValue, 0, 0.5);
}
}
}
private async onScore(score: number, points: number, type: ScoreType) {
if (!this._active) return;
switch (type) {
case ScoreType.DestroyObject:
this._currentValue += points;
break;
case ScoreType.Goal:
if (this._currentValue == 0) return;
await Utilities.delay(1);
GameManager.instance.addScore(this._currentValue, ScoreType.Combo, this.node.getWorldPosition(), {
scaleMin: 2,
scaleMax: 4,
duration: 1,
});
this._currentValue = 0;
break;
}
this._fillValue = -clamp(this._currentValue / 2 / this._maxValue, 0, 0.5);
}
private onBoosterActive(type: BoosterType) {
if (type == BoosterType.CumulativeBar) this._active = true;
}
private onBoosterDisable(type: BoosterType) {
if (type == BoosterType.CumulativeBar) this._active = false;
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "671bf120-4d35-4580-ba35-bfec7fc1dd3a",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -64,7 +64,7 @@ export class ScoreObject extends Component implements IPoolable {
this._sprite.color = this._sprite.color.clone().lerp(this._targetColor, 1 * dt);
if (this._sprite.color.a == 0) {
EventManger.instance.emit(GameEvent.ScoreObjectRelease, this.node);
EventManger.instance.emit(GameEvent.ObjectRelease, this.node);
ObjectPool.release(this.node);
}
}

View File

@ -1,6 +1,7 @@
import { Node } from 'cc';
import GameState from '../Enum/GameState';
import ScoreType from '../Enum/ScoreType';
import BoosterType from '../Enum/BoosterType';
enum GameEvent {
Score,
@ -8,25 +9,31 @@ enum GameEvent {
MultiBall,
TimeUpdate,
GameStateChange,
ScoreObjectRelease,
ObjectRelease,
BoosterActive,
BoosterDisable,
}
export interface GameEventCallbackMap {
[GameEvent.Score]: (score: number, type?: ScoreType) => void;
[GameEvent.Score]: (score: number, points?: number, type?: ScoreType) => void;
[GameEvent.BallOut]: () => void;
[GameEvent.MultiBall]: (active: boolean) => void;
[GameEvent.TimeUpdate]: (time: number) => void;
[GameEvent.GameStateChange]: (state: GameState) => void;
[GameEvent.ScoreObjectRelease]: (obj: Node) => void;
[GameEvent.ObjectRelease]: (obj: Node) => void;
[GameEvent.BoosterActive]: (score: BoosterType) => void;
[GameEvent.BoosterDisable]: (score: BoosterType) => void;
}
export interface GameEventArgMap {
[GameEvent.Score]: [number, ScoreType];
[GameEvent.Score]: [number, number, ScoreType];
[GameEvent.BallOut]: null;
[GameEvent.MultiBall]: boolean;
[GameEvent.TimeUpdate]: number;
[GameEvent.GameStateChange]: GameState;
[GameEvent.ScoreObjectRelease]: Node;
[GameEvent.ObjectRelease]: Node;
[GameEvent.BoosterActive]: BoosterType;
[GameEvent.BoosterDisable]: BoosterType;
}
export default GameEvent;

View File

@ -19,7 +19,6 @@ import {
CircleCollider2D,
Animation,
Sprite,
Color,
} from 'cc';
import IPoolable from '../Pool/IPoolable';
import { SoundManager } from '../Manager/SoundManager';

View File

@ -1,4 +1,18 @@
import { _decorator, Component, Node, Prefab, Vec2, Vec3, randomRangeInt, CCInteger, AudioClip, Quat } from 'cc';
import {
_decorator,
Component,
Node,
Prefab,
Vec2,
Vec3,
randomRangeInt,
CCInteger,
AudioClip,
Quat,
game,
EPhysics2DDrawFlags,
PhysicsSystem2D,
} from 'cc';
import ObjectPool from '../Pool/ObjectPool';
import { Ball } from '../GamePlay/Ball';
import Utilities from '../Utilities';
@ -10,6 +24,7 @@ import { FloatingText } from '../Environments/FloatingText';
import { SoundManager } from './SoundManager';
import TimeConfig from '../Enum/TimeConfig';
import BEConnector from '../API/BEConnector';
import BoosterType from '../Enum/BoosterType';
const { ccclass, property } = _decorator;
window.addEventListener('message', (data) => {
@ -24,6 +39,18 @@ window.addEventListener('message', (data) => {
}
});
ccclass('Booster');
class Booster {
public type: BoosterType;
public time: number;
public runningTime: number = 0;
constructor(type: BoosterType, time: number) {
this.type = type;
this.time = time;
}
}
@ccclass('GameManager')
export class GameManager extends Component {
//singleton
@ -53,12 +80,13 @@ export class GameManager extends Component {
private _FloatingScorePool: ObjectPool;
private _gameState: GameState;
private _timer: number;
@property({ type: Booster, visible: true, readonly: true })
private _boostersActive: Booster[] = [];
private _score = 0;
private isReplayed = false;
private _isMultiBall = false;
private _currentBallInGame = 0;
private _multiplierScore = 0;
public get score() {
return this._score;
@ -83,6 +111,15 @@ export class GameManager extends Component {
this.gameOver();
}
for (let i = 0; i < this._boostersActive.length; i++) {
const booster = this._boostersActive[i];
booster.runningTime += dt;
if (booster.runningTime >= booster.time) {
this._boostersActive.splice(i, 1);
EventManger.instance.emit(GameEvent.BoosterDisable, booster.type);
}
}
EventManger.instance.emit(GameEvent.TimeUpdate, this._timer);
}
@ -111,7 +148,7 @@ export class GameManager extends Component {
}
}
private addScore(
public addScore(
score: number,
type: ScoreType,
position: Vec3,
@ -120,7 +157,7 @@ export class GameManager extends Component {
this._score += score;
const floatingScore = this._FloatingScorePool.get(this._floatingTextContainer, FloatingText);
floatingScore.show(`+${score}`, position, score >= 100 ? opts.scaleMax : opts.scaleMin, opts.duration);
EventManger.instance.emit(GameEvent.Score, [this._score, type]);
EventManger.instance.emit(GameEvent.Score, [this._score, score, type]);
}
private setCurrentBallInGame(value: number) {
@ -160,7 +197,6 @@ export class GameManager extends Component {
public async ballOut() {
this.setCurrentBallInGame(-1);
if (this._currentBallInGame <= 0) {
this._multiplierScore = 0;
EventManger.instance.emit(GameEvent.BallOut, null);
await Utilities.delay(TimeConfig.DelayPLay);
this.spawnBall(true);
@ -175,7 +211,6 @@ export class GameManager extends Component {
});
this.setCurrentBallInGame(-1);
if (this._currentBallInGame <= 0) {
this._multiplierScore = 0;
await Utilities.delay(TimeConfig.DelayGoal);
this.spawnBall(true);
}
@ -183,8 +218,7 @@ export class GameManager extends Component {
public async destroyEnvironmentObject(bonusScore: number, position: Vec3, bonusTime?: number) {
if (bonusScore) {
this._multiplierScore++;
this.addScore(bonusScore * this._multiplierScore, ScoreType.DestroyObject, position, {
this.addScore(bonusScore, ScoreType.DestroyObject, position, {
scaleMin: 1.5,
scaleMax: 2,
duration: 0.7,
@ -234,4 +268,14 @@ export class GameManager extends Component {
await Utilities.delay(TimeConfig.DelayPLay);
this.spawnBall(true);
}
public ActiveBooster(type: BoosterType, time: number) {
//check booster already active
for (let i = 0; i < this._boostersActive.length; i++) {
const booster = this._boostersActive[i];
if (booster.type == type) return;
}
this._boostersActive.push(new Booster(type, time));
EventManger.instance.emit(GameEvent.BoosterActive, type);
}
}

View File

@ -35,28 +35,41 @@ export class SpawnObjectManager extends Component {
@property({ type: weightedObject, visible: true })
private _objects: weightedObject[] = [];
@property({ type: weightedObject, visible: true })
private _boosters: weightedObject[] = [];
@property({ type: Node, visible: true })
private _spawnPoints: Node[] = [];
@property({ type: CCFloat, visible: true, range: [1, 10], slide: true })
private _spawnTime;
@property({ type: CCFloat, visible: true, range: [1, 100], slide: true })
private _spawnBoosterTime;
private _pools: ObjectPool[] = [];
private _boosterPools: ObjectPool[] = [];
private _usedPoints: { [key: string]: Node } = {};
private _playing = false;
private _timer = 0;
private _timerBooster = 0;
private _weights: number[] = [];
private _isReplay = false;
private _boosterSpawned = false;
protected onLoad(): void {
SpawnObjectManager._instance = this;
EventManger.instance.on(GameEvent.ScoreObjectRelease, this.onObjectRelease, this);
EventManger.instance.on(GameEvent.ObjectRelease, this.onObjectRelease, this);
EventManger.instance.on(GameEvent.GameStateChange, this.onGameStateChange, this);
EventManger.instance.on(GameEvent.Score, this.onScore, this);
EventManger.instance.on(GameEvent.BoosterActive, this.onBoosterActive, this);
for (let i = 0; i < this._objects.length; i++) {
const prefab = this._objects[i].prefab;
this._pools[i] = new ObjectPool(prefab, 10, true, ScoreObject);
}
for (let i = 0; i < this._boosters.length; i++) {
const prefab = this._boosters[i].prefab;
this._boosterPools[i] = new ObjectPool(prefab, 2, true);
}
}
protected update(dt: number): void {
@ -66,6 +79,12 @@ export class SpawnObjectManager extends Component {
this._timer = 0;
this.spawn();
}
if (this._boosterSpawned) return;
this._timerBooster += dt;
if (this._timerBooster >= this._spawnBoosterTime) {
this._timerBooster = 0;
this.spawnBooster();
}
}
private spawn() {
@ -74,18 +93,41 @@ export class SpawnObjectManager extends Component {
var randomPool = Utilities.weightedRandom(this._pools, this._weights);
var index = this._pools.indexOf(randomPool);
} while (this._objects[index].maxObjects != -1 && randomPool.countActive >= this._objects[index].maxObjects);
do {
var randomPoint = this._spawnPoints[randomRangeInt(0, this._spawnPoints.length)];
} while (Object.values(this._usedPoints).indexOf(randomPoint) != -1);
const obj = randomPool.get(this.node);
obj.setWorldPosition(randomPoint.worldPosition);
this._usedPoints[obj.uuid] = randomPoint;
}
private spawnBooster() {
if (Object.keys(this._usedPoints).length == this._spawnPoints.length) return;
do {
var randomPool = Utilities.weightedRandom(this._boosterPools, this._weights);
var index = this._boosterPools.indexOf(randomPool);
} while (this._boosters[index].maxObjects != -1 && randomPool.countActive >= this._boosters[index].maxObjects);
do {
var randomPoint = this._spawnPoints[randomRangeInt(0, this._spawnPoints.length)];
} while (Object.values(this._usedPoints).indexOf(randomPoint) != -1);
const obj = randomPool.get(this.node);
obj.setWorldPosition(randomPoint.worldPosition);
this._usedPoints[obj.uuid] = randomPoint;
this._boosterSpawned = true;
}
private onObjectRelease(obj: Node) {
delete this._usedPoints[obj.uuid];
}
private onBoosterActive() {
this._boosterSpawned = false;
}
private onScore(score: number, type: ScoreType) {
if (type == ScoreType.Goal) {
this._objects.forEach((object) => {

View File

@ -1,4 +1,4 @@
import { _decorator, Component, EventTouch, Input, Node, Tween, tween, Vec3 } from 'cc';
import { _decorator, Component, EventKeyboard, EventTouch, input, Input, KeyCode, Node, Tween, tween, Vec3 } from 'cc';
import { GameManager } from '../Manager/GameManager';
const { ccclass, property } = _decorator;
@ -11,6 +11,12 @@ export class TutorialController extends Component {
protected onLoad(): void {
this.node.on(Input.EventType.TOUCH_START, this.onTouch, this);
input.on(Input.EventType.KEY_UP, this.onKeyInputUp, this);
}
protected onDisable(): void {
this.node.off(Input.EventType.TOUCH_START, this.onTouch, this);
input.off(Input.EventType.KEY_UP, this.onKeyInputUp, this);
}
protected start() {
@ -29,10 +35,27 @@ export class TutorialController extends Component {
.start();
}
private onTouch(event: EventTouch) {
private startGame() {
Tween.stopAllByTarget(this._tapL);
Tween.stopAllByTarget(this._tapR);
this.node.active = false;
GameManager.instance.play();
}
private onTouch(event: EventTouch) {
this.startGame();
}
private onKeyInputUp(event: EventKeyboard) {
switch (event.keyCode) {
case KeyCode.KEY_A:
case KeyCode.ARROW_LEFT:
case KeyCode.KEY_D:
case KeyCode.ARROW_RIGHT:
this.startGame();
break;
default:
break;
}
}
}

View File

@ -17,8 +17,12 @@ export class UIController extends Component {
private _resultLabel: Label;
@property({ type: Label, visible: true })
private _resultTotalLabel: Label;
@property({ type: ParticleSystem, visible: true })
private _buffFx: ParticleSystem;
@property({ type: Node, visible: true })
private _tutorialPanel: Node;
@property({ type: Node, visible: true })
private _startPanel: Node;
@property({ type: Node, visible: true })
@ -106,6 +110,7 @@ export class UIController extends Component {
}
public starGame() {
this._tutorialPanel.active = true;
this._startPanel.active = false;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,134 @@
{
"ver": "1.0.25",
"importer": "image",
"imported": true,
"uuid": "461cbbbe-573a-4553-9ddc-f8723c11206a",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "461cbbbe-573a-4553-9ddc-f8723c11206a@6c48a",
"displayName": "Ball",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "461cbbbe-573a-4553-9ddc-f8723c11206a",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "461cbbbe-573a-4553-9ddc-f8723c11206a@f9941",
"displayName": "Ball",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 104,
"height": 87,
"rawWidth": 104,
"rawHeight": 87,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-52,
-43.5,
0,
52,
-43.5,
0,
-52,
43.5,
0,
52,
43.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
87,
104,
87,
0,
0,
104,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-52,
-43.5,
0
],
"maxPos": [
52,
43.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "461cbbbe-573a-4553-9ddc-f8723c11206a@6c48a",
"atlasUuid": ""
},
"ver": "1.0.11",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": true,
"hasAlpha": true,
"redirect": "461cbbbe-573a-4553-9ddc-f8723c11206a@f9941"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

View File

@ -0,0 +1,134 @@
{
"ver": "1.0.25",
"importer": "image",
"imported": true,
"uuid": "2d1bf135-68e1-4b0a-b16d-c1e84b091203",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "2d1bf135-68e1-4b0a-b16d-c1e84b091203@6c48a",
"displayName": "combo_bar",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "2d1bf135-68e1-4b0a-b16d-c1e84b091203",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "2d1bf135-68e1-4b0a-b16d-c1e84b091203@f9941",
"displayName": "combo_bar",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 882,
"height": 395,
"rawWidth": 882,
"rawHeight": 395,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-441,
-197.5,
0,
441,
-197.5,
0,
-441,
197.5,
0,
441,
197.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
395,
882,
395,
0,
0,
882,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-441,
-197.5,
0
],
"maxPos": [
441,
197.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "2d1bf135-68e1-4b0a-b16d-c1e84b091203@6c48a",
"atlasUuid": ""
},
"ver": "1.0.11",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": true,
"hasAlpha": true,
"redirect": "2d1bf135-68e1-4b0a-b16d-c1e84b091203@f9941"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

View File

@ -0,0 +1,134 @@
{
"ver": "1.0.25",
"importer": "image",
"imported": true,
"uuid": "d1354e77-5cc9-4fe6-b1d9-36933b0b7eef",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "d1354e77-5cc9-4fe6-b1d9-36933b0b7eef@6c48a",
"displayName": "combo_bar_color",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "d1354e77-5cc9-4fe6-b1d9-36933b0b7eef",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "d1354e77-5cc9-4fe6-b1d9-36933b0b7eef@f9941",
"displayName": "combo_bar_color",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 861,
"height": 374,
"rawWidth": 861,
"rawHeight": 374,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-430.5,
-187,
0,
430.5,
-187,
0,
-430.5,
187,
0,
430.5,
187,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
374,
861,
374,
0,
0,
861,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-430.5,
-187,
0
],
"maxPos": [
430.5,
187,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "d1354e77-5cc9-4fe6-b1d9-36933b0b7eef@6c48a",
"atlasUuid": ""
},
"ver": "1.0.11",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": true,
"hasAlpha": true,
"redirect": "d1354e77-5cc9-4fe6-b1d9-36933b0b7eef@f9941"
}
}