mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交
This commit is contained in:
@@ -14,7 +14,7 @@ import { JsonLoad, JsonUtil } from "../../extensions/ngame/assets/ngame/util/Jso
|
||||
import NGameMessage from "../../extensions/ngame/assets/ngame/util/NGameMessage";
|
||||
import GBattleModeManager from "./battle/GBattleModeManager";
|
||||
import { GLayer, GUI, UIConfig } from "./ui/UIConfig";
|
||||
import JLoaderSystem from "../../extensions/ngame/assets/ngame/system/JLoaderSystem";
|
||||
import JLoaderBundle from "../../extensions/ngame/assets/ngame/system/JLoaderBundle";
|
||||
import { sp } from "cc";
|
||||
import { SpriteFrame } from "cc";
|
||||
import Loading from "../../extensions/ngame/assets/ngame/util/Loading";
|
||||
@@ -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`
|
||||
|
||||
@@ -141,7 +141,7 @@ export class JNGConfig extends SystemBase{
|
||||
}
|
||||
|
||||
//资源初始器
|
||||
export class JLoaderBattle extends JLoaderSystem{
|
||||
export class JLoaderBattle extends JLoaderBundle{
|
||||
|
||||
static loading = "JLoaderBattle";
|
||||
static loadingInit = "JLoaderBattle_Init";
|
||||
@@ -272,7 +272,8 @@ export const app = {
|
||||
battle : GBattleModeManager.getIns(), //战斗
|
||||
config : new JNGConfig(), //配置文件
|
||||
battleRes : new JLoaderBattle("battle"), //battle包
|
||||
tbRes : new JLoaderSystem("tbresource"), //tbresource包
|
||||
tbRes : new JLoaderBundle("tbresource"), //tbresource包
|
||||
res : new JLoaderBundle("resources"), //resources包
|
||||
data : new AppData(), //游戏基础信息
|
||||
action : new AppAction(), //游戏行为
|
||||
loading : new Loading({
|
||||
|
@@ -127,6 +127,9 @@ export interface EquipForgingBench{
|
||||
|
||||
export const API = {
|
||||
|
||||
/********** debugger *****************/
|
||||
DebuggerAddResource : async (type:number,value:number) => RData(await app.api.post(`/debugger/add/resource/${type}/${value}`),true) as Boolean, //Debuger 添加指定资源
|
||||
|
||||
UserRegister : async () => RData(await app.api.post(`/user/register`)) as UserVO, //玩家注册
|
||||
UserLogin : async (account:string,password:string) => RData(await app.api.post(`/user/login`,{userId:account,userPass:password})) as UserLoginVO, //玩家登录
|
||||
GetPlayerInfo : async () => RData(await app.api.get(`/game/player/info`),false) as PlayerInfoOV, //获取玩家信息
|
||||
|
@@ -34,7 +34,14 @@ export default class PetEquipData extends BaseData{
|
||||
|
||||
//锻造
|
||||
async forging(){
|
||||
return await API.PetEquipForging();
|
||||
return this.addEquip(await API.PetEquipForging());
|
||||
}
|
||||
|
||||
//添加装备
|
||||
addEquip(equip:PetEquip):PetEquip{
|
||||
if(this.equips.filter(item => item.equipId == equip.equipId).length) return null;
|
||||
this.equips.push(equip);
|
||||
return equip;
|
||||
}
|
||||
|
||||
//设置锻造宠
|
||||
|
@@ -1,45 +1,22 @@
|
||||
import { Asset } from "cc";
|
||||
import { app } from "../App";
|
||||
import { Sprite } from "cc";
|
||||
import { SpriteFrame } from "cc";
|
||||
import { Node } from "cc";
|
||||
import { Component } from "cc";
|
||||
|
||||
export enum IconTypeEnum{
|
||||
品质 = "品质",
|
||||
宠物装备 = "宠物装备",
|
||||
}
|
||||
|
||||
export default class TbResource {
|
||||
|
||||
static load<T extends Asset>(res:string,onComplete?:((err: Error | null, data: T) => void)){
|
||||
app.tbRes.get().load<T>(res,onComplete)
|
||||
}
|
||||
|
||||
static loadSpriteFrame(res:string,sprite:Sprite,comp:Component){
|
||||
|
||||
this.load<SpriteFrame>(res,(err,data:SpriteFrame) => {
|
||||
|
||||
if(!data) return;
|
||||
|
||||
if(!sprite.isValid || !comp.isValid) {
|
||||
//提前销毁
|
||||
data.addRef();
|
||||
data.decRef();
|
||||
}
|
||||
|
||||
sprite.spriteFrame = data;
|
||||
//添加引用标记
|
||||
data.addRef();
|
||||
|
||||
//添加销毁资源引用
|
||||
let onDestroy = comp["onDestroy"];
|
||||
|
||||
comp["onDestroy"] = () => {
|
||||
if(onDestroy)
|
||||
onDestroy.bind(comp)();
|
||||
//销毁引用
|
||||
if(sprite.isValid && sprite.spriteFrame == data) sprite.spriteFrame = null;
|
||||
data.decRef();
|
||||
}
|
||||
|
||||
})
|
||||
app.tbRes.loadSpriteFrame(res,sprite,comp)
|
||||
}
|
||||
|
||||
//加载资源ICON
|
||||
static loadSpriteIcon(type:IconTypeEnum,id:string | number,sprite:Sprite,comp:Component){
|
||||
app.tbRes.loadSpriteFrame(`icon/${type}/${id}/spriteFrame`,sprite,comp)
|
||||
}
|
||||
|
||||
}
|
||||
|
9
JisolGameCocos/assets/script/ui/Debugger.meta
Normal file
9
JisolGameCocos/assets/script/ui/Debugger.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "0f91175c-f75a-4be8-8d8c-217af4538fb4",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
47
JisolGameCocos/assets/script/ui/Debugger/Debugger.ts
Normal file
47
JisolGameCocos/assets/script/ui/Debugger/Debugger.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
|
||||
import { Prefab } from 'cc';
|
||||
import { TD } from '../../App';
|
||||
import { instantiate } from 'cc';
|
||||
import { Button } from 'cc';
|
||||
import { EventHandler } from 'cc';
|
||||
import { Input } from 'cc';
|
||||
import { TB, TbGResource } from '../../config/data/schema';
|
||||
import { API } from '../../consts/API';
|
||||
import { Label } from 'cc';
|
||||
import { EditBox } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('Debugger')
|
||||
export class Debugger extends JNLayerBase {
|
||||
|
||||
@property(EditBox)
|
||||
text:EditBox;
|
||||
|
||||
@property(Node)
|
||||
resources:Node;
|
||||
|
||||
@property(Prefab)
|
||||
debuger:Prefab;
|
||||
|
||||
onJNLoad(data?: any): void {
|
||||
super.onJNLoad();
|
||||
this.onUpdateView();
|
||||
}
|
||||
|
||||
onUpdateView(){
|
||||
TD.TbGResource.getDataList().forEach(config => {
|
||||
let debuger:Node;
|
||||
this.resources.addChild(debuger = instantiate(this.debuger));
|
||||
debuger.on(Input.EventType.TOUCH_END,async () => await this.onClickResources(config),this);
|
||||
debuger.getComponentInChildren(Label).string = config.name;
|
||||
})
|
||||
}
|
||||
|
||||
async onClickResources(config:TB.TbGResource){
|
||||
await API.DebuggerAddResource(config.id,parseInt(this.text.string) || 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "73341f32-5e98-4e17-ab66-ecdfba295c25",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -105,6 +105,11 @@ export class MainView extends JNGLayerBase {
|
||||
app.layer.Open(GUI.Tips,{text:"敬请期待"})
|
||||
}
|
||||
|
||||
//打开Debugger
|
||||
onClickDebugger(){
|
||||
app.layer.Open(GUI.Debugger);
|
||||
}
|
||||
|
||||
//点击下一关
|
||||
async onClickNextLevel(){
|
||||
GOnHookManager.getIns().onNextLevel();
|
||||
|
@@ -4,6 +4,9 @@ import { Sprite } from 'cc';
|
||||
import { PetEquip } from '../../consts/API';
|
||||
import { resources } from 'cc';
|
||||
import { SpriteFrame } from 'cc';
|
||||
import TbResource, { IconTypeEnum } from '../../tools/TbResource';
|
||||
import { TB } from '../../config/data/schema';
|
||||
import { TD } from '../../App';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//弹出锻造装备页面
|
||||
@@ -16,9 +19,10 @@ export class PetEquipForgingPopupView extends JNLayerBase {
|
||||
|
||||
onJNLoad(info:PetEquip){
|
||||
|
||||
resources.load(`icon/宠物装备/${info.equipCfgId}`,SpriteFrame,(error,data) => {
|
||||
this.icon.spriteFrame = data;
|
||||
})
|
||||
super.onJNLoad(info);
|
||||
|
||||
let config = TD.TbGRoleEquip.get(info.equipCfgId);
|
||||
TbResource.loadSpriteIcon(IconTypeEnum.宠物装备,config.icon,this.icon,this);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -13,6 +13,7 @@ export enum GUI{
|
||||
Loading = "Loading", //加载页面
|
||||
Tips = "Tips", //提示
|
||||
SelectionBox = "SelectionBox", //选择提示页面 (用于玩家确定该操作)
|
||||
Debugger = "Debugger", //Debugger
|
||||
|
||||
/** 新手引导 */
|
||||
NoviceNamingView = "NoviceNamingView", //新手引导页面 - 取名
|
||||
@@ -56,6 +57,11 @@ const UISystemConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
uri: "prefab/ui/系统页面/提示/TipsView",
|
||||
anims:BackOutScale
|
||||
},
|
||||
[GUI.Debugger]:{
|
||||
layer:GLayer.Popup,
|
||||
uri: "prefab/ui/Debugger/Debugger",
|
||||
anims:BackOutScale
|
||||
},
|
||||
[GUI.SelectionBox]:{
|
||||
layer:GLayer.Tips,
|
||||
uri: "prefab/ui/系统页面/选择提示/SelectionBox",
|
||||
|
Reference in New Issue
Block a user