mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 11:24:46 +00:00
宠物升星
This commit is contained in:
parent
b33fede03e
commit
4fea6dd030
Binary file not shown.
@ -343,7 +343,7 @@ export class TbGResource {
|
|||||||
|
|
||||||
|
|
||||||
export namespace TB {
|
export namespace TB {
|
||||||
export class TbGRoleCUp {
|
export class TbGRoleUpLevel {
|
||||||
|
|
||||||
constructor(_json_: any) {
|
constructor(_json_: any) {
|
||||||
if (_json_.grade === undefined) { throw new Error() }
|
if (_json_.grade === undefined) { throw new Error() }
|
||||||
@ -400,7 +400,7 @@ export class Resource {
|
|||||||
|
|
||||||
|
|
||||||
export namespace TB {
|
export namespace TB {
|
||||||
export class TbGRoleCStar {
|
export class TbGRoleUpStar {
|
||||||
|
|
||||||
constructor(_json_: any) {
|
constructor(_json_: any) {
|
||||||
if (_json_.grade === undefined) { throw new Error() }
|
if (_json_.grade === undefined) { throw new Error() }
|
||||||
@ -717,24 +717,24 @@ export class TbGResource{
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
export class TbGRoleCUp{
|
export class TbGRoleUpLevel{
|
||||||
private _dataMap: Map<number, TB.TbGRoleCUp>
|
private _dataMap: Map<number, TB.TbGRoleUpLevel>
|
||||||
private _dataList: TB.TbGRoleCUp[]
|
private _dataList: TB.TbGRoleUpLevel[]
|
||||||
constructor(_json_: any) {
|
constructor(_json_: any) {
|
||||||
this._dataMap = new Map<number, TB.TbGRoleCUp>()
|
this._dataMap = new Map<number, TB.TbGRoleUpLevel>()
|
||||||
this._dataList = []
|
this._dataList = []
|
||||||
for(var _json2_ of _json_) {
|
for(var _json2_ of _json_) {
|
||||||
let _v: TB.TbGRoleCUp
|
let _v: TB.TbGRoleUpLevel
|
||||||
_v = new TB.TbGRoleCUp(_json2_)
|
_v = new TB.TbGRoleUpLevel(_json2_)
|
||||||
this._dataList.push(_v)
|
this._dataList.push(_v)
|
||||||
this._dataMap.set(_v.grade, _v)
|
this._dataMap.set(_v.grade, _v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getDataMap(): Map<number, TB.TbGRoleCUp> { return this._dataMap; }
|
getDataMap(): Map<number, TB.TbGRoleUpLevel> { return this._dataMap; }
|
||||||
getDataList(): TB.TbGRoleCUp[] { return this._dataList; }
|
getDataList(): TB.TbGRoleUpLevel[] { return this._dataList; }
|
||||||
|
|
||||||
get(key: number): TB.TbGRoleCUp | undefined { return this._dataMap.get(key); }
|
get(key: number): TB.TbGRoleUpLevel | undefined { return this._dataMap.get(key); }
|
||||||
|
|
||||||
resolve(tables:Tables)
|
resolve(tables:Tables)
|
||||||
{
|
{
|
||||||
@ -749,24 +749,24 @@ export class TbGRoleCUp{
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
export class TbGRoleCStar{
|
export class TbGRoleUpStar{
|
||||||
private _dataMap: Map<number, TB.TbGRoleCStar>
|
private _dataMap: Map<number, TB.TbGRoleUpStar>
|
||||||
private _dataList: TB.TbGRoleCStar[]
|
private _dataList: TB.TbGRoleUpStar[]
|
||||||
constructor(_json_: any) {
|
constructor(_json_: any) {
|
||||||
this._dataMap = new Map<number, TB.TbGRoleCStar>()
|
this._dataMap = new Map<number, TB.TbGRoleUpStar>()
|
||||||
this._dataList = []
|
this._dataList = []
|
||||||
for(var _json2_ of _json_) {
|
for(var _json2_ of _json_) {
|
||||||
let _v: TB.TbGRoleCStar
|
let _v: TB.TbGRoleUpStar
|
||||||
_v = new TB.TbGRoleCStar(_json2_)
|
_v = new TB.TbGRoleUpStar(_json2_)
|
||||||
this._dataList.push(_v)
|
this._dataList.push(_v)
|
||||||
this._dataMap.set(_v.grade, _v)
|
this._dataMap.set(_v.grade, _v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getDataMap(): Map<number, TB.TbGRoleCStar> { return this._dataMap; }
|
getDataMap(): Map<number, TB.TbGRoleUpStar> { return this._dataMap; }
|
||||||
getDataList(): TB.TbGRoleCStar[] { return this._dataList; }
|
getDataList(): TB.TbGRoleUpStar[] { return this._dataList; }
|
||||||
|
|
||||||
get(key: number): TB.TbGRoleCStar | undefined { return this._dataMap.get(key); }
|
get(key: number): TB.TbGRoleUpStar | undefined { return this._dataMap.get(key); }
|
||||||
|
|
||||||
resolve(tables:Tables)
|
resolve(tables:Tables)
|
||||||
{
|
{
|
||||||
@ -832,10 +832,10 @@ export class Tables {
|
|||||||
get TbGOnHookGlobal(): TbGOnHookGlobal { return this._TbGOnHookGlobal;}
|
get TbGOnHookGlobal(): TbGOnHookGlobal { return this._TbGOnHookGlobal;}
|
||||||
private _TbGResource: TbGResource
|
private _TbGResource: TbGResource
|
||||||
get TbGResource(): TbGResource { return this._TbGResource;}
|
get TbGResource(): TbGResource { return this._TbGResource;}
|
||||||
private _TbGRoleCUp: TbGRoleCUp
|
private _TbGRoleUpLevel: TbGRoleUpLevel
|
||||||
get TbGRoleCUp(): TbGRoleCUp { return this._TbGRoleCUp;}
|
get TbGRoleUpLevel(): TbGRoleUpLevel { return this._TbGRoleUpLevel;}
|
||||||
private _TbGRoleCStar: TbGRoleCStar
|
private _TbGRoleUpStar: TbGRoleUpStar
|
||||||
get TbGRoleCStar(): TbGRoleCStar { return this._TbGRoleCStar;}
|
get TbGRoleUpStar(): TbGRoleUpStar { return this._TbGRoleUpStar;}
|
||||||
private _TbSServerInfo: TbSServerInfo
|
private _TbSServerInfo: TbSServerInfo
|
||||||
get TbSServerInfo(): TbSServerInfo { return this._TbSServerInfo;}
|
get TbSServerInfo(): TbSServerInfo { return this._TbSServerInfo;}
|
||||||
|
|
||||||
@ -848,8 +848,8 @@ export class Tables {
|
|||||||
this._TbGMap = new TbGMap(loader('tbgmap'))
|
this._TbGMap = new TbGMap(loader('tbgmap'))
|
||||||
this._TbGOnHookGlobal = new TbGOnHookGlobal(loader('tbgonhookglobal'))
|
this._TbGOnHookGlobal = new TbGOnHookGlobal(loader('tbgonhookglobal'))
|
||||||
this._TbGResource = new TbGResource(loader('tbgresource'))
|
this._TbGResource = new TbGResource(loader('tbgresource'))
|
||||||
this._TbGRoleCUp = new TbGRoleCUp(loader('tbgrolecup'))
|
this._TbGRoleUpLevel = new TbGRoleUpLevel(loader('tbgroleuplevel'))
|
||||||
this._TbGRoleCStar = new TbGRoleCStar(loader('tbgrolecstar'))
|
this._TbGRoleUpStar = new TbGRoleUpStar(loader('tbgroleupstar'))
|
||||||
this._TbSServerInfo = new TbSServerInfo(loader('tbsserverinfo'))
|
this._TbSServerInfo = new TbSServerInfo(loader('tbsserverinfo'))
|
||||||
|
|
||||||
this._TbGGlobal.resolve(this)
|
this._TbGGlobal.resolve(this)
|
||||||
@ -860,8 +860,8 @@ export class Tables {
|
|||||||
this._TbGMap.resolve(this)
|
this._TbGMap.resolve(this)
|
||||||
this._TbGOnHookGlobal.resolve(this)
|
this._TbGOnHookGlobal.resolve(this)
|
||||||
this._TbGResource.resolve(this)
|
this._TbGResource.resolve(this)
|
||||||
this._TbGRoleCUp.resolve(this)
|
this._TbGRoleUpLevel.resolve(this)
|
||||||
this._TbGRoleCStar.resolve(this)
|
this._TbGRoleUpStar.resolve(this)
|
||||||
this._TbSServerInfo.resolve(this)
|
this._TbSServerInfo.resolve(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"ver": "2.0.1",
|
"ver": "2.0.1",
|
||||||
"importer": "json",
|
"importer": "json",
|
||||||
"imported": true,
|
"imported": true,
|
||||||
"uuid": "580aaa0b-8b26-4bc6-9abe-6984e9980679",
|
"uuid": "e973f307-a0ab-478d-85eb-36e1310007a7",
|
||||||
"files": [
|
"files": [
|
||||||
".json"
|
".json"
|
||||||
],
|
],
|
@ -2,7 +2,7 @@
|
|||||||
"ver": "2.0.1",
|
"ver": "2.0.1",
|
||||||
"importer": "json",
|
"importer": "json",
|
||||||
"imported": true,
|
"imported": true,
|
||||||
"uuid": "dfe67d28-0f19-440b-ad19-7c1f70b3528b",
|
"uuid": "02f53704-5e9c-4b95-8ef4-822a6a47882c",
|
||||||
"files": [
|
"files": [
|
||||||
".json"
|
".json"
|
||||||
],
|
],
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,5 @@
|
|||||||
import { app } from "../App";
|
import { app } from "../App";
|
||||||
|
import PlayerPetData from "../data/PlayerPetData";
|
||||||
import ResourceData from "../data/ResourceData";
|
import ResourceData from "../data/ResourceData";
|
||||||
import { GUI } from "../ui/UIConfig";
|
import { GUI } from "../ui/UIConfig";
|
||||||
|
|
||||||
@ -9,7 +10,8 @@ export const RData = (data:any,isTips:boolean = true) => {
|
|||||||
if(data.data['resources']){
|
if(data.data['resources']){
|
||||||
//刷新资源
|
//刷新资源
|
||||||
data.data['resources'].forEach(res => {
|
data.data['resources'].forEach(res => {
|
||||||
ResourceData.getIns().onUpdateOV(res.operation,res.resource);
|
ResourceData.getIns().onUpdateOV(res.operation,res.resource); //刷新资源
|
||||||
|
PlayerPetData.getIns().onUpdateOV(res.operation,res.pet); //刷新宠物
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return data.data.data;
|
return data.data.data;
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
|
import { app } from "../App";
|
||||||
import { API, PlayerInfoOV, PlayerPetOV } from "../consts/API";
|
import { API, PlayerInfoOV, PlayerPetOV } from "../consts/API";
|
||||||
import BaseData from "./BaseData";
|
import BaseData from "./BaseData";
|
||||||
|
import PlayerTacticalData from "./PlayerTacticalData";
|
||||||
|
import { ResourceUpdateType } from "./ResourceData";
|
||||||
|
|
||||||
|
export enum PlayerPetEvent{
|
||||||
|
UPDATE = "PlayerPetEvent_UPDATE", //刷新宠物
|
||||||
|
UPDATE_INFO = "PlayerPetEvent_UPDATE_INFO", //刷新宠物信息
|
||||||
|
UPDATE_ADD = "PlayerPetEvent_UPDATE_ADD", //添加宠物
|
||||||
|
UPDATE_MINUS = "PlayerPetEvent_UPDATE_MINUS", //减少宠物
|
||||||
|
}
|
||||||
|
|
||||||
//玩家宠物数据
|
//玩家宠物数据
|
||||||
export default class PlayerPetData extends BaseData{
|
export default class PlayerPetData extends BaseData{
|
||||||
@ -20,6 +29,16 @@ export default class PlayerPetData extends BaseData{
|
|||||||
return this.datas;
|
return this.datas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取指定宠物
|
||||||
|
getPetIdData(petTbId:number,datas:PlayerPetOV[] = this.datas):PlayerPetOV[]{
|
||||||
|
return datas.filter(data => data.petTbId == petTbId);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取未上阵的宠物
|
||||||
|
getNoTacticalData():PlayerPetOV[]{
|
||||||
|
return this.datas.filter(data => PlayerTacticalData.getIns().getTacticalInfo().indexOf(data.petId) < 0);
|
||||||
|
}
|
||||||
|
|
||||||
//更新玩家宠物
|
//更新玩家宠物
|
||||||
async UpdatePlayerPet(){
|
async UpdatePlayerPet(){
|
||||||
//获取全部宠物
|
//获取全部宠物
|
||||||
@ -43,6 +62,54 @@ export default class PlayerPetData extends BaseData{
|
|||||||
this.datas.push(pet);
|
this.datas.push(pet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//刷新返回宠物
|
||||||
|
onUpdateOV(operation:number,resource:PlayerPetOV){
|
||||||
|
|
||||||
|
//如果没有刷新的宠物 则 返回
|
||||||
|
if(!resource) return;
|
||||||
|
|
||||||
|
if(operation == ResourceUpdateType.UPDATE){
|
||||||
|
//更新资源
|
||||||
|
//找到需要被刷新的宠物 然后刷新 找不到则添加
|
||||||
|
let pet = this.datas.filter(pet => pet.petId == resource.petId)[0];
|
||||||
|
if(pet){
|
||||||
|
//更新数据
|
||||||
|
Object.assign(pet,resource);
|
||||||
|
app.event.emit(PlayerPetEvent.UPDATE_INFO)
|
||||||
|
}else{
|
||||||
|
operation = ResourceUpdateType.ADD;
|
||||||
|
this.onUpdateOV(operation,resource);
|
||||||
|
}
|
||||||
|
}else if(operation == ResourceUpdateType.ADD){
|
||||||
|
//查询如果没有这个宠物则添加 负责 刷新
|
||||||
|
let pet = this.datas.filter(pet => pet.petId != resource.petId)[0];
|
||||||
|
if(!pet){
|
||||||
|
//没有则添加
|
||||||
|
this.datas.push(resource);
|
||||||
|
app.event.emit(PlayerPetEvent.UPDATE)
|
||||||
|
app.event.emit(PlayerPetEvent.UPDATE_ADD,pet)
|
||||||
|
}else{
|
||||||
|
operation = ResourceUpdateType.UPDATE;
|
||||||
|
this.onUpdateOV(operation,resource);
|
||||||
|
}
|
||||||
|
}else if(operation == ResourceUpdateType.MINUS){
|
||||||
|
|
||||||
|
//删除的宠物
|
||||||
|
let delPet;
|
||||||
|
//删除指定的宠物
|
||||||
|
this.datas = this.datas.filter(pet => {
|
||||||
|
if(pet.petId == resource.petId){
|
||||||
|
delPet = pet;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
app.event.emit(PlayerPetEvent.UPDATE)
|
||||||
|
delPet && app.event.emit(PlayerPetEvent.UPDATE_MINUS,delPet)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,13 @@ export enum ResourceType{
|
|||||||
Gold = 90001, //金币
|
Gold = 90001, //金币
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//资源刷新类型
|
||||||
|
export enum ResourceUpdateType{
|
||||||
|
UPDATE = 0, //刷新资源数量
|
||||||
|
MINUS = 1, //减少资源数量
|
||||||
|
ADD = 2, //添加资源数量
|
||||||
|
}
|
||||||
|
|
||||||
//玩家资源数据
|
//玩家资源数据
|
||||||
export default class ResourceData extends BaseData{
|
export default class ResourceData extends BaseData{
|
||||||
|
|
||||||
@ -43,12 +50,15 @@ export default class ResourceData extends BaseData{
|
|||||||
//刷新返回资源
|
//刷新返回资源
|
||||||
onUpdateOV(operation:number,resource:ResourceOV){
|
onUpdateOV(operation:number,resource:ResourceOV){
|
||||||
|
|
||||||
if(operation == 0){
|
//如果没有刷新的资源 则 返回
|
||||||
|
if(!resource) return;
|
||||||
|
|
||||||
|
if(operation == ResourceUpdateType.UPDATE){
|
||||||
//更新资源
|
//更新资源
|
||||||
this.data[resource.resourceTbId] = resource.resourceValue;
|
this.data[resource.resourceTbId] = resource.resourceValue;
|
||||||
|
app.event.emit(ResourceEvent.UPDATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
app.event.emit(ResourceEvent.UPDATE)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { _decorator, Component, Node } from 'cc';
|
import { _decorator, Component, Node } from 'cc';
|
||||||
import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
|
import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
|
||||||
import JNScrollView from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
|
import JNScrollView from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
|
||||||
import PlayerPetData from '../../data/PlayerPetData';
|
import PlayerPetData, { PlayerPetEvent } from '../../data/PlayerPetData';
|
||||||
import { API, PlayerPetOV } from '../../consts/API';
|
import { API, PlayerPetOV } from '../../consts/API';
|
||||||
import { PetOV, PlayerPetOVSelect } from '../VO/PetOV';
|
import { PetOV, PlayerPetOVSelect } from '../VO/PetOV';
|
||||||
import { PetIconSelectScroll } from '../Consts/Pet/PetIconSelectScroll';
|
import { PetIconSelectScroll } from '../Consts/Pet/PetIconSelectScroll';
|
||||||
@ -9,6 +9,8 @@ import { NodeEventType } from 'cc';
|
|||||||
import { Label } from 'cc';
|
import { Label } from 'cc';
|
||||||
import { app, TD } from '../../App';
|
import { app, TD } from '../../App';
|
||||||
import { GUI } from '../UIConfig';
|
import { GUI } from '../UIConfig';
|
||||||
|
import { ProgressBar } from 'cc';
|
||||||
|
import JProgressBar from '../../../../extensions/ngame/assets/ngame/util/components/Progress/JProgressBar';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('PetUpStarView')
|
@ccclass('PetUpStarView')
|
||||||
@ -23,9 +25,10 @@ export class PetUpStarView extends JNLayerBase {
|
|||||||
petStar:Label; //宠物星级
|
petStar:Label; //宠物星级
|
||||||
@property(Label)
|
@property(Label)
|
||||||
petStarExp:Label; //宠物星级经验
|
petStarExp:Label; //宠物星级经验
|
||||||
|
@property(JProgressBar)
|
||||||
//宠物数据
|
petExpProgress:JProgressBar; //宠物经验条
|
||||||
pets:PlayerPetOVSelect[] = [];
|
@property(JProgressBar)
|
||||||
|
viewPetExpProgress:JProgressBar; //预览宠物经验条
|
||||||
|
|
||||||
data:PlayerPetOV;
|
data:PlayerPetOV;
|
||||||
|
|
||||||
@ -35,6 +38,16 @@ export class PetUpStarView extends JNLayerBase {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
this.onUpdateView();
|
this.onUpdateView();
|
||||||
|
|
||||||
|
//监听
|
||||||
|
app.event.on(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this); //刷新宠物信息
|
||||||
|
app.event.on(PlayerPetEvent.UPDATE_MINUS,this.onPetMinus,this); //减少宠物
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
onJNClose(): void {
|
||||||
|
//取消监听
|
||||||
|
app.event.off(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this); //刷新宠物信息
|
||||||
|
app.event.off(PlayerPetEvent.UPDATE_MINUS,this.onPetMinus,this); //减少宠物
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -43,9 +56,14 @@ export class PetUpStarView extends JNLayerBase {
|
|||||||
|
|
||||||
this.onUpdateInfo();
|
this.onUpdateInfo();
|
||||||
|
|
||||||
//获取所有玩家宠物
|
//当前需要升星的宠物并且未上阵 并且排除自己
|
||||||
this.pets = PetOV.PlayerPetOVSelects(PlayerPetData.getIns().getData());
|
let pets = PetOV.PlayerPetOVSelects(
|
||||||
this.views.refreshData(this.pets);
|
PlayerPetData.getIns().getPetIdData(
|
||||||
|
this.data.petTbId, //同一种宠物
|
||||||
|
PlayerPetData.getIns().getNoTacticalData() //非上阵宠物
|
||||||
|
).filter(pet => pet.petId != this.data.petId) //排除自己
|
||||||
|
);
|
||||||
|
this.views.refreshData(pets);
|
||||||
|
|
||||||
//向子节点添加点击事件
|
//向子节点添加点击事件
|
||||||
this.views.addItemEvent(NodeEventType.TOUCH_START,this.onClickItem.bind(this));
|
this.views.addItemEvent(NodeEventType.TOUCH_START,this.onClickItem.bind(this));
|
||||||
@ -60,8 +78,19 @@ export class PetUpStarView extends JNLayerBase {
|
|||||||
//显示宠物名称
|
//显示宠物名称
|
||||||
this.petNameLabel.string = TD.TbGRole.get(this.data.petTbId).roleName;
|
this.petNameLabel.string = TD.TbGRole.get(this.data.petTbId).roleName;
|
||||||
this.petStar.string = `当前星级: ${this.data.petStar} 星`;
|
this.petStar.string = `当前星级: ${this.data.petStar} 星`;
|
||||||
this.petStarExp.string = `升级所需经验 / ${this.data.petStarExp}`;
|
|
||||||
|
|
||||||
|
let upStarExp = TD.TbGRoleUpStar.get(this.data.petStar + 1).merge;
|
||||||
|
this.petStarExp.string = `升级进度: ${upStarExp} / ${this.data.petStarExp}`;
|
||||||
|
this.petExpProgress.value = (this.data.petStarExp / upStarExp);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//减少宠物
|
||||||
|
onPetMinus(pet:PlayerPetOV){
|
||||||
|
this.views.getItems<PetIconSelectScroll>().forEach(item => {
|
||||||
|
if(item.data.petId == pet.petId)
|
||||||
|
this.views.delData(item.data);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//刷新选择
|
//刷新选择
|
||||||
@ -73,31 +102,55 @@ export class PetUpStarView extends JNLayerBase {
|
|||||||
item.select.isSelect = data.isSelect;
|
item.select.isSelect = data.isSelect;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.onUpdatePreview();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新预览进度条
|
||||||
|
onUpdatePreview(){
|
||||||
|
|
||||||
|
//选择得到的经验
|
||||||
|
let exp = this.views.getItems<PetIconSelectScroll>().filter(item => item.select.isSelect).length;
|
||||||
|
|
||||||
|
let upStarExp;
|
||||||
|
let petStarExp = this.data.petStarExp + exp;
|
||||||
|
let petStar = this.data.petStar;
|
||||||
|
|
||||||
|
while(petStarExp >= (upStarExp = TD.TbGRoleUpStar.get(petStar + 1).merge)){
|
||||||
|
petStar++;
|
||||||
|
petStarExp = Math.floor(petStarExp - upStarExp);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.petStar.string = `当前星级: ${petStar} 星`;
|
||||||
|
this.petStarExp.string = `升级进度: ${upStarExp} / ${petStarExp}`;
|
||||||
|
//预览进度
|
||||||
|
this.viewPetExpProgress.value = (petStarExp / upStarExp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//选择全部
|
//选择全部
|
||||||
onClickAll(){
|
onClickAll(){
|
||||||
|
let pets = this.views.getData<PlayerPetOVSelect>();
|
||||||
//如果全部选择则全部取消
|
//如果全部选择则全部取消
|
||||||
if(this.pets.filter(pet => pet.isSelect).length == this.pets.length){
|
if(pets.filter(pet => pet.isSelect).length == pets.length){
|
||||||
this.pets.forEach(pet => pet.isSelect = false);
|
pets.forEach(pet => pet.isSelect = false);
|
||||||
}else{
|
}else{
|
||||||
this.pets.forEach(pet => pet.isSelect = true);
|
pets.forEach(pet => pet.isSelect = true);
|
||||||
}
|
}
|
||||||
this.onUpdateSelect();
|
this.onUpdateSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
//点击Item
|
//点击Item
|
||||||
onClickItem(index:number){
|
onClickItem(index:number){
|
||||||
|
let pets = this.views.getData<PlayerPetOVSelect>();
|
||||||
this.pets[index].isSelect = !this.pets[index].isSelect;
|
pets[index].isSelect = !pets[index].isSelect;
|
||||||
this.onUpdateSelect();
|
this.onUpdateSelect();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//点击合成
|
//点击合成
|
||||||
async onClickUp(){
|
async onClickUp(){
|
||||||
//获取被合成的Id
|
//获取被合成的Id
|
||||||
let pets = this.pets.filter(pet => pet.isSelect).map(pet => pet.petId);
|
let pets = this.views.getData<PlayerPetOVSelect>().filter(pet => pet.isSelect).map(pet => pet.petId);
|
||||||
|
|
||||||
if(pets.length <= 0){
|
if(pets.length <= 0){
|
||||||
app.layer.Open(GUI.Tips,{text:"请选择需要被合成的宠物"});
|
app.layer.Open(GUI.Tips,{text:"请选择需要被合成的宠物"});
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 0ac0cc67b0cd8bd70fa3c9ead11fee366a6d7d68
|
Subproject commit 8c270e5f8d9df4b531c5c102a43c1a66c85e2e53
|
@ -14,14 +14,14 @@ import com.google.gson.JsonElement;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
|
||||||
public final class TbGRoleCUp extends AbstractBean {
|
public final class TbGRoleUpLevel extends AbstractBean {
|
||||||
public TbGRoleCUp(JsonObject _buf) {
|
public TbGRoleUpLevel(JsonObject _buf) {
|
||||||
grade = _buf.get("grade").getAsInt();
|
grade = _buf.get("grade").getAsInt();
|
||||||
{ com.google.gson.JsonArray _json0_ = _buf.get("materials").getAsJsonArray(); int __n0 = _json0_.size(); materials = new cfg.TbGEntity.Resource[__n0]; int __index0=0; for(JsonElement __e0 : _json0_) { cfg.TbGEntity.Resource __v0; __v0 = cfg.TbGEntity.Resource.deserialize(__e0.getAsJsonObject()); materials[__index0++] = __v0; } }
|
{ com.google.gson.JsonArray _json0_ = _buf.get("materials").getAsJsonArray(); int __n0 = _json0_.size(); materials = new cfg.TbGEntity.Resource[__n0]; int __index0=0; for(JsonElement __e0 : _json0_) { cfg.TbGEntity.Resource __v0; __v0 = cfg.TbGEntity.Resource.deserialize(__e0.getAsJsonObject()); materials[__index0++] = __v0; } }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TbGRoleCUp deserialize(JsonObject _buf) {
|
public static TbGRoleUpLevel deserialize(JsonObject _buf) {
|
||||||
return new cfg.TB.TbGRoleCUp(_buf);
|
return new cfg.TB.TbGRoleUpLevel(_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,7 +33,7 @@ public final class TbGRoleCUp extends AbstractBean {
|
|||||||
*/
|
*/
|
||||||
public final cfg.TbGEntity.Resource[] materials;
|
public final cfg.TbGEntity.Resource[] materials;
|
||||||
|
|
||||||
public static final int __ID__ = 1860940751;
|
public static final int __ID__ = -877225318;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTypeId() { return __ID__; }
|
public int getTypeId() { return __ID__; }
|
@ -14,14 +14,14 @@ import com.google.gson.JsonElement;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
|
||||||
public final class TbGRoleCStar extends AbstractBean {
|
public final class TbGRoleUpStar extends AbstractBean {
|
||||||
public TbGRoleCStar(JsonObject _buf) {
|
public TbGRoleUpStar(JsonObject _buf) {
|
||||||
grade = _buf.get("grade").getAsInt();
|
grade = _buf.get("grade").getAsInt();
|
||||||
merge = _buf.get("merge").getAsInt();
|
merge = _buf.get("merge").getAsInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TbGRoleCStar deserialize(JsonObject _buf) {
|
public static TbGRoleUpStar deserialize(JsonObject _buf) {
|
||||||
return new cfg.TB.TbGRoleCStar(_buf);
|
return new cfg.TB.TbGRoleUpStar(_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,7 +33,7 @@ public final class TbGRoleCStar extends AbstractBean {
|
|||||||
*/
|
*/
|
||||||
public final int merge;
|
public final int merge;
|
||||||
|
|
||||||
public static final int __ID__ = 1657613958;
|
public static final int __ID__ = 387566716;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTypeId() { return __ID__; }
|
public int getTypeId() { return __ID__; }
|
@ -35,10 +35,10 @@ public final class Tables
|
|||||||
public cfg.TbGOnHookGlobal getTbGOnHookGlobal() { return _tbgonhookglobal; }
|
public cfg.TbGOnHookGlobal getTbGOnHookGlobal() { return _tbgonhookglobal; }
|
||||||
private final cfg.TbGResource _tbgresource;
|
private final cfg.TbGResource _tbgresource;
|
||||||
public cfg.TbGResource getTbGResource() { return _tbgresource; }
|
public cfg.TbGResource getTbGResource() { return _tbgresource; }
|
||||||
private final cfg.TbGRoleCUp _tbgrolecup;
|
private final cfg.TbGRoleUpLevel _tbgroleuplevel;
|
||||||
public cfg.TbGRoleCUp getTbGRoleCUp() { return _tbgrolecup; }
|
public cfg.TbGRoleUpLevel getTbGRoleUpLevel() { return _tbgroleuplevel; }
|
||||||
private final cfg.TbGRoleCStar _tbgrolecstar;
|
private final cfg.TbGRoleUpStar _tbgroleupstar;
|
||||||
public cfg.TbGRoleCStar getTbGRoleCStar() { return _tbgrolecstar; }
|
public cfg.TbGRoleUpStar getTbGRoleUpStar() { return _tbgroleupstar; }
|
||||||
private final cfg.TbSServerInfo _tbsserverinfo;
|
private final cfg.TbSServerInfo _tbsserverinfo;
|
||||||
public cfg.TbSServerInfo getTbSServerInfo() { return _tbsserverinfo; }
|
public cfg.TbSServerInfo getTbSServerInfo() { return _tbsserverinfo; }
|
||||||
|
|
||||||
@ -51,8 +51,8 @@ public final class Tables
|
|||||||
_tbgmap = new cfg.TbGMap(loader.load("tbgmap"));
|
_tbgmap = new cfg.TbGMap(loader.load("tbgmap"));
|
||||||
_tbgonhookglobal = new cfg.TbGOnHookGlobal(loader.load("tbgonhookglobal"));
|
_tbgonhookglobal = new cfg.TbGOnHookGlobal(loader.load("tbgonhookglobal"));
|
||||||
_tbgresource = new cfg.TbGResource(loader.load("tbgresource"));
|
_tbgresource = new cfg.TbGResource(loader.load("tbgresource"));
|
||||||
_tbgrolecup = new cfg.TbGRoleCUp(loader.load("tbgrolecup"));
|
_tbgroleuplevel = new cfg.TbGRoleUpLevel(loader.load("tbgroleuplevel"));
|
||||||
_tbgrolecstar = new cfg.TbGRoleCStar(loader.load("tbgrolecstar"));
|
_tbgroleupstar = new cfg.TbGRoleUpStar(loader.load("tbgroleupstar"));
|
||||||
_tbsserverinfo = new cfg.TbSServerInfo(loader.load("tbsserverinfo"));
|
_tbsserverinfo = new cfg.TbSServerInfo(loader.load("tbsserverinfo"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
package cfg;
|
|
||||||
|
|
||||||
import luban.*;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
|
|
||||||
|
|
||||||
public final class TbGRoleCStar {
|
|
||||||
private final java.util.HashMap<Integer, cfg.TB.TbGRoleCStar> _dataMap;
|
|
||||||
private final java.util.ArrayList<cfg.TB.TbGRoleCStar> _dataList;
|
|
||||||
|
|
||||||
public TbGRoleCStar(JsonElement _buf) {
|
|
||||||
_dataMap = new java.util.HashMap<Integer, cfg.TB.TbGRoleCStar>();
|
|
||||||
_dataList = new java.util.ArrayList<cfg.TB.TbGRoleCStar>();
|
|
||||||
|
|
||||||
for (com.google.gson.JsonElement _e_ : _buf.getAsJsonArray()) {
|
|
||||||
cfg.TB.TbGRoleCStar _v;
|
|
||||||
_v = cfg.TB.TbGRoleCStar.deserialize(_e_.getAsJsonObject());
|
|
||||||
_dataList.add(_v);
|
|
||||||
_dataMap.put(_v.grade, _v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.HashMap<Integer, cfg.TB.TbGRoleCStar> getDataMap() { return _dataMap; }
|
|
||||||
public java.util.ArrayList<cfg.TB.TbGRoleCStar> getDataList() { return _dataList; }
|
|
||||||
|
|
||||||
public cfg.TB.TbGRoleCStar get(int key) { return _dataMap.get(key); }
|
|
||||||
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
package cfg;
|
|
||||||
|
|
||||||
import luban.*;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
|
|
||||||
|
|
||||||
public final class TbGRoleCUp {
|
|
||||||
private final java.util.HashMap<Integer, cfg.TB.TbGRoleCUp> _dataMap;
|
|
||||||
private final java.util.ArrayList<cfg.TB.TbGRoleCUp> _dataList;
|
|
||||||
|
|
||||||
public TbGRoleCUp(JsonElement _buf) {
|
|
||||||
_dataMap = new java.util.HashMap<Integer, cfg.TB.TbGRoleCUp>();
|
|
||||||
_dataList = new java.util.ArrayList<cfg.TB.TbGRoleCUp>();
|
|
||||||
|
|
||||||
for (com.google.gson.JsonElement _e_ : _buf.getAsJsonArray()) {
|
|
||||||
cfg.TB.TbGRoleCUp _v;
|
|
||||||
_v = cfg.TB.TbGRoleCUp.deserialize(_e_.getAsJsonObject());
|
|
||||||
_dataList.add(_v);
|
|
||||||
_dataMap.put(_v.grade, _v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.HashMap<Integer, cfg.TB.TbGRoleCUp> getDataMap() { return _dataMap; }
|
|
||||||
public java.util.ArrayList<cfg.TB.TbGRoleCUp> getDataList() { return _dataList; }
|
|
||||||
|
|
||||||
public cfg.TB.TbGRoleCUp get(int key) { return _dataMap.get(key); }
|
|
||||||
|
|
||||||
}
|
|
37
JisolGameServer/Main/src/main/java/cfg/TbGRoleUpLevel.java
Normal file
37
JisolGameServer/Main/src/main/java/cfg/TbGRoleUpLevel.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
package cfg;
|
||||||
|
|
||||||
|
import luban.*;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
|
|
||||||
|
public final class TbGRoleUpLevel {
|
||||||
|
private final java.util.HashMap<Integer, cfg.TB.TbGRoleUpLevel> _dataMap;
|
||||||
|
private final java.util.ArrayList<cfg.TB.TbGRoleUpLevel> _dataList;
|
||||||
|
|
||||||
|
public TbGRoleUpLevel(JsonElement _buf) {
|
||||||
|
_dataMap = new java.util.HashMap<Integer, cfg.TB.TbGRoleUpLevel>();
|
||||||
|
_dataList = new java.util.ArrayList<cfg.TB.TbGRoleUpLevel>();
|
||||||
|
|
||||||
|
for (com.google.gson.JsonElement _e_ : _buf.getAsJsonArray()) {
|
||||||
|
cfg.TB.TbGRoleUpLevel _v;
|
||||||
|
_v = cfg.TB.TbGRoleUpLevel.deserialize(_e_.getAsJsonObject());
|
||||||
|
_dataList.add(_v);
|
||||||
|
_dataMap.put(_v.grade, _v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.util.HashMap<Integer, cfg.TB.TbGRoleUpLevel> getDataMap() { return _dataMap; }
|
||||||
|
public java.util.ArrayList<cfg.TB.TbGRoleUpLevel> getDataList() { return _dataList; }
|
||||||
|
|
||||||
|
public cfg.TB.TbGRoleUpLevel get(int key) { return _dataMap.get(key); }
|
||||||
|
|
||||||
|
}
|
37
JisolGameServer/Main/src/main/java/cfg/TbGRoleUpStar.java
Normal file
37
JisolGameServer/Main/src/main/java/cfg/TbGRoleUpStar.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
package cfg;
|
||||||
|
|
||||||
|
import luban.*;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
|
|
||||||
|
public final class TbGRoleUpStar {
|
||||||
|
private final java.util.HashMap<Integer, cfg.TB.TbGRoleUpStar> _dataMap;
|
||||||
|
private final java.util.ArrayList<cfg.TB.TbGRoleUpStar> _dataList;
|
||||||
|
|
||||||
|
public TbGRoleUpStar(JsonElement _buf) {
|
||||||
|
_dataMap = new java.util.HashMap<Integer, cfg.TB.TbGRoleUpStar>();
|
||||||
|
_dataList = new java.util.ArrayList<cfg.TB.TbGRoleUpStar>();
|
||||||
|
|
||||||
|
for (com.google.gson.JsonElement _e_ : _buf.getAsJsonArray()) {
|
||||||
|
cfg.TB.TbGRoleUpStar _v;
|
||||||
|
_v = cfg.TB.TbGRoleUpStar.deserialize(_e_.getAsJsonObject());
|
||||||
|
_dataList.add(_v);
|
||||||
|
_dataMap.put(_v.grade, _v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.util.HashMap<Integer, cfg.TB.TbGRoleUpStar> getDataMap() { return _dataMap; }
|
||||||
|
public java.util.ArrayList<cfg.TB.TbGRoleUpStar> getDataList() { return _dataList; }
|
||||||
|
|
||||||
|
public cfg.TB.TbGRoleUpStar get(int key) { return _dataMap.get(key); }
|
||||||
|
|
||||||
|
}
|
@ -1,9 +1,12 @@
|
|||||||
package cn.jisol.game.controller.game;
|
package cn.jisol.game.controller.game;
|
||||||
|
|
||||||
import cn.jisol.game.controller.argsresolver.CurrentPlayer;
|
import cn.jisol.game.controller.argsresolver.CurrentPlayer;
|
||||||
|
import cn.jisol.game.data.TD;
|
||||||
import cn.jisol.game.entity.game.Player;
|
import cn.jisol.game.entity.game.Player;
|
||||||
import cn.jisol.game.entity.game.PlayerPet;
|
import cn.jisol.game.entity.game.PlayerPet;
|
||||||
import cn.jisol.game.service.PlayerPetService;
|
import cn.jisol.game.service.PlayerPetService;
|
||||||
|
import cn.jisol.game.vo.news.NewsResource;
|
||||||
|
import cn.jisol.game.vo.news.ov.ResourceUpdateOV;
|
||||||
import cn.jisol.game.vo.pet.PetUpStarOV;
|
import cn.jisol.game.vo.pet.PetUpStarOV;
|
||||||
import cn.jisol.ngame.util.NewsContext;
|
import cn.jisol.ngame.util.NewsContext;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@ -14,6 +17,8 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -47,11 +52,11 @@ public class GPlayerPetController {
|
|||||||
@ApiImplicitParams({})
|
@ApiImplicitParams({})
|
||||||
@ApiOperation(value = "提升宠物星")
|
@ApiOperation(value = "提升宠物星")
|
||||||
@PostMapping("/up/star")
|
@PostMapping("/up/star")
|
||||||
public NewsContext<PlayerPet> onUpStar(@RequestBody PetUpStarOV info,@CurrentPlayer Player player){
|
public NewsResource<PlayerPet> onUpStar(@RequestBody PetUpStarOV info, @CurrentPlayer Player player){
|
||||||
|
|
||||||
//判断参数
|
//判断参数
|
||||||
if(info.getPets().size() <= 0 || Objects.isNull(info.getPetId())){
|
if(info.getPets().size() <= 0 || Objects.isNull(info.getPetId())){
|
||||||
return NewsContext.onFail("参数错误");
|
return NewsResource.onFail("参数错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询被合成的宠物列表
|
//查询被合成的宠物列表
|
||||||
@ -69,7 +74,7 @@ public class GPlayerPetController {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if(info.getPets().size() != petCount){
|
if(info.getPets().size() != petCount){
|
||||||
return NewsContext.onFail("合成宠物信息错误");
|
return NewsResource.onFail("合成宠物信息错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询被升级的宠物
|
//查询被升级的宠物
|
||||||
@ -77,19 +82,37 @@ public class GPlayerPetController {
|
|||||||
|
|
||||||
//判断宠物是否是自己的
|
//判断宠物是否是自己的
|
||||||
if(!Objects.equals(pet.getPetPlayerId(), player.getPlayerId())){
|
if(!Objects.equals(pet.getPetPlayerId(), player.getPlayerId())){
|
||||||
return NewsContext.onFail("宠物不是自己的");
|
return NewsResource.onFail("宠物不是自己的");
|
||||||
}
|
}
|
||||||
|
|
||||||
//升级星
|
//升级星
|
||||||
pet.setPetStarExp(pet.getPetStarExp() + info.getPets().size());
|
pet.setPetStarExp(pet.getPetStarExp() + info.getPets().size());
|
||||||
|
|
||||||
|
//判断是否可以升下一星 如果可以则 升
|
||||||
|
int upStarExp;
|
||||||
|
while (pet.getPetStarExp() >= (upStarExp = TD.DATA.getTbGRoleUpStar().get(pet.getPetStar() + 1).merge)){
|
||||||
|
//消耗经验
|
||||||
|
pet.setPetStarExp(pet.getPetStarExp() - upStarExp);
|
||||||
|
//升星
|
||||||
|
pet.setPetStar(pet.getPetStar() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
//保存宠物信息
|
//保存宠物信息
|
||||||
playerPetService.updateById(pet);
|
playerPetService.updateById(pet);
|
||||||
|
|
||||||
//删除被合成的宠物
|
//删除被合成的宠物
|
||||||
playerPetService.removeByIds(info.getPets());
|
playerPetService.removeByIds(info.getPets());
|
||||||
|
|
||||||
return NewsContext.onSuccess("升星成功",pet);
|
//整理刷新数据
|
||||||
|
ArrayList<ResourceUpdateOV> resources = new ArrayList<>();
|
||||||
|
//刷新宠物
|
||||||
|
resources.add(ResourceUpdateOV.onPet(ResourceUpdateOV.ResourceUpdateType.UPDATE,pet));
|
||||||
|
//删除被合成的宠物
|
||||||
|
info.getPets().forEach(item -> {
|
||||||
|
resources.add(ResourceUpdateOV.onPet(ResourceUpdateOV.ResourceUpdateType.MINUS,PlayerPet.builder().petId(new Long(item)).build()));
|
||||||
|
});
|
||||||
|
|
||||||
|
return NewsResource.onSuccess("升星成功",null, resources.toArray(new ResourceUpdateOV[0]));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.jisol.game.vo.news.ov;
|
package cn.jisol.game.vo.news.ov;
|
||||||
|
|
||||||
|
import cn.jisol.game.entity.game.PlayerPet;
|
||||||
import cn.jisol.game.entity.game.Resource;
|
import cn.jisol.game.entity.game.Resource;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -9,7 +10,8 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class ResourceUpdateOV {
|
public class ResourceUpdateOV {
|
||||||
|
|
||||||
Resource resource;
|
Resource resource; //资源
|
||||||
|
PlayerPet pet; //宠物
|
||||||
|
|
||||||
//操作
|
//操作
|
||||||
int operation = 0;
|
int operation = 0;
|
||||||
@ -26,4 +28,9 @@ public class ResourceUpdateOV {
|
|||||||
return ResourceUpdateOV.builder().operation(ResourceUpdateType.UPDATE).resource(resource).build();
|
return ResourceUpdateOV.builder().operation(ResourceUpdateType.UPDATE).resource(resource).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//返回宠物
|
||||||
|
public static ResourceUpdateOV onPet(int type,PlayerPet pet){
|
||||||
|
return ResourceUpdateOV.builder().operation(type).pet(pet).build();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user