mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 03:14:47 +00:00
提交
This commit is contained in:
parent
94832afecb
commit
68e0f81616
Binary file not shown.
@ -8180,7 +8180,7 @@
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "宠物",
|
||||
"_string": "副本",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 24,
|
||||
|
@ -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`
|
||||
|
||||
|
@ -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(), //战斗数据(永远最后)
|
||||
];
|
||||
|
||||
|
@ -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";
|
||||
|
||||
@ -24,6 +25,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;
|
||||
|
||||
|
@ -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}`
|
||||
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class GNoviceController {
|
||||
return NewsContext.onFail("你已经有宠物了!");
|
||||
}else{
|
||||
//选择宠物
|
||||
if (playerPetService.save(PlayerPet.builder().petPlayerId(player.getPlayerId()).petTbId(petId).petLevel(0).build())){
|
||||
if (playerPetService.save(PlayerPet.builder().petPlayerId(player.getPlayerId()).petTbId(petId).build())){
|
||||
return NewsContext.onSuccess("选择宠物成功");
|
||||
}else{
|
||||
return NewsContext.onSuccess("选择宠物失败");
|
||||
|
@ -124,40 +124,40 @@ public class GPlayerPetController {
|
||||
|
||||
}
|
||||
|
||||
//提升宠物等级
|
||||
@ApiImplicitParams({})
|
||||
@ApiOperation(value = "提升宠物等级")
|
||||
@PostMapping("/up/level/{petId}")
|
||||
@Transactional
|
||||
public NewsResource<PlayerPet> onUpLevel(@PathVariable Integer petId, @CurrentPlayer Player player){
|
||||
|
||||
|
||||
//获取需要升级的宠物
|
||||
PlayerPet pet = playerPetService.getById(petId);
|
||||
if(Objects.isNull(pet) || !Objects.equals(pet.getPetPlayerId(), player.getPlayerId())){
|
||||
return NewsResource.onFail("你未拥有这个宠物");
|
||||
}
|
||||
|
||||
TbGRoleUpLevel resource = TD.DATA.getTbGRoleUpLevel().get(pet.getPetLevel() + 1);
|
||||
|
||||
if(Objects.isNull(resource)) return NewsResource.onFail("无法升级");
|
||||
|
||||
//星级不够则 无法升级
|
||||
if(pet.getPetStar() * 10 <= pet.getPetLevel()){
|
||||
return NewsResource.onFail("突破星级 可升级");
|
||||
}
|
||||
//扣除玩家材料
|
||||
ArrayList<ResourceUpdateOV> resources = new ArrayList<>(resourceService.deduct(player, resource.materials));
|
||||
|
||||
//升级
|
||||
pet.setPetLevel(pet.getPetLevel() + 1);
|
||||
|
||||
//保存
|
||||
if(!playerPetService.updateById(pet)) throw new RetryException("");
|
||||
resources.add(ResourceUpdateOV.onPet(ResourceUpdateOV.ResourceUpdateType.UPDATE,pet)); //刷新宠物
|
||||
|
||||
return NewsResource.onSuccess("升级成功",pet,resources.toArray(new ResourceUpdateOV[0]));
|
||||
|
||||
}
|
||||
// //提升宠物等级
|
||||
// @ApiImplicitParams({})
|
||||
// @ApiOperation(value = "提升宠物等级")
|
||||
// @PostMapping("/up/level/{petId}")
|
||||
// @Transactional
|
||||
// public NewsResource<PlayerPet> onUpLevel(@PathVariable Integer petId, @CurrentPlayer Player player){
|
||||
//
|
||||
//
|
||||
// //获取需要升级的宠物
|
||||
// PlayerPet pet = playerPetService.getById(petId);
|
||||
// if(Objects.isNull(pet) || !Objects.equals(pet.getPetPlayerId(), player.getPlayerId())){
|
||||
// return NewsResource.onFail("你未拥有这个宠物");
|
||||
// }
|
||||
//
|
||||
// TbGRoleUpLevel resource = TD.DATA.getTbGRoleUpLevel().get(pet.getPetLevel() + 1);
|
||||
//
|
||||
// if(Objects.isNull(resource)) return NewsResource.onFail("无法升级");
|
||||
//
|
||||
// //星级不够则 无法升级
|
||||
// if(pet.getPetStar() * 10 <= pet.getPetLevel()){
|
||||
// return NewsResource.onFail("突破星级 可升级");
|
||||
// }
|
||||
// //扣除玩家材料
|
||||
// ArrayList<ResourceUpdateOV> resources = new ArrayList<>(resourceService.deduct(player, resource.materials));
|
||||
//
|
||||
// //升级
|
||||
// pet.setPetLevel(pet.getPetLevel() + 1);
|
||||
//
|
||||
// //保存
|
||||
// if(!playerPetService.updateById(pet)) throw new RetryException("");
|
||||
// resources.add(ResourceUpdateOV.onPet(ResourceUpdateOV.ResourceUpdateType.UPDATE,pet)); //刷新宠物
|
||||
//
|
||||
// return NewsResource.onSuccess("升级成功",pet,resources.toArray(new ResourceUpdateOV[0]));
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ public class GOnHookController {
|
||||
}
|
||||
|
||||
//捕捉
|
||||
PlayerPet pet = PlayerPet.builder().petPlayerId(player.getPlayerId()).petTbId(onHookPet.getPetTbId()).petLevel(0).build();
|
||||
PlayerPet pet = PlayerPet.builder().petPlayerId(player.getPlayerId()).petTbId(onHookPet.getPetTbId()).build();
|
||||
if(playerPetService.save(pet)){
|
||||
return NewsContext.onSuccess("捕捉成功",pet);
|
||||
}else{
|
||||
|
@ -18,7 +18,6 @@ public class PlayerPet {
|
||||
private Long petId; //宠物唯一Id
|
||||
private Long petPlayerId; //宠物的玩家Id
|
||||
private Integer petTbId; //宠物配置表Id
|
||||
private Integer petLevel; //宠物等级
|
||||
private Integer petStar; //宠物星级
|
||||
private Integer petStarExp; //宠物星级经验
|
||||
@Version
|
||||
|
@ -16,6 +16,7 @@ import cn.jisol.ngame.util.spring.SpringBeanUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.retry.RetryException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
@ -64,7 +65,7 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
|
||||
try{
|
||||
res = this.initResource(playerId,type,value);
|
||||
}catch (Exception e){
|
||||
return this.addResourceValue(playerId,type,value);
|
||||
throw new RetryException("服务器忙碌啦");
|
||||
}
|
||||
}else{
|
||||
throw new ResourceNotException("资源不够");
|
||||
|
@ -4,8 +4,8 @@ spring:
|
||||
datasource:
|
||||
username: pet_jisol_cn
|
||||
password: sThsBwjfDcaw2wJR
|
||||
# url: jdbc:mysql://kyu.jisol.cn:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
url: jdbc:mysql://localhost:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
url: jdbc:mysql://kyu.jisol.cn:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
# url: jdbc:mysql://localhost:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
jackson:
|
||||
serialization:
|
||||
|
Loading…
x
Reference in New Issue
Block a user