优化若干代码

This commit is contained in:
2024-04-17 20:15:52 +08:00
parent 54580cc1b2
commit 58cc2e3b82
66 changed files with 5821 additions and 4019 deletions

View File

@@ -1,44 +1,44 @@
import { _decorator } from 'cc'
import { FishInfo } from './FishInfo'
export class FishConfig {
public static readonly config: ReadonlyArray<FishInfo> = [
new FishInfo(1, '蝴蝶鱼', 2, 2),
new FishInfo(2, '鲶鱼', 2, 1),
new FishInfo(3, '狮子鱼', 2, 2),
new FishInfo(4, '条纹鱼', 2, 2),
new FishInfo(5, '沙丁鱼', 2, 2),
new FishInfo(6, '石斑鱼', 2, 2),
new FishInfo(7, '河豚', 3, 1.2),
new FishInfo(8, '海螺', 3, 2),
new FishInfo(9, '接吻鱼', 3, 1.2),
new FishInfo(10, '海姆', 4, 1),
new FishInfo(11, '绿鳍鱼', 4, 1.2),
new FishInfo(12, '鲎', 4, 1.2),
new FishInfo(13, '魔鬼鱼', 5, 0.6),
new FishInfo(14, '小海龟', 5, 2),
new FishInfo(15, '锤头鲨', 6, 0.5),
new FishInfo(16, '金枪鱼', 6, 0.5),
new FishInfo(17, '大三元', 6, 0.5),
new FishInfo(18, '黄金鲎', 6, 1.2),
new FishInfo(19, '大四喜', 7, 0.5),
new FishInfo(20, '黄金锤头鲨', 7, 0.5),
new FishInfo(21, '金海姆', 7, 0.6),
new FishInfo(22, '五福临门', 8, 0.4),
new FishInfo(23, '金海龟', 8, 0.7),
new FishInfo(24, '金鲨', 8, 0.5),
new FishInfo(25, '蓝鲨', 8, 0.5),
new FishInfo(26, '美人鱼', 14, 0.4),
new FishInfo(27, '金龙', 14, 0.3),
new FishInfo(28, '章鱼', 10, 0.5),
new FishInfo(29, '电鳗鱼', 3, 0.8),
]
public static getFishInfoByType(fishType: number) {
for (let i = 0; i < this.config.length; i++) {
let fishInfo: FishInfo = this.config[i]
if (fishInfo.fishType == fishType) {
return fishInfo
}
}
}
public static readonly config: ReadonlyArray<FishInfo> = [
new FishInfo(1, '蝴蝶鱼', 2, 2),
new FishInfo(2, '鲶鱼', 2, 1),
new FishInfo(3, '狮子鱼', 2, 2),
new FishInfo(4, '条纹鱼', 2, 2),
new FishInfo(5, '沙丁鱼', 2, 2),
new FishInfo(6, '石斑鱼', 2, 2),
new FishInfo(7, '河豚', 3, 1.2),
new FishInfo(8, '海螺', 3, 2),
new FishInfo(9, '接吻鱼', 3, 1.2),
new FishInfo(10, '海姆', 4, 1),
new FishInfo(11, '绿鳍鱼', 4, 1.2),
new FishInfo(12, '鲎', 4, 1.2),
new FishInfo(13, '魔鬼鱼', 5, 0.6),
new FishInfo(14, '小海龟', 5, 2),
new FishInfo(15, '锤头鲨', 6, 0.5),
new FishInfo(16, '金枪鱼', 6, 0.5),
new FishInfo(17, '大三元', 6, 0.5),
new FishInfo(18, '黄金鲎', 6, 1.2),
new FishInfo(19, '大四喜', 7, 0.5),
new FishInfo(20, '黄金锤头鲨', 7, 0.5),
new FishInfo(21, '金海姆', 7, 0.6),
new FishInfo(22, '五福临门', 8, 0.4),
new FishInfo(23, '金海龟', 8, 0.7),
new FishInfo(24, '金鲨', 8, 0.5),
new FishInfo(25, '蓝鲨', 8, 0.5),
new FishInfo(26, '美人鱼', 14, 0.4),
new FishInfo(27, '金龙', 14, 0.3),
new FishInfo(28, '章鱼', 10, 0.5),
new FishInfo(29, '电鳗鱼', 3, 0.8)
]
public static getFishInfoByType(fishType: number) {
for (let i = 0; i < this.config.length; i++) {
let fishInfo: FishInfo = this.config[i]
if (fishInfo.fishType == fishType) {
return fishInfo
}
}
}
}

View File

@@ -1,18 +1,18 @@
import { _decorator } from 'cc'
export class FishInfo {
public fishType: number
public name: string
public blood: number
public wikiScale: number
constructor(
fishType: number,
name: string,
blood: number,
wikiScale: number
) {
this.fishType = fishType
this.name = name
this.blood = blood
this.wikiScale = wikiScale
}
public fishType: number
public name: string
public blood: number
public wikiScale: number
constructor(
fishType: number,
name: string,
blood: number,
wikiScale: number
) {
this.fishType = fishType
this.name = name
this.blood = blood
this.wikiScale = wikiScale
}
}

View File

@@ -1,11 +1,11 @@
import { _decorator } from 'cc'
import { FishMapInfo } from './FishMapInfo'
export class FishMap {
public mapId: number
public fishMapInfoList: Array<FishMapInfo>
constructor(mapId: number, list: Array<FishMapInfo>) {
this.mapId = mapId
this.fishMapInfoList = list
}
public mapId: number
public fishMapInfoList: Array<FishMapInfo>
constructor(mapId: number, list: Array<FishMapInfo>) {
this.mapId = mapId
this.fishMapInfoList = list
}
}

View File

@@ -1,21 +1,21 @@
import { _decorator } from 'cc'
export class FishMapInfo {
public fishType: number
public scale: number
public side: number //1: -1:
public x: number
public y: number
constructor(
fishType: number,
scale: number,
side: number,
x: number,
y: number
) {
this.fishType = fishType
this.scale = scale
this.side = side
this.x = x
this.y = y
}
public fishType: number
public scale: number
public side: number //1: -1:
public x: number
public y: number
constructor(
fishType: number,
scale: number,
side: number,
x: number,
y: number
) {
this.fishType = fishType
this.scale = scale
this.side = side
this.x = x
this.y = y
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,11 @@
import { _decorator, Vec2 } from 'cc'
import { Vec2 } from 'cc'
export class FishPathInfo {
public pathId: number
public path: Array<Vec2> = []
constructor(pathId: number, path: Array<Vec2>) {
this.pathId = pathId
this.path = path
}
public pathId: number
public path: Array<Vec2> = []
constructor(pathId: number, path: Array<Vec2>) {
this.pathId = pathId
this.path = path
}
}

View File

@@ -1,4 +1,3 @@
import { _decorator } from 'cc'
export class GameConfig {
public static GameName: string = 'FishSingle'
public static GameName: string = 'FishSingle'
}

View File

@@ -1,2 +1,2 @@
import { _decorator } from 'cc'
export default class GameEvent {}
export default class GameEvent {
}