mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交新手引导
This commit is contained in:
11
JisolGameCocos/assets/script/data/BaseData.ts
Normal file
11
JisolGameCocos/assets/script/data/BaseData.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import Singleton from "../../../extensions/ngame/assets/ngame/util/Singleton";
|
||||
|
||||
|
||||
//数据基类
|
||||
export default abstract class BaseData extends Singleton {
|
||||
|
||||
//初始化
|
||||
abstract onInit();
|
||||
|
||||
}
|
||||
|
9
JisolGameCocos/assets/script/data/BaseData.ts.meta
Normal file
9
JisolGameCocos/assets/script/data/BaseData.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "3cace79b-36b5-4fd4-acfa-88a4b210e3ab",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
21
JisolGameCocos/assets/script/data/PlayerData.ts
Normal file
21
JisolGameCocos/assets/script/data/PlayerData.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { API, PlayerInfoOV } from "../consts/API";
|
||||
import BaseData from "./BaseData";
|
||||
|
||||
|
||||
//玩家数据
|
||||
export default class PlayerData extends BaseData{
|
||||
|
||||
data:PlayerInfoOV;
|
||||
|
||||
async onInit() {
|
||||
console.log("PlayerData",await API.GetPlayerInfo())
|
||||
this.data = (await API.GetPlayerInfo());
|
||||
}
|
||||
|
||||
//获取玩家信息
|
||||
getInfo():PlayerInfoOV{
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
|
||||
|
9
JisolGameCocos/assets/script/data/PlayerData.ts.meta
Normal file
9
JisolGameCocos/assets/script/data/PlayerData.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "58cb2be1-1279-405e-8c89-17a35ca0cd6d",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
39
JisolGameCocos/assets/script/data/PlayerPetData.ts
Normal file
39
JisolGameCocos/assets/script/data/PlayerPetData.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { API, PlayerInfoOV, PlayerPetOV } from "../consts/API";
|
||||
import BaseData from "./BaseData";
|
||||
|
||||
|
||||
//玩家宠物数据
|
||||
export default class PlayerPetData extends BaseData{
|
||||
|
||||
//玩家宠物列表
|
||||
datas:PlayerPetOV[] = [];
|
||||
|
||||
async onInit() {
|
||||
|
||||
//更新玩家宠物
|
||||
await this.UpdatePlayerPet();
|
||||
|
||||
}
|
||||
|
||||
//获取全部宠物
|
||||
getData(){
|
||||
return this.datas;
|
||||
}
|
||||
|
||||
//更新玩家宠物
|
||||
async UpdatePlayerPet(){
|
||||
//获取全部宠物
|
||||
this.datas = await API.GetPlayerPets();
|
||||
}
|
||||
|
||||
//选择宠物
|
||||
async SelectNovicePet(petId:number){
|
||||
await API.SelectNovicePet(petId);
|
||||
//更新玩家宠物列表
|
||||
await this.UpdatePlayerPet();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
9
JisolGameCocos/assets/script/data/PlayerPetData.ts.meta
Normal file
9
JisolGameCocos/assets/script/data/PlayerPetData.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "405fd125-2ba1-48b5-bc15-7f6e14569271",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user