mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 11:24:46 +00:00
提交
This commit is contained in:
parent
94832afecb
commit
68e0f81616
Binary file not shown.
@ -8180,7 +8180,7 @@
|
|||||||
"b": 255,
|
"b": 255,
|
||||||
"a": 255
|
"a": 255
|
||||||
},
|
},
|
||||||
"_string": "宠物",
|
"_string": "副本",
|
||||||
"_horizontalAlign": 1,
|
"_horizontalAlign": 1,
|
||||||
"_verticalAlign": 1,
|
"_verticalAlign": 1,
|
||||||
"_actualFontSize": 24,
|
"_actualFontSize": 24,
|
||||||
|
@ -32,8 +32,8 @@ import { Component } from "cc";
|
|||||||
// let WsPath = `ws://localhost:8080/websocket`
|
// let WsPath = `ws://localhost:8080/websocket`
|
||||||
// let APIPath = `http://192.168.1.23:8080`
|
// let APIPath = `http://192.168.1.23:8080`
|
||||||
// let WsPath = `ws://192.168.1.23:8080/websocket`
|
// let WsPath = `ws://192.168.1.23:8080/websocket`
|
||||||
let APIPath = `http://192.168.0.119:8080`
|
let APIPath = `http://192.168.0.118:8080`
|
||||||
let WsPath = `ws://192.168.0.119:8080/websocket`
|
let WsPath = `ws://192.168.0.118:8080/websocket`
|
||||||
// let APIPath = `https://api.pet.jisol.cn`
|
// let APIPath = `https://api.pet.jisol.cn`
|
||||||
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
||||||
|
|
||||||
|
@ -17,12 +17,12 @@ export class AppData extends SystemBase{
|
|||||||
|
|
||||||
loadings:BaseData[] = [
|
loadings:BaseData[] = [
|
||||||
PlayerData.getIns(), //玩家信息
|
PlayerData.getIns(), //玩家信息
|
||||||
|
PetEquipData.getIns(), //宠物装备数据类
|
||||||
PlayerPetData.getIns(), //玩家宠物信息
|
PlayerPetData.getIns(), //玩家宠物信息
|
||||||
ChatData.getIns(), //聊天
|
ChatData.getIns(), //聊天
|
||||||
PlayerTacticalData.getIns(), //阵法
|
PlayerTacticalData.getIns(), //阵法
|
||||||
ResourceData.getIns(), //玩家资源
|
ResourceData.getIns(), //玩家资源
|
||||||
GOnHookData.getIns(), //无限模式信息类 (无限模式是游戏基础模式玩法 需要默认信息)
|
GOnHookData.getIns(), //无限模式信息类 (无限模式是游戏基础模式玩法 需要默认信息)
|
||||||
PetEquipData.getIns(), //宠物装备数据类
|
|
||||||
GBattleData.getIns(), //战斗数据(永远最后)
|
GBattleData.getIns(), //战斗数据(永远最后)
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ import { API, PlayerInfoOV, PlayerPetOV } from "../consts/API";
|
|||||||
import BaseData from "./BaseData";
|
import BaseData from "./BaseData";
|
||||||
import { GBattleDataEnum } from "./GBattleData";
|
import { GBattleDataEnum } from "./GBattleData";
|
||||||
import GOnHookData from "./GOnHookData";
|
import GOnHookData from "./GOnHookData";
|
||||||
|
import PetEquipData, { PetEquipDataEnum } from "./PetEquipData";
|
||||||
import PlayerTacticalData from "./PlayerTacticalData";
|
import PlayerTacticalData from "./PlayerTacticalData";
|
||||||
import { ResourceUpdateType } from "./ResourceData";
|
import { ResourceUpdateType } from "./ResourceData";
|
||||||
|
|
||||||
@ -23,6 +24,16 @@ export default class PlayerPetData extends BaseData{
|
|||||||
|
|
||||||
//更新玩家宠物
|
//更新玩家宠物
|
||||||
await this.UpdatePlayerPet();
|
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(){
|
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); //刷新属性
|
app.event.emit(GBattleDataEnum.UPDARE_ATTRIBUTE); //刷新属性
|
||||||
}
|
}
|
||||||
@ -68,12 +82,15 @@ export default class PlayerPetData extends BaseData{
|
|||||||
|
|
||||||
//添加宠物
|
//添加宠物
|
||||||
addPet(pet:PlayerPetOV){
|
addPet(pet:PlayerPetOV){
|
||||||
|
pet.petLevel = PetEquipData.getIns().getForgingBenchPetLevel(pet.petId);
|
||||||
this.datas.push(pet);
|
this.datas.push(pet);
|
||||||
}
|
}
|
||||||
|
|
||||||
//刷新返回宠物
|
//刷新返回宠物
|
||||||
onUpdateOV(operation:number,resource:PlayerPetOV){
|
onUpdateOV(operation:number,resource:PlayerPetOV){
|
||||||
|
|
||||||
|
resource.petLevel = PetEquipData.getIns().getForgingBenchPetLevel(resource.petId);
|
||||||
|
|
||||||
//如果没有刷新的宠物 则 返回
|
//如果没有刷新的宠物 则 返回
|
||||||
if(!resource) return;
|
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("你已经有宠物了!");
|
return NewsContext.onFail("你已经有宠物了!");
|
||||||
}else{
|
}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("选择宠物成功");
|
return NewsContext.onSuccess("选择宠物成功");
|
||||||
}else{
|
}else{
|
||||||
return NewsContext.onSuccess("选择宠物失败");
|
return NewsContext.onSuccess("选择宠物失败");
|
||||||
|
@ -124,40 +124,40 @@ public class GPlayerPetController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//提升宠物等级
|
// //提升宠物等级
|
||||||
@ApiImplicitParams({})
|
// @ApiImplicitParams({})
|
||||||
@ApiOperation(value = "提升宠物等级")
|
// @ApiOperation(value = "提升宠物等级")
|
||||||
@PostMapping("/up/level/{petId}")
|
// @PostMapping("/up/level/{petId}")
|
||||||
@Transactional
|
// @Transactional
|
||||||
public NewsResource<PlayerPet> onUpLevel(@PathVariable Integer petId, @CurrentPlayer Player player){
|
// public NewsResource<PlayerPet> onUpLevel(@PathVariable Integer petId, @CurrentPlayer Player player){
|
||||||
|
//
|
||||||
|
//
|
||||||
//获取需要升级的宠物
|
// //获取需要升级的宠物
|
||||||
PlayerPet pet = playerPetService.getById(petId);
|
// PlayerPet pet = playerPetService.getById(petId);
|
||||||
if(Objects.isNull(pet) || !Objects.equals(pet.getPetPlayerId(), player.getPlayerId())){
|
// if(Objects.isNull(pet) || !Objects.equals(pet.getPetPlayerId(), player.getPlayerId())){
|
||||||
return NewsResource.onFail("你未拥有这个宠物");
|
// return NewsResource.onFail("你未拥有这个宠物");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
TbGRoleUpLevel resource = TD.DATA.getTbGRoleUpLevel().get(pet.getPetLevel() + 1);
|
// TbGRoleUpLevel resource = TD.DATA.getTbGRoleUpLevel().get(pet.getPetLevel() + 1);
|
||||||
|
//
|
||||||
if(Objects.isNull(resource)) return NewsResource.onFail("无法升级");
|
// if(Objects.isNull(resource)) return NewsResource.onFail("无法升级");
|
||||||
|
//
|
||||||
//星级不够则 无法升级
|
// //星级不够则 无法升级
|
||||||
if(pet.getPetStar() * 10 <= pet.getPetLevel()){
|
// if(pet.getPetStar() * 10 <= pet.getPetLevel()){
|
||||||
return NewsResource.onFail("突破星级 可升级");
|
// return NewsResource.onFail("突破星级 可升级");
|
||||||
}
|
// }
|
||||||
//扣除玩家材料
|
// //扣除玩家材料
|
||||||
ArrayList<ResourceUpdateOV> resources = new ArrayList<>(resourceService.deduct(player, resource.materials));
|
// ArrayList<ResourceUpdateOV> resources = new ArrayList<>(resourceService.deduct(player, resource.materials));
|
||||||
|
//
|
||||||
//升级
|
// //升级
|
||||||
pet.setPetLevel(pet.getPetLevel() + 1);
|
// pet.setPetLevel(pet.getPetLevel() + 1);
|
||||||
|
//
|
||||||
//保存
|
// //保存
|
||||||
if(!playerPetService.updateById(pet)) throw new RetryException("");
|
// if(!playerPetService.updateById(pet)) throw new RetryException("");
|
||||||
resources.add(ResourceUpdateOV.onPet(ResourceUpdateOV.ResourceUpdateType.UPDATE,pet)); //刷新宠物
|
// resources.add(ResourceUpdateOV.onPet(ResourceUpdateOV.ResourceUpdateType.UPDATE,pet)); //刷新宠物
|
||||||
|
//
|
||||||
return NewsResource.onSuccess("升级成功",pet,resources.toArray(new ResourceUpdateOV[0]));
|
// 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)){
|
if(playerPetService.save(pet)){
|
||||||
return NewsContext.onSuccess("捕捉成功",pet);
|
return NewsContext.onSuccess("捕捉成功",pet);
|
||||||
}else{
|
}else{
|
||||||
|
@ -18,7 +18,6 @@ public class PlayerPet {
|
|||||||
private Long petId; //宠物唯一Id
|
private Long petId; //宠物唯一Id
|
||||||
private Long petPlayerId; //宠物的玩家Id
|
private Long petPlayerId; //宠物的玩家Id
|
||||||
private Integer petTbId; //宠物配置表Id
|
private Integer petTbId; //宠物配置表Id
|
||||||
private Integer petLevel; //宠物等级
|
|
||||||
private Integer petStar; //宠物星级
|
private Integer petStar; //宠物星级
|
||||||
private Integer petStarExp; //宠物星级经验
|
private Integer petStarExp; //宠物星级经验
|
||||||
@Version
|
@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.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.retry.RetryException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
@ -64,7 +65,7 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
|
|||||||
try{
|
try{
|
||||||
res = this.initResource(playerId,type,value);
|
res = this.initResource(playerId,type,value);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
return this.addResourceValue(playerId,type,value);
|
throw new RetryException("服务器忙碌啦");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
throw new ResourceNotException("资源不够");
|
throw new ResourceNotException("资源不够");
|
||||||
|
@ -4,8 +4,8 @@ spring:
|
|||||||
datasource:
|
datasource:
|
||||||
username: pet_jisol_cn
|
username: pet_jisol_cn
|
||||||
password: sThsBwjfDcaw2wJR
|
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://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://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
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
jackson:
|
jackson:
|
||||||
serialization:
|
serialization:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user