This commit is contained in:
2024-05-01 19:13:01 +08:00
parent cf008327aa
commit 80a32d9b1b
150 changed files with 8561 additions and 5045 deletions

View File

@@ -1,8 +1,10 @@
import { Vec2 } from 'cc'
import { FishPathInfo } from './FishPathInfo'
import RandomUtil from '../../engine/utils/RandomUtil'
import { FishMapInfo } from './FishMapInfo'
import { FishMap } from './FishMap'
import { FishMapInfo } from './FishMapInfo'
import { FishPathInfo } from './FishPathInfo'
export class FishPathConfig {
private static mapConfig: Array<Array<Array<number>>> = [
@@ -90,7 +92,7 @@ export class FishPathConfig {
[1, 1, 1, 754, -7],
[1, 1, 1, 671, 26],
[1, 1, 1, 630, 59],
[1, 1, 1, 584, 80]
[1, 1, 1, 584, 80],
],
[
[2, 1, 1, -784, 353],
@@ -135,7 +137,7 @@ export class FishPathConfig {
[3, 1, 1, 523, -253],
[3, 1, 1, 172, 128],
[3, 1, 1, -357, 30],
[3, 1, 1, 582, 23]
[3, 1, 1, 582, 23],
],
[
[5, 1, 1, -888, 405],
@@ -191,7 +193,7 @@ export class FishPathConfig {
[7, 1, 1, 340, -259],
[7, 1, 1, 485, -254],
[7, 1, 1, 622, -254],
[7, 1, 1, 816, -251]
[7, 1, 1, 816, -251],
],
[
[9, 1, 1, -513, 150],
@@ -222,7 +224,7 @@ export class FishPathConfig {
[9, 1, 1, 865, 195],
[9, 1, 1, 665, 207],
[17, 1, 1, -461, 2],
[17, 1, 1, 515, -49]
[17, 1, 1, 515, -49],
],
[
[19, 1, 1, -785, 31],
@@ -234,7 +236,7 @@ export class FishPathConfig {
[20, 1, 1, 425, -301],
[20, 1, 1, 537, 265],
[20, 1, 1, -604, 317],
[20, 1, 1, -634, -285]
[20, 1, 1, -634, -285],
],
[
[21, 1, 1, -757, 94],
@@ -245,12 +247,12 @@ export class FishPathConfig {
[21, 1, 1, -437, 300],
[21, 1, 1, -434, -155],
[21, 1, 1, 314, -154],
[21, 1, 1, 435, 249]
[21, 1, 1, 435, 249],
],
[
[22, 1, 1, -548, 65],
[22, 1, 1, 747, 61],
[22, 1, 1, 95, 63]
[22, 1, 1, 95, 63],
],
[
[23, 1, 1, -431, 384],
@@ -262,7 +264,7 @@ export class FishPathConfig {
[23, 1, 1, 1025, 60],
[23, 1, 1, 677, -247],
[23, 1, 1, 104, 390],
[23, 1, 1, 84, -265]
[23, 1, 1, 84, -265],
],
[
[24, 1, 1, -429, 353],
@@ -271,7 +273,7 @@ export class FishPathConfig {
[24, 1, 1, -27, 35],
[24, 1, 1, 563, 39],
[24, 1, 1, -268, -245],
[24, 1, 1, 172, -260]
[24, 1, 1, 172, -260],
],
[
[25, 1, 1, -595, 276],
@@ -279,27 +281,27 @@ export class FishPathConfig {
[25, 1, 1, -192, -64],
[25, 1, 1, 464, -46],
[25, 1, 1, 191, -280],
[25, 1, 1, 884, -319]
[25, 1, 1, 884, -319],
],
[
[26, 1, 1, -681, 441],
[26, 1, 1, 685, 426],
[26, 1, 1, -46, 140],
[26, 1, 1, -494, -207],
[26, 1, 1, 497, -238]
[26, 1, 1, 497, -238],
],
[
[27, 1, 1, -431, 345],
[27, 1, 1, 569, 311],
[27, 1, 1, 112, -12],
[27, 1, 1, -298, -271],
[27, 1, 1, 678, -244]
[27, 1, 1, 678, -244],
],
[
[28, 1, 1, -454, 8],
[28, 1, 1, 597, 1],
[28, 1, 1, 46, 431],
[28, 1, 1, 44, -227]
[28, 1, 1, 44, -227],
],
[
[2, 1, 1, -557, 409],
@@ -345,9 +347,10 @@ export class FishPathConfig {
[5, 1, 1, 407, -178],
[5, 1, 1, 297, 8],
[5, 1, 1, 625, 48],
[5, 1, 1, 379, 92]
]
[5, 1, 1, 379, 92],
],
]
private static formatMapConfig: Array<FishMap> = []
private static config: Array<Array<Array<number>>> = [
// 左边开始
@@ -368,7 +371,7 @@ export class FishPathConfig {
[627, -511],
[762, -578],
[885, -667],
[1068, -773]
[1068, -773],
],
[
[-1295, 534],
@@ -385,7 +388,7 @@ export class FishPathConfig {
[753, 233],
[936, 279],
[1182, 350],
[1314, 418]
[1314, 418],
],
[
[-1295, 534],
@@ -402,7 +405,7 @@ export class FishPathConfig {
[827, -42],
[1020, -131],
[1189, -170],
[1309, -198]
[1309, -198],
],
[
[-1295, 534],
@@ -419,7 +422,7 @@ export class FishPathConfig {
[835, 88],
[1013, -2],
[1212, -99],
[1309, -198]
[1309, -198],
],
[
[-1275, -118],
@@ -436,7 +439,7 @@ export class FishPathConfig {
[772, 391],
[887, 426],
[1066, 513],
[1164, 710]
[1164, 710],
],
[
[-1299, -618],
@@ -453,7 +456,7 @@ export class FishPathConfig {
[904, 176],
[1090, 273],
[1208, 355],
[1308, 435]
[1308, 435],
],
[
[-1275, -118],
@@ -470,7 +473,7 @@ export class FishPathConfig {
[784, 266],
[935, 228],
[1157, 174],
[1329, 163]
[1329, 163],
],
[
[-1288, -220],
@@ -487,7 +490,7 @@ export class FishPathConfig {
[851, 203],
[1050, 141],
[1255, 58],
[1326, 20]
[1326, 20],
],
[
[-1288, -220],
@@ -504,7 +507,7 @@ export class FishPathConfig {
[993, -283],
[1090, -319],
[1242, -341],
[1329, -396]
[1329, -396],
],
[
[-1288, -220],
@@ -521,7 +524,7 @@ export class FishPathConfig {
[1011, -407],
[1095, -418],
[1238, -539],
[1317, -663]
[1317, -663],
],
[
[-1314, -508],
@@ -540,7 +543,7 @@ export class FishPathConfig {
[1093, 280],
[1026, 371],
[868, 631],
[648, 787]
[648, 787],
],
[
[-1314, -508],
@@ -559,7 +562,7 @@ export class FishPathConfig {
[1093, 280],
[1026, 371],
[868, 631],
[648, 787]
[648, 787],
],
[
[-1314, -508],
@@ -576,9 +579,9 @@ export class FishPathConfig {
[872, -200],
[1060, -391],
[1150, -492],
[1301, -461]
[1301, -461],
],
//右边开始
// 右边开始
[
[1286, -293],
[1149, -184],
@@ -588,7 +591,7 @@ export class FishPathConfig {
[476, 57],
[467, 300],
[408, 500],
[405, 701]
[405, 701],
],
[
[1345, 34],
@@ -599,7 +602,7 @@ export class FishPathConfig {
[267, -29],
[66, -79],
[-219, -287],
[-271, -693]
[-271, -693],
],
[
[1345, 34],
@@ -614,7 +617,7 @@ export class FishPathConfig {
[-725, -92],
[-963, -68],
[-1169, -46],
[-1325, -40]
[-1325, -40],
],
[
[1345, 34],
@@ -629,7 +632,7 @@ export class FishPathConfig {
[-719, -199],
[-981, -264],
[-1180, -291],
[-1320, -367]
[-1320, -367],
],
[
[1345, 34],
@@ -644,7 +647,7 @@ export class FishPathConfig {
[-707, -320],
[-961, -408],
[-1160, -449],
[-1309, -524]
[-1309, -524],
],
[
[1345, 34],
@@ -659,7 +662,7 @@ export class FishPathConfig {
[-596, -448],
[-847, -604],
[-1019, -589],
[-1241, -695]
[-1241, -695],
],
[
[1345, 34],
@@ -674,7 +677,7 @@ export class FishPathConfig {
[-898, 66],
[-1070, 219],
[-1181, 292],
[-1289, 558]
[-1289, 558],
],
[
[1345, 34],
@@ -689,7 +692,7 @@ export class FishPathConfig {
[-806, 84],
[-905, 246],
[-1008, 375],
[-1021, 750]
[-1021, 750],
],
[
[1297, 542],
@@ -704,7 +707,7 @@ export class FishPathConfig {
[-806, 84],
[-905, 246],
[-1008, 375],
[-1021, 750]
[-1021, 750],
],
[
[1297, 542],
@@ -719,7 +722,7 @@ export class FishPathConfig {
[-806, 84],
[-927, 189],
[-1073, 291],
[-1318, 474]
[-1318, 474],
],
[
[1297, 542],
@@ -734,7 +737,7 @@ export class FishPathConfig {
[-775, -77],
[-923, -28],
[-1133, -46],
[-1294, -10]
[-1294, -10],
],
[
[1297, 542],
@@ -749,7 +752,7 @@ export class FishPathConfig {
[-616, -254],
[-854, -240],
[-1115, -272],
[-1312, -336]
[-1312, -336],
],
[
[1297, 542],
@@ -764,7 +767,7 @@ export class FishPathConfig {
[-562, -321],
[-647, -446],
[-930, -540],
[-1073, -726]
[-1073, -726],
],
[
[1293, -558],
@@ -779,7 +782,7 @@ export class FishPathConfig {
[-562, -321],
[-647, -446],
[-930, -540],
[-1073, -726]
[-1073, -726],
],
[
[1293, -558],
@@ -794,7 +797,7 @@ export class FishPathConfig {
[-568, -262],
[-857, -301],
[-1055, -406],
[-1353, -380]
[-1353, -380],
],
[
[1293, -558],
@@ -809,7 +812,7 @@ export class FishPathConfig {
[-590, -195],
[-905, -120],
[-1100, -72],
[-1300, 225]
[-1300, 225],
],
[
[1293, -558],
@@ -824,7 +827,7 @@ export class FishPathConfig {
[-633, -130],
[-917, 33],
[-1079, 184],
[-1220, 412]
[-1220, 412],
],
[
[1293, -558],
@@ -839,9 +842,9 @@ export class FishPathConfig {
[-602, -25],
[-857, 181],
[-921, 416],
[-909, 805]
[-909, 805],
],
//下往上
// 下往上
[
[-279, -786],
[-92, -667],
@@ -855,7 +858,7 @@ export class FishPathConfig {
[-602, -25],
[-857, 181],
[-921, 416],
[-909, 805]
[-909, 805],
],
[
[-279, -786],
@@ -870,7 +873,7 @@ export class FishPathConfig {
[-362, 152],
[-543, 358],
[-721, 502],
[-401, 770]
[-401, 770],
],
[
[-279, -786],
@@ -885,7 +888,7 @@ export class FishPathConfig {
[60, 214],
[-85, 418],
[-140, 630],
[-401, 770]
[-401, 770],
],
[
[-279, -786],
@@ -900,7 +903,7 @@ export class FishPathConfig {
[253, 319],
[330, 465],
[544, 684],
[858, 803]
[858, 803],
],
[
[841, -837],
@@ -915,9 +918,10 @@ export class FishPathConfig {
[253, 319],
[330, 465],
[544, 684],
[858, 803]
]
[858, 803],
],
]
private static formatConfig: Array<FishPathInfo> = []
public static init() {
@@ -928,70 +932,60 @@ export class FishPathConfig {
private static initMapConfig() {
this.formatMapConfig = []
for (let i = 0; i < this.mapConfig.length; i++) {
let arr: Array<Array<number>> = this.mapConfig[i]
let fishMapInfoList: Array<FishMapInfo> = []
const arr: Array<Array<number>> = this.mapConfig[i]
const fishMapInfoList: Array<FishMapInfo> = []
for (let j = 0; j < arr.length; j++) {
let temp: Array<number> = arr[j]
let fishMapInfo: FishMapInfo = new FishMapInfo(
const temp: Array<number> = arr[j]
const fishMapInfo: FishMapInfo = new FishMapInfo(
temp[0],
temp[1],
temp[2],
temp[3],
temp[4]
temp[4],
)
fishMapInfoList.push(fishMapInfo)
}
let fishMap: FishMap = new FishMap(i, fishMapInfoList)
const fishMap: FishMap = new FishMap(i, fishMapInfoList)
this.formatMapConfig.push(fishMap)
// console.log('this.formatMapConfig ', this.formatMapConfig)
}
}
public static randomFishMap() {
let randomIndex: number = RandomUtil.nextInt(
0,
this.formatMapConfig.length - 1
)
let map: FishMap = this.formatMapConfig[randomIndex]
return map
const randomIndex: number = RandomUtil.nextInt(0, this.formatMapConfig.length - 1)
return this.formatMapConfig[randomIndex]
}
private static initNormalConfig() {
this.formatConfig = []
let pathId: number = 1
for (let i = 0; i < this.config.length; i++) {
let path: Array<Vec2> = []
let flipXPath: Array<Vec2> = []
let flipYPath: Array<Vec2> = []
const path: Array<Vec2> = []
const flipXPath: Array<Vec2> = []
const flipYPath: Array<Vec2> = []
for (let j = 0; j < this.config[i].length; j++) {
let p: Vec2 = new Vec2(this.config[i][j][0], this.config[i][j][1])
const p: Vec2 = new Vec2(this.config[i][j][0], this.config[i][j][1])
path.push(p)
let flipXP: Vec2 = new Vec2(-p.x, p.y)
let flipYP: Vec2 = new Vec2(p.x, -p.y)
const flipXP: Vec2 = new Vec2(-p.x, p.y)
const flipYP: Vec2 = new Vec2(p.x, -p.y)
flipXPath.push(flipXP)
flipYPath.push(flipYP)
}
this.formatConfig.push(new FishPathInfo(pathId++, path))
this.formatConfig.push(new FishPathInfo(pathId++, flipXPath))
this.formatConfig.push(new FishPathInfo(pathId++, flipYPath))
this.formatConfig.push(new FishPathInfo(pathId, path))
this.formatConfig.push(new FishPathInfo(pathId, flipXPath))
this.formatConfig.push(new FishPathInfo(pathId, flipYPath))
}
}
public static getPathInfo(pathId: number) {
for (let i = 0; i < this.formatConfig.length; i++) {
let pathInfo: FishPathInfo = this.formatConfig[i]
if (pathInfo.pathId == pathId) {
return pathInfo
}
const pathInfo: FishPathInfo = this.formatConfig[i]
if (pathInfo.pathId === pathId) return pathInfo
}
}
public static randomPathInfo() {
let randomIndex: number = RandomUtil.nextInt(
0,
this.formatConfig.length - 1
)
// let randomIndex: number = 0
let pathInfo: FishPathInfo = this.formatConfig[randomIndex]
return pathInfo
const randomIndex: number = RandomUtil.nextInt(0, this.formatConfig.length - 1)
return this.formatConfig[randomIndex]
}
}