This commit is contained in:
PC-20230316NUNE\Administrator
2024-01-15 18:45:45 +08:00
parent 94832afecb
commit 68e0f81616
14 changed files with 65 additions and 47 deletions

View File

@@ -8180,7 +8180,7 @@
"b": 255,
"a": 255
},
"_string": "宠物",
"_string": "副本",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 24,

View File

@@ -32,8 +32,8 @@ import { Component } from "cc";
// let WsPath = `ws://localhost:8080/websocket`
// let APIPath = `http://192.168.1.23:8080`
// let WsPath = `ws://192.168.1.23:8080/websocket`
let APIPath = `http://192.168.0.119:8080`
let WsPath = `ws://192.168.0.119:8080/websocket`
let APIPath = `http://192.168.0.118:8080`
let WsPath = `ws://192.168.0.118:8080/websocket`
// let APIPath = `https://api.pet.jisol.cn`
// let WsPath = `wss://api.pet.jisol.cn/websocket`

View File

@@ -17,12 +17,12 @@ export class AppData extends SystemBase{
loadings:BaseData[] = [
PlayerData.getIns(), //玩家信息
PetEquipData.getIns(), //宠物装备数据类
PlayerPetData.getIns(), //玩家宠物信息
ChatData.getIns(), //聊天
PlayerTacticalData.getIns(), //阵法
ResourceData.getIns(), //玩家资源
GOnHookData.getIns(), //无限模式信息类 (无限模式是游戏基础模式玩法 需要默认信息)
PetEquipData.getIns(), //宠物装备数据类
GBattleData.getIns(), //战斗数据(永远最后)
];

View File

@@ -3,6 +3,7 @@ import { API, PlayerInfoOV, PlayerPetOV } from "../consts/API";
import BaseData from "./BaseData";
import { GBattleDataEnum } from "./GBattleData";
import GOnHookData from "./GOnHookData";
import PetEquipData, { PetEquipDataEnum } from "./PetEquipData";
import PlayerTacticalData from "./PlayerTacticalData";
import { ResourceUpdateType } from "./ResourceData";
@@ -23,6 +24,16 @@ export default class PlayerPetData extends BaseData{
//更新玩家宠物
await this.UpdatePlayerPet();
app.event.on(PetEquipDataEnum.UPDATE_FORGING_INFO,this.onUpdateForgingInfo,this);
}
//更新锻造等级 (宠物等级)
onUpdateForgingInfo(){
this.datas.forEach(item => item.petLevel = PetEquipData.getIns().getForgingBenchPetLevel(item.petId));
app.event.emit(PlayerPetEvent.UPDATE)
}
@@ -49,7 +60,10 @@ export default class PlayerPetData extends BaseData{
//更新玩家宠物
async UpdatePlayerPet(){
//获取全部宠物
this.datas = await API.GetPlayerPets();
let datas = await API.GetPlayerPets();
datas.forEach(item => item.petLevel = PetEquipData.getIns().getForgingBenchPetLevel(item.petId));
this.datas = datas;
app.event.emit(GBattleDataEnum.UPDARE_ATTRIBUTE); //刷新属性
}
@@ -68,12 +82,15 @@ export default class PlayerPetData extends BaseData{
//添加宠物
addPet(pet:PlayerPetOV){
pet.petLevel = PetEquipData.getIns().getForgingBenchPetLevel(pet.petId);
this.datas.push(pet);
}
//刷新返回宠物
onUpdateOV(operation:number,resource:PlayerPetOV){
resource.petLevel = PetEquipData.getIns().getForgingBenchPetLevel(resource.petId);
//如果没有刷新的宠物 则 返回
if(!resource) return;

View File

@@ -60,7 +60,8 @@ export class PetIcon extends Component {
}
//设置宠物等级
this.levelLabel.string = `Lv ${PetEquipData.getIns().getForgingBenchPetLevel(this.info.petId)}`
// this.levelLabel.string = `Lv ${PetEquipData.getIns().getForgingBenchPetLevel(this.info.petId)}`
this.levelLabel.string = `Lv ${this.info.petLevel}`
}