This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2024-01-09 04:33:21 +08:00
parent e8a1cb9362
commit a153d98cf1
29 changed files with 1337 additions and 2726 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.119:8080`
let WsPath = `ws://192.168.0.119: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

@@ -38,13 +38,14 @@ export default class PVPAction extends BaseAction {
//PVP开始等待
onModePVPStartWait(){
console.log("onModePVPStartWait");
//PVP 匹配页面
if(GBattleModeManager.getIns().current != BattleMode.PVP)
app.layer.Open(GUI.PVPModeMatchView);
app.layer.Open(GUI.PVPModeMatchView);
}
//PVP结束等待
onModePVPEndWait(){
console.log("onModePVPEndWait");
//PVP 匹配页面
app.layer.Close(GUI.PVPModeMatchView);
}

View File

@@ -40,8 +40,6 @@ export default class GAttackParabolicBangRemote implements GAttackBase{
return;
}
console.log(role.spine,bone);
let bullet = GAttackBullet.create(GButtleDefault,{
image:image,
scale:scale,

View File

@@ -157,7 +157,7 @@ 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, //锻造台
PetEquipForgingPetId: async (petId) => RData(await app.api.get(`/game/equip/forging/petId/${petId}`),true) as EquipForgingBench, //设置锻造宠
PetEquipForgingPetId: async (petId) => RData(await app.api.post(`/game/equip/forging/petId/${petId}`),true) as EquipForgingBench, //设置锻造宠
}

View File

@@ -1,7 +1,13 @@
import { app } from "../App";
import { API, EquipForgingBench, PetEquip } from "../consts/API";
import BaseData from "./BaseData";
import PlayerPetData from "./PlayerPetData";
export enum PetEquipDataEnum{
//更新锻造数据
UPDATE_FORGING_INFO = "PetEquipDataEnum_UPDATE_FORGING_INFO"
}
//宠物装备数据类
export default class PetEquipData extends BaseData{
@@ -20,14 +26,21 @@ export default class PetEquipData extends BaseData{
this.info = await API.PetEquipForgingInfo();
}
//更新锻造数据
onUpdateInfo(info:EquipForgingBench){
this.info = info;
app.event.emit(PetEquipDataEnum.UPDATE_FORGING_INFO);
}
//锻造
async forging(){
await API.PetEquipForging();
return await API.PetEquipForging();
}
//设置锻造宠
async setForgingPetId(petId:number){
await API.PetEquipForgingPetId(petId);
this.onUpdateInfo(await API.PetEquipForgingPetId(petId));
}
}

View File

@@ -0,0 +1,34 @@
import { _decorator, Component, Node } from 'cc';
import { PetIcon } from './PetIcon';
import { PlayerPetOV } from '../../../consts/API';
const { ccclass, property } = _decorator;
@ccclass('PetIconSelectShow')
export class PetIconSelectShow extends Component {
//没有宠物的节点
@property(Node)
noPet:Node;
//有宠物的节点
@property(Node)
havePet:Node;
//宠物节点
@property(PetIcon)
petIcon:PetIcon;
set(info:PlayerPetOV){
if(info){
this.noPet.active = false;
this.havePet.active = true;
this.petIcon.set(info);
}else{
this.noPet.active = true;
this.havePet.active = false;
}
}
}

View File

@@ -2,7 +2,7 @@
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "9979d56d-f754-44c3-8e29-c764eaeb0aaf",
"uuid": "ad2c1e10-e6e6-43a0-9953-82caa7a764f2",
"files": [],
"subMetas": {},
"userData": {}

View File

@@ -1,7 +1,10 @@
import { _decorator, Component, Node } from 'cc';
import PetEquipData from '../../../data/PetEquipData';
import PetEquipData, { PetEquipDataEnum } from '../../../data/PetEquipData';
import { app } from '../../../App';
import { GUI } from '../../UIConfig';
import { API, PlayerPetOV } from '../../../consts/API';
import { PetIconSelectShow } from '../../Consts/Pet/PetIconSelectShow';
import PlayerPetData from '../../../data/PlayerPetData';
const { ccclass, property } = _decorator;
@@ -9,19 +12,52 @@ const { ccclass, property } = _decorator;
@ccclass('MainForgingBench')
export class MainForgingBench extends Component {
//锻造宠
@property(PetIconSelectShow)
petView:PetIconSelectShow;
onLoad(){
this.onUpdateView();
//监听锻造数据
app.event.on(PetEquipDataEnum.UPDATE_FORGING_INFO,this.onUpdateForging,this);
}
protected onDestroy(): void {
app.event.off(PetEquipDataEnum.UPDATE_FORGING_INFO,this.onUpdateForging,this);
}
onUpdateView(){
this.onUpdateForging();
}
//刷新锻造数据
onUpdateForging(){
this.petView.set(PlayerPetData.getIns().petIdQueryPetInfo(PetEquipData.getIns().info.forgingPetId));
}
//点击锻造
async onClickForging(){
if(!PetEquipData.getIns().isForgingBenchPet){
app.layer.Open(GUI.Tips,{text:"请选择锻造宠"});
return;
}
PetEquipData.getIns().forging();
app.layer.Open(GUI.PetEquipForgingPopupView);
let equip = await PetEquipData.getIns().forging();
equip && app.layer.Open(GUI.PetEquipForgingPopupView,equip);
}
//点击锻造宠
async onClickForgingPet(){
app.layer.Open(GUI.PetRadioView);
let info:PlayerPetOV = await (new Promise(resolve => {
app.layer.Open(GUI.PetRadioView,{resolve});
}))
if(!info) return;
//设置锻造宠
await PetEquipData.getIns().setForgingPetId(info.petId);
}
}

View File

@@ -9,8 +9,8 @@ const { ccclass, property } = _decorator;
/**
*
*/
@ccclass('PVPMatchView')
export class PVPMatchView extends JNGLayerBase {
@ccclass('PVPModeMatchView')
export class PVPModeMatchView extends JNGLayerBase {
@property(Node)
content:Node;
@@ -24,7 +24,6 @@ export class PVPMatchView extends JNGLayerBase {
.to(.5,{scale:v3(1,1,1)})
)
.start();
}
//取消匹配

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "d8c6cf01-1e6a-4c43-b9d7-d52e20a8ec16",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,11 +1,89 @@
import { _decorator, Component, Node } from 'cc';
import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
import JNScrollView from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
import { PetOV, PlayerPetOVSelect } from '../VO/PetOV';
import PlayerPetData from '../../data/PlayerPetData';
import { NodeEventType } from 'cc';
import { PetIconSelectScroll } from '../Consts/Pet/PetIconSelectScroll';
import { PlayerPetOV } from '../../consts/API';
import { app } from '../../App';
import { GUI } from '../UIConfig';
const { ccclass, property } = _decorator;
export interface PetRadioViewArgs{
isHaveSelect:boolean, //是否必须选择
resolve?:(value:PlayerPetOV) => {},
}
//宠物单选页面
@ccclass('PetRadioView')
export class PetRadioView extends JNLayerBase {
data:PetRadioViewArgs;
@property(JNScrollView)
views:JNScrollView; //宠物列表
index:number = -1;
onJNLoad(data?: PetRadioViewArgs): void {
data = data || {isHaveSelect:false};
this.isClickMaskeClose = !data.isHaveSelect;
this.data = data;
super.onJNLoad();
this.onUpdateView();
}
onUpdateView(){
//当前需要升星的宠物并且未上阵 并且排除自己
let pets = PetOV.PlayerPetOVSelects( PlayerPetData.getIns().getData() );
this.views.refreshData(pets);
//向子节点添加点击事件
this.views.addItemEvent(NodeEventType.TOUCH_START,this.onClickItem.bind(this));
}
//刷新选择
onUpdateSelect(){
//刷新
this.views.getItems<PetIconSelectScroll>().forEach((item) => {
let data = item.data as PlayerPetOVSelect;
item.select.isSelect = data.isSelect;
})
}
//点击Item
onClickItem(index:number){
this.index = index;
let pets = this.views.getData<PlayerPetOVSelect>();
pets.forEach(item => item.isSelect = false);
pets[index].isSelect = !pets[index].isSelect;
this.onUpdateSelect();
}
//选择宠物
onClickSelect(){
let pets = this.views.getData<PlayerPetOVSelect>();
if(!(pets[this.index])){
this.data.resolve && this.data.resolve(null)
if(this.data.isHaveSelect) {
app.layer.Open(GUI.Tips,{text:"请选择宠物"});
return;
}
}else{
this.data.resolve && this.data.resolve(pets[this.index]);
}
app.layer.CloseNode(this.node);
}
}

View File

@@ -1,10 +1,27 @@
import { _decorator, Component, Node } from 'cc';
import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
import { Sprite } from 'cc';
import { PetEquip } from '../../consts/API';
import { resources } from 'cc';
import { SpriteFrame } from 'cc';
const { ccclass, property } = _decorator;
//锻造宠物装备页面
//弹出锻造装备页面
@ccclass('PetEquipForgingPopupView')
export class PetEquipForgingPopupView extends JNLayerBase {
//装备展示
@property(Sprite)
icon:Sprite;
onJNLoad(info:PetEquip){
resources.load(`icon/宠物装备/${info.equipCfgId}`,SpriteFrame,(error,data) => {
this.icon.spriteFrame = data;
})
}
}