mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 18:26:23 +00:00
提交
This commit is contained in:
@@ -30,10 +30,10 @@ import { Component } from "cc";
|
||||
|
||||
// let APIPath = `http://localhost:8080`
|
||||
// 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.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 = `https://api.pet.jisol.cn`
|
||||
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
||||
|
||||
|
@@ -286,6 +286,8 @@ export class TbGResource {
|
||||
this.name = _json_.name
|
||||
if (_json_.tig === undefined) { throw new Error() }
|
||||
this.tig = _json_.tig
|
||||
if (_json_.args === undefined) { throw new Error() }
|
||||
this.args = _json_.args
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,6 +302,10 @@ export class TbGResource {
|
||||
* 描述
|
||||
*/
|
||||
readonly tig: string
|
||||
/**
|
||||
* 额外参数
|
||||
*/
|
||||
readonly args: string
|
||||
|
||||
resolve(tables:Tables)
|
||||
{
|
||||
|
@@ -102,6 +102,7 @@ export interface ModeOnHookRankingOV{
|
||||
mapId:number; //地图Id
|
||||
}
|
||||
|
||||
|
||||
//宠物装备
|
||||
export interface PetEquip{
|
||||
equipId:number; //装备唯一Id
|
||||
@@ -118,13 +119,23 @@ export interface PetEquip{
|
||||
|
||||
//宠物锻造台
|
||||
export interface EquipForgingBench{
|
||||
forgingId:number; //锻造台Id
|
||||
playerId:number; //锻造台所属的玩家Id
|
||||
forgingExp:number; //锻造等级经验
|
||||
forgingQuality:number; //锻造品质等级
|
||||
forgingPetId:number; //当前占用宠物Id
|
||||
forgingId:number; //锻造台Id
|
||||
playerId:number; //锻造台所属的玩家Id
|
||||
forgingExp:number; //锻造等级经验
|
||||
forgingQuality:number; //锻造品质等级
|
||||
forgingPetId:number; //当前占用宠物Id
|
||||
currentForgingQuality:number; //当前锻造等级经验
|
||||
forgingUpTimeExcess: number; //升级剩余时间
|
||||
forgingPetLevels:{[key:string]:number} //宠物等级
|
||||
}
|
||||
|
||||
//宠物锻造OV
|
||||
export interface PetEquipForgingOV{
|
||||
info:EquipForgingBench;
|
||||
equip:PetEquip;
|
||||
}
|
||||
|
||||
|
||||
export const API = {
|
||||
|
||||
/********** debugger *****************/
|
||||
@@ -158,10 +169,12 @@ export const API = {
|
||||
|
||||
/********** 宠物装备系统接口 ****************/
|
||||
PetEquipAll: async () => RData(await app.api.get(`/game/equip/all`),false) as PetEquip[], //获取全部装备
|
||||
PetEquipForging: async () => RData(await app.api.get(`/game/equip/forging`),true) as PetEquip, //锻造装备
|
||||
PetEquipForgingInfo: async () => RData(await app.api.get(`/game/equip/forging/info`),true) as EquipForgingBench, //锻造台
|
||||
PetEquipForging: async () => RData(await app.api.get(`/game/equip/forging`),true) as PetEquipForgingOV, //锻造装备
|
||||
PetEquipForgingInfo: async () => RData(await app.api.get(`/game/equip/forging/info`),false) as EquipForgingBench, //锻造台
|
||||
PetEquipForgingPetId: async (petId:number) => RData(await app.api.post(`/game/equip/forging/petId/${petId}`),true) as EquipForgingBench, //设置锻造宠
|
||||
PetEquipWear: async (petId:number,equipId:number) => RData(await app.api.post(`/game/equip/wear/${petId}/${equipId}`),true) as PetEquip, //穿戴装备
|
||||
PetEquipForgingUp: async () => RData(await app.api.post(`/game/equip/forging/up`),true) as EquipForgingBench, //升级锻造台
|
||||
PetEquipUseSpeed: async (resType:number) => RData(await app.api.post(`/game/equip/use/speed/${resType}`),true) as EquipForgingBench, //加速锻造台升级
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { app } from "../App";
|
||||
import TimeUtil from "../../../extensions/ngame/assets/ngame/util/TimeUtil";
|
||||
import { TD, app } from "../App";
|
||||
import { API, EquipForgingBench, PetEquip } from "../consts/API";
|
||||
import { GUI } from "../ui/UIConfig";
|
||||
import BaseData from "./BaseData";
|
||||
@@ -19,6 +20,14 @@ export default class PetEquipData extends BaseData{
|
||||
//锻造台
|
||||
info:EquipForgingBench;
|
||||
|
||||
//锻造升级结束时间
|
||||
forgingBenchUpEnd:number;
|
||||
//获取升级剩余时间
|
||||
get forgingUpTimeExcess(){
|
||||
if(!this.forgingBenchUpEnd) return 0;
|
||||
return TimeUtil.remainder(this.forgingBenchUpEnd)
|
||||
}
|
||||
|
||||
//锻造台是否有宠物
|
||||
get isForgingBenchPet(){
|
||||
return !!PlayerPetData.getIns().petIdQueryPetInfo(this.info.forgingPetId);
|
||||
@@ -26,18 +35,23 @@ export default class PetEquipData extends BaseData{
|
||||
|
||||
async onInit() {
|
||||
this.equips = await API.PetEquipAll();
|
||||
this.info = await API.PetEquipForgingInfo();
|
||||
this.onUpdateInfo(await API.PetEquipForgingInfo())
|
||||
}
|
||||
|
||||
//更新锻造数据
|
||||
onUpdateInfo(info:EquipForgingBench){
|
||||
if(!info) return;
|
||||
this.info = info;
|
||||
this.forgingBenchUpEnd = Date.now() + this.info.forgingUpTimeExcess;
|
||||
console.log("this.forgingBenchUpEnd",this.forgingBenchUpEnd);
|
||||
app.event.emit(PetEquipDataEnum.UPDATE_FORGING_INFO);
|
||||
}
|
||||
|
||||
//锻造
|
||||
async forging(){
|
||||
return this.addEquip(await API.PetEquipForging());
|
||||
let info = await API.PetEquipForging();
|
||||
this.onUpdateInfo(info.info);
|
||||
return this.addEquip(info.equip);
|
||||
}
|
||||
|
||||
//添加装备
|
||||
@@ -79,5 +93,22 @@ export default class PetEquipData extends BaseData{
|
||||
return this.equips.filter(equip => (equip.equipPetId == petId && equip.equipPosition == position))[0];
|
||||
}
|
||||
|
||||
//升级锻造台
|
||||
async upForgingBench(){
|
||||
this.onUpdateInfo(await API.PetEquipForgingUp());
|
||||
}
|
||||
|
||||
//加速升级锻造台
|
||||
async useSpeedUpForgingBench(resType: number){
|
||||
this.onUpdateInfo(await API.PetEquipUseSpeed(resType));
|
||||
}
|
||||
|
||||
//获取指定宠物等级
|
||||
getForgingBenchPetLevel(petId:number = this.info.forgingPetId){
|
||||
let exp = this.info.forgingPetLevels[`${petId}`] || 0;
|
||||
let list = TD.TbGRoleEquipLevel.getDataList().filter(info => info.exp <= exp);
|
||||
return list[list.length - 1].id;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -8,7 +8,9 @@ export enum ResourceEvent{
|
||||
|
||||
//资源类型
|
||||
export enum ResourceType{
|
||||
Gold = 90001, //金币
|
||||
Gold = 90001, //金币
|
||||
ForgedStones = 90002, //锻造石
|
||||
SpeedUp = 90003, //加速卷
|
||||
}
|
||||
|
||||
//资源刷新类型
|
||||
|
@@ -6,6 +6,7 @@ import { v3 } from 'cc';
|
||||
import { PlayerPetOV } from '../../../consts/API';
|
||||
import { Label } from 'cc';
|
||||
import { PlayerPetEvent } from '../../../data/PlayerPetData';
|
||||
import PetEquipData from '../../../data/PetEquipData';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('PetIcon')
|
||||
@@ -17,6 +18,10 @@ export class PetIcon extends Component {
|
||||
@property(Node)
|
||||
starNode:Node; //星星
|
||||
|
||||
@property(Label)
|
||||
levelLabel:Label; //等级
|
||||
|
||||
|
||||
info:PlayerPetOV;
|
||||
|
||||
onLoad(){
|
||||
@@ -53,6 +58,9 @@ export class PetIcon extends Component {
|
||||
this.starNode.active = true;
|
||||
this.starNode.getComponentInChildren(Label).string = `${this.info.petStar}`;
|
||||
}
|
||||
|
||||
//设置宠物等级
|
||||
this.levelLabel.string = `Lv ${PetEquipData.getIns().getForgingBenchPetLevel(this.info.petId)}`
|
||||
|
||||
}
|
||||
|
||||
|
@@ -3,6 +3,7 @@ import { PetEquip } from '../../../../consts/API';
|
||||
import { Sprite } from 'cc';
|
||||
import TbResource, { IconTypeEnum } from '../../../../tools/TbResource';
|
||||
import { TD } from '../../../../App';
|
||||
import { Label } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('PetEquipIcon')
|
||||
@@ -15,6 +16,9 @@ export class PetEquipIcon extends Component {
|
||||
@property(Node)
|
||||
notEquip:Node;
|
||||
|
||||
@property(Label)
|
||||
levelLabel:Label; //等级
|
||||
|
||||
info:PetEquip;
|
||||
|
||||
onLoad(){
|
||||
@@ -24,6 +28,7 @@ export class PetEquipIcon extends Component {
|
||||
//刷新页面
|
||||
onUpdateView(){
|
||||
|
||||
this.levelLabel.node.active = false;
|
||||
this.notEquip.active = true;
|
||||
if(!this.info) return;
|
||||
|
||||
@@ -32,6 +37,9 @@ export class PetEquipIcon extends Component {
|
||||
let config = TD.TbGRoleEquip.get(this.info.equipCfgId);
|
||||
TbResource.loadSpriteIcon(IconTypeEnum.宠物装备,config.icon,this.sprite,this);
|
||||
TbResource.loadSpriteIcon(IconTypeEnum.品质,config.quality,this.quality,this);
|
||||
|
||||
this.levelLabel.node.active = true;
|
||||
this.levelLabel.string = `Lv ${this.info.equipLevel}`;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -6,12 +6,21 @@ import { API, PlayerPetOV } from '../../../consts/API';
|
||||
import { PetIconSelectShow } from '../../Consts/Pet/PetIconSelectShow';
|
||||
import PlayerPetData from '../../../data/PlayerPetData';
|
||||
import { PetEquipIcon } from '../../Consts/PetEquip/icon/PetEquipIcon';
|
||||
import { Label } from 'cc';
|
||||
import TimeUtil from '../../../../../extensions/ngame/assets/ngame/util/TimeUtil';
|
||||
import { ResourceType } from '../../../data/ResourceData';
|
||||
import JComponent from '../../../../../extensions/ngame/assets/ngame/util/components/JComponent';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
//锻造台
|
||||
@ccclass('MainForgingBench')
|
||||
export class MainForgingBench extends Component {
|
||||
export class MainForgingBench extends JComponent {
|
||||
|
||||
|
||||
//锻造等级显示
|
||||
@property(Label)
|
||||
forgingLevel:Label;
|
||||
|
||||
//锻造宠
|
||||
@property(PetIconSelectShow)
|
||||
@@ -37,6 +46,14 @@ export class MainForgingBench extends Component {
|
||||
app.event.off(PetEquipDataEnum.UPDATE_EQUIP,this.onUpdateEquip,this);
|
||||
}
|
||||
|
||||
updates(){
|
||||
if(PetEquipData.getIns().forgingUpTimeExcess){
|
||||
this.forgingLevel.string = `(锻造等级: ${PetEquipData.getIns().info.currentForgingQuality} ) ${TimeUtil.remainderString(PetEquipData.getIns().forgingBenchUpEnd)}`;
|
||||
}else{
|
||||
this.forgingLevel.string = `(锻造等级: ${PetEquipData.getIns().info.currentForgingQuality} )`;
|
||||
}
|
||||
}
|
||||
|
||||
onUpdateView(){
|
||||
this.onUpdateForging();
|
||||
this.onUpdateEquip();
|
||||
@@ -77,6 +94,14 @@ export class MainForgingBench extends Component {
|
||||
|
||||
}
|
||||
|
||||
//点击升级锻造台
|
||||
async onClickUpForgingBench(){
|
||||
if(PetEquipData.getIns().forgingUpTimeExcess)
|
||||
await PetEquipData.getIns().useSpeedUpForgingBench(ResourceType.SpeedUp);
|
||||
else
|
||||
await PetEquipData.getIns().upForgingBench();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -3,23 +3,18 @@ import JNScrollViewItem from '../../../../../extensions/ngame/assets/ngame/util/
|
||||
import { GOnHookPet } from '../../../../../extensions/ngame/assets/ngame/message/proto';
|
||||
import { PetIcon } from '../../Consts/Pet/PetIcon';
|
||||
import { PetIconSelect } from '../../Consts/Pet/PetIconSelect';
|
||||
import { TablePetIconSelect } from '../../Consts/Pet/table/TablePetIconSelect';
|
||||
import { TD } from '../../../App';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MainSreepsIcon')
|
||||
export class MainSreepsIcon extends JNScrollViewItem<GOnHookPet> {
|
||||
|
||||
@property(PetIconSelect)
|
||||
icon:PetIconSelect;
|
||||
@property(TablePetIconSelect)
|
||||
icon:TablePetIconSelect;
|
||||
|
||||
start(){
|
||||
this.icon.set({
|
||||
petTbId: this.data.petTbId,
|
||||
petId: 0,
|
||||
petPlayerId: 0,
|
||||
petLevel: 0,
|
||||
petStar: 0,
|
||||
petStarExp: 0
|
||||
});
|
||||
this.icon.set(TD.TbGRole.get(this.data.petTbId));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ import { TB } from '../../config/data/schema';
|
||||
import { app, TD } from '../../App';
|
||||
import { TablePetEquipIcon } from '../Consts/PetEquip/table/TablePetEquipIcon';
|
||||
import PetEquipData from '../../data/PetEquipData';
|
||||
import { PetEquipIcon } from '../Consts/PetEquip/icon/PetEquipIcon';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//弹出锻造装备页面
|
||||
@@ -16,8 +17,8 @@ const { ccclass, property } = _decorator;
|
||||
export class PetEquipForgingPopupView extends JNLayerBase {
|
||||
|
||||
//装备展示
|
||||
@property(TablePetEquipIcon)
|
||||
icon:TablePetEquipIcon;
|
||||
@property(PetEquipIcon)
|
||||
icon:PetEquipIcon;
|
||||
|
||||
info:PetEquip;
|
||||
|
||||
@@ -31,8 +32,7 @@ export class PetEquipForgingPopupView extends JNLayerBase {
|
||||
}
|
||||
|
||||
onUpdateView(){
|
||||
let config = TD.TbGRoleEquip.get(this.info.equipCfgId);
|
||||
this.icon.set(config);
|
||||
this.icon.set(this.info);
|
||||
}
|
||||
|
||||
//点击穿戴装备
|
||||
|
Reference in New Issue
Block a user