提交锻造系统

This commit is contained in:
PC-20230316NUNE\Administrator
2024-01-08 18:55:00 +08:00
parent e737a09828
commit e8a1cb9362
39 changed files with 9319 additions and 2035 deletions

View File

@@ -28,12 +28,12 @@ import AppAction from "./AppAction";
import { Asset } from "cc";
import { Component } from "cc";
let APIPath = `http://localhost:8080`
let WsPath = `ws://localhost:8080/websocket`
// 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.121:8080`
// let WsPath = `ws://192.168.0.121: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`

View File

@@ -3,6 +3,7 @@ import { app } from "./App";
import BaseData from "./data/BaseData";
import ChatData from "./data/ChatData";
import GOnHookData from "./data/GOnHookData";
import PetEquipData from "./data/PetEquipData";
import PlayerData from "./data/PlayerData";
import PlayerPetData from "./data/PlayerPetData";
import PlayerTacticalData from "./data/PlayerTacticalData";
@@ -20,6 +21,7 @@ export class AppData extends SystemBase{
PlayerTacticalData.getIns(), //阵法
ResourceData.getIns(), //玩家资源
GOnHookData.getIns(), //无限模式信息类 (无限模式是游戏基础模式玩法 需要默认信息)
PetEquipData.getIns(), //宠物装备数据类
];
async onInit(): Promise<any> {

View File

@@ -710,8 +710,8 @@ export class TbGRoleEquip {
this.id = _json_.id
if (_json_.name === undefined) { throw new Error() }
this.name = _json_.name
if (_json_.type === undefined) { throw new Error() }
this.type = _json_.type
if (_json_.position === undefined) { throw new Error() }
this.position = _json_.position
if (_json_.quality === undefined) { throw new Error() }
this.quality = _json_.quality
if (_json_.icon === undefined) { throw new Error() }
@@ -739,7 +739,7 @@ export class TbGRoleEquip {
/**
* 装备类别(1=武器/2=帽子/3=项链/4=护肩/5=衣服/6=腰带/7=手套/8=戒指/9=裤子/10=鞋子)
*/
readonly type: number
readonly position: number
/**
* 品质信息
*/
@@ -867,6 +867,33 @@ export class TbGRoleEquipQuality {
}
export namespace TB {
export class TbGRoleEquipType {
constructor(_json_: any) {
if (_json_.id === undefined) { throw new Error() }
this.id = _json_.id
if (_json_.name === undefined) { throw new Error() }
this.name = _json_.name
}
/**
* 类型Id
*/
readonly id: number
/**
* 名称
*/
readonly name: string
resolve(tables:Tables)
{
}
}
}
export namespace TB {
export class TbGSysFuben {
@@ -1504,6 +1531,38 @@ export class TbGRoleEquipQuality{
export class TbGRoleEquipType{
private _dataMap: Map<number, TB.TbGRoleEquipType>
private _dataList: TB.TbGRoleEquipType[]
constructor(_json_: any) {
this._dataMap = new Map<number, TB.TbGRoleEquipType>()
this._dataList = []
for(var _json2_ of _json_) {
let _v: TB.TbGRoleEquipType
_v = new TB.TbGRoleEquipType(_json2_)
this._dataList.push(_v)
this._dataMap.set(_v.id, _v)
}
}
getDataMap(): Map<number, TB.TbGRoleEquipType> { return this._dataMap; }
getDataList(): TB.TbGRoleEquipType[] { return this._dataList; }
get(key: number): TB.TbGRoleEquipType | undefined { return this._dataMap.get(key); }
resolve(tables:Tables)
{
for(let data of this._dataList)
{
data.resolve(tables)
}
}
}
export class TbGSysFuben{
private _dataMap: Map<number, TB.TbGSysFuben>
private _dataList: TB.TbGSysFuben[]
@@ -1577,6 +1636,8 @@ export class Tables {
get TbGRoleEquipLevel(): TbGRoleEquipLevel { return this._TbGRoleEquipLevel;}
private _TbGRoleEquipQuality: TbGRoleEquipQuality
get TbGRoleEquipQuality(): TbGRoleEquipQuality { return this._TbGRoleEquipQuality;}
private _TbGRoleEquipType: TbGRoleEquipType
get TbGRoleEquipType(): TbGRoleEquipType { return this._TbGRoleEquipType;}
private _TbGSysFuben: TbGSysFuben
get TbGSysFuben(): TbGSysFuben { return this._TbGSysFuben;}
@@ -1600,6 +1661,7 @@ export class Tables {
this._TbGRoleEquip = new TbGRoleEquip(loader('tbgroleequip'))
this._TbGRoleEquipLevel = new TbGRoleEquipLevel(loader('tbgroleequiplevel'))
this._TbGRoleEquipQuality = new TbGRoleEquipQuality(loader('tbgroleequipquality'))
this._TbGRoleEquipType = new TbGRoleEquipType(loader('tbgroleequiptype'))
this._TbGSysFuben = new TbGSysFuben(loader('tbgsysfuben'))
this._TbGGlobal.resolve(this)
@@ -1621,6 +1683,7 @@ export class Tables {
this._TbGRoleEquip.resolve(this)
this._TbGRoleEquipLevel.resolve(this)
this._TbGRoleEquipQuality.resolve(this)
this._TbGRoleEquipType.resolve(this)
this._TbGSysFuben.resolve(this)
}
}

View File

@@ -2,6 +2,7 @@ import { app } from "../App";
import PlayerPetData from "../data/PlayerPetData";
import ResourceData from "../data/ResourceData";
import { GUI } from "../ui/UIConfig";
import { GAttribute } from "./entity/EntityData";
//接受到JSON消息
export const RData = (data:any,isTips:boolean = false) => {
@@ -101,6 +102,29 @@ export interface ModeOnHookRankingOV{
mapId:number; //地图Id
}
//宠物装备
export interface PetEquip{
equipId:number; //装备唯一Id
equipCfgId:number; //装备配置表Id
equipPlayerId:number; //装备的所属玩家Id
equipLevel:number; //装备等级
equipWear:number; //当前装备穿戴的宠物Id
equipPosition:number; //装备部位
equipBaseAttributes:GAttribute[]; //基础属性
equipHighAttributes:GAttribute[]; //高级属性
}
//宠物锻造台
export interface EquipForgingBench{
forgingId:number; //锻造台Id
playerId:number; //锻造台所属的玩家Id
forgingExp:number; //锻造等级经验
forgingQuality:number; //锻造品质等级
forgingPetId:number; //当前占用宠物Id
}
export const API = {
UserRegister : async () => RData(await app.api.post(`/user/register`)) as UserVO, //玩家注册
@@ -129,5 +153,11 @@ export const API = {
/********** 排行榜接口(无限模式) *******************/
GOnHookRankings: async (mapId:number) => RData(await app.api.get(`/game/mode/onHook/onRankings/${mapId}`),false) as ModeOnHookRankingOV[], //获取玩家资源
/********** 宠物装备系统接口 ****************/
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, //锻造台
PetEquipForgingPetId: async (petId) => RData(await app.api.get(`/game/equip/forging/petId/${petId}`),true) as EquipForgingBench, //设置锻造宠
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "2476b527-7c23-4d00-b752-94a0595f3585",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,9 @@
//属性类
export interface GAttribute{
id:number;
value:number;
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "a861d195-9b8d-424e-8122-b1ccb06b516c",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,33 @@
import { API, EquipForgingBench, PetEquip } from "../consts/API";
import BaseData from "./BaseData";
import PlayerPetData from "./PlayerPetData";
//宠物装备数据类
export default class PetEquipData extends BaseData{
//装备
equips:PetEquip[];
//锻造台
info:EquipForgingBench;
//锻造台是否有宠物
get isForgingBenchPet(){
return !!PlayerPetData.getIns().petIdQueryPetInfo(this.info.forgingPetId);
}
async onInit() {
this.equips = await API.PetEquipAll();
this.info = await API.PetEquipForgingInfo();
}
//锻造
async forging(){
await API.PetEquipForging();
}
//设置锻造宠
async setForgingPetId(petId:number){
await API.PetEquipForgingPetId(petId);
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "ea657593-8f6d-4713-addc-2d01393bf466",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,6 +1,7 @@
import { app } from "../App";
import { API, PlayerTacticalOV } from "../consts/API";
import BaseData from "./BaseData";
import PlayerPetData from "./PlayerPetData";
export enum PlayerTacticalEvent{
//更新上阵信息
@@ -31,7 +32,7 @@ export default class PlayerTacticalData extends BaseData{
}
this.info = {
...ov,
roles: JSON.parse(ov.tacticalData),
roles: JSON.parse(ov.tacticalData).map(id => PlayerPetData.getIns().petIdQueryPetInfo(id) ? id : 0),
}
//通知阵法信息已更新
@@ -56,6 +57,7 @@ export default class PlayerTacticalData extends BaseData{
//修改指定位置的上阵 上阵下标,上阵的宠物Id
async UpdateIndexTactical(index:number,petId:number){
this.info.roles = this.info.roles.map(id => petId == id ? 0 : id);
this.info.roles[index] = petId;
await this.UpdateTactical(this.info.roles);
}
@@ -65,6 +67,11 @@ export default class PlayerTacticalData extends BaseData{
return this.info.roles[index];
}
//获取宠物的阵法下标
getItemIndex(roleId:number){
return this.info.roles.indexOf(roleId);
}
//获取初始化上阵信息
getInitTacticalInfo():number[]{
return [0,0,0,0,0,0,0,0,0]

View File

@@ -9,6 +9,7 @@ import { API, PlayerPetOV } from "../../../consts/API";
import { GAPI } from "../../../consts/GAPI";
import GOnHookData from "../../../data/GOnHookData";
import PlayerPetData from "../../../data/PlayerPetData";
import PlayerTacticalData from "../../../data/PlayerTacticalData";
import { GUI } from "../../../ui/UIConfig";
export enum GOnHookManagerEvent{
@@ -96,9 +97,9 @@ export default class GOnHookManager extends Singleton{
//自动吞噬
for (const item of this.onHookEngulfPets) {
//获取可吞噬的宠物
//获取可吞噬的宠物 ( 等级0, 同类宠物, 不是自己, 不在阵法中)
let engulfs = PlayerPetData.getIns().getData()
.filter(value => (value.petStar || 0) == 0 && item.petTbId == value.petTbId && item.petId != value.petId)
.filter(value => (value.petStar || 0) == 0 && item.petTbId == value.petTbId && item.petId != value.petId && PlayerTacticalData.getIns().getItemIndex(value.petId) != -1)
.map(value => value.petId);
//吞噬

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "30ce933c-5000-49b3-a16a-3595e42bacbb",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,29 @@
import { _decorator, Component, Node } from 'cc';
import PetEquipData from '../../../data/PetEquipData';
import { app } from '../../../App';
import { GUI } from '../../UIConfig';
const { ccclass, property } = _decorator;
//锻造台
@ccclass('MainForgingBench')
export class MainForgingBench extends Component {
//点击锻造
async onClickForging(){
if(!PetEquipData.getIns().isForgingBenchPet){
app.layer.Open(GUI.Tips,{text:"请选择锻造宠"});
return;
}
PetEquipData.getIns().forging();
app.layer.Open(GUI.PetEquipForgingPopupView);
}
//点击锻造宠
async onClickForgingPet(){
app.layer.Open(GUI.PetRadioView);
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "9b2f1109-b0bc-4cfc-978e-768af2a09b25",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,11 @@
import { _decorator, Component, Node } from 'cc';
import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
const { ccclass, property } = _decorator;
//宠物单选页面
@ccclass('PetRadioView')
export class PetRadioView extends JNLayerBase {
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "54ddf509-ad07-4caa-8931-ce6abfd7bbc5",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "d35cf27a-07da-4228-b168-0b8b1f030c5f",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,10 @@
import { _decorator, Component, Node } from 'cc';
import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
const { ccclass, property } = _decorator;
//锻造宠物装备页面
@ccclass('PetEquipForgingPopupView')
export class PetEquipForgingPopupView extends JNLayerBase {
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "19e44699-645c-4b07-aff3-552dc7a12ba8",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -15,6 +15,10 @@ import { PetPreviewWindow } from '../Consts/Pet/info/PetPreviewWindow';
import { Label } from 'cc';
const { ccclass, property } = _decorator;
export enum IntoBattleState{
= "请选择", = "下阵", = "替阵", = "上阵"
}
//上阵页面
@ccclass('IntoBattleView')
export class IntoBattleView extends JNLayerBase {
@@ -100,9 +104,35 @@ export class IntoBattleView extends JNLayerBase {
//刷新上阵
onUpdateTactical(){
//获取当前阵法下标是否存在宠物
let petId = PlayerTacticalData.getIns().getItem(this.tIndex);
this.tacticalLabel.string = `${petId ? "下阵" : "上阵"}`
//选择的宠物
this.tacticalLabel.string = `${this.getIntoBattleState()}`;
}
//获取当前状态
getIntoBattleState():IntoBattleState{
//选择的宠物
let selectPet = this.pets[this.index];
if(this.index == -1 || !selectPet) {
return IntoBattleState.
}
//判断选中的宠物是否存在阵法里 存在则下阵
let selectIndex = PlayerTacticalData.getIns().getItemIndex(selectPet.petId);
if(selectIndex >= 0){
//存在 如果存在的下标是当前下标则下阵 不是 则替换
if(selectIndex == this.tIndex)
return IntoBattleState.
else return IntoBattleState.;
}else{
//不存在则上阵
return IntoBattleState.;
}
}
//点击Item
@@ -118,26 +148,21 @@ export class IntoBattleView extends JNLayerBase {
//点击上阵
async onClickTactical(){
if(this.index < 0){
let state = this.getIntoBattleState();
if(state == IntoBattleState.){
app.layer.Open(GUI.Tips,{text:"请选择要上阵的宠物."})
return;
}
//获取当前阵法下标是否存在宠物
let petId = PlayerTacticalData.getIns().getItem(this.tIndex);
if(petId) {
//下阵
}else if(state == IntoBattleState. || state == IntoBattleState.){
//修改上阵信息
await PlayerTacticalData.getIns().UpdateIndexTactical(this.tIndex,this.pets[this.index].petId);
app.layer.Open(GUI.Tips,{text:"上阵成功"});
}else if(state == IntoBattleState.){
//修改上阵信息
await PlayerTacticalData.getIns().UpdateIndexTactical(this.tIndex,0);
app.layer.Open(GUI.Tips,{text:"下阵成功"});
//上阵完 关闭页面
app.layer.CloseNode(this.node);
return;
}
//修改上阵信息
await PlayerTacticalData.getIns().UpdateIndexTactical(this.tIndex,this.pets[this.index].petId);
app.layer.Open(GUI.Tips,{text:"上阵成功"});
//上阵完 关闭页面
app.layer.CloseNode(this.node);

View File

@@ -21,10 +21,16 @@ export enum GUI{
/** 主页页面 */
MainChat = "MainChat", //主页聊天页面
IntoBattleView = "IntoBattleView", //上阵页面
PetUpStarView = "PetUpStarView", //宠物升星页面
MainOnHookView = "MainOnHookView", //挂机弹窗
MapSelectView = "MapSelectView", //地图选择页面
/**宠物 */
PetUpStarView = "PetUpStarView", //宠物升星页面
PetRadioView = "PetRadioView", //宠物单选页面
PetEquipForgingPopupView = "PetEquipForgingPopupView", //弹出锻造宠物装备页面
/**游戏模式页面 */
PVPModeMatchView = "PVPModeMatchView", //PVP模式匹配页面
CampGuardianView = "CampGuardianView", //阵营守护战斗页面
@@ -106,6 +112,16 @@ const UIPetConfig:{ [key: string]: JNLayerInfo; } = {
uri: "prefab/ui/宠物/宠物升星页面",
anims:BackOutScale,
},
[GUI.PetRadioView]:{
layer:GLayer.Popup,
uri: "prefab/ui/宠物/宠物单选页面",
anims:BackOutScale,
},
[GUI.PetEquipForgingPopupView]:{
layer:GLayer.Popup,
uri: "prefab/ui/宠物装备/弹出锻造装备页面",
anims:BackOutScale,
},
}