mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交捕捉
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { app } from "../App";
|
||||
import { GUI } from "../ui/UIConfig";
|
||||
|
||||
const RData = (data:any,isTips:boolean = true) => {
|
||||
//接受到JSON消息
|
||||
export const RData = (data:any,isTips:boolean = true) => {
|
||||
if(data.data.state == 200){
|
||||
return data.data.data;
|
||||
}else{
|
||||
@@ -12,6 +13,18 @@ const RData = (data:any,isTips:boolean = true) => {
|
||||
return data.data.data;
|
||||
}
|
||||
}
|
||||
//接受到Protobuf
|
||||
export const RProto = (data:any,type:string) => {
|
||||
|
||||
try{
|
||||
return app.proto
|
||||
.getType(type)
|
||||
.decode(new Uint8Array(data.data)) as any;;
|
||||
}catch{
|
||||
app.layer.Open(GUI.Tips,{text:"Protobuf 解析失败"});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/************** 请求类 *******************/
|
||||
export interface NewsContext{
|
||||
|
14
JisolGameCocos/assets/script/consts/GAPI.ts
Normal file
14
JisolGameCocos/assets/script/consts/GAPI.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { GOnHookPets } from "../../../extensions/ngame/assets/ngame/message/proto";
|
||||
import { app } from "../App";
|
||||
import { PlayerPetOV, RData, RProto } from "./API";
|
||||
import { GActionType } from "./GActionType";
|
||||
|
||||
export const GAPI = {
|
||||
|
||||
/************** 无限模式接口 ********************/
|
||||
//生成野怪
|
||||
GOnHookSpawnCreeps : async () => RProto(await app.api.get(`/game/mode/onHook/onSpawnCreeps`,{responseType:'arraybuffer'}),GActionType.GOnHookPets) as GOnHookPets,
|
||||
//捕捉野怪
|
||||
GOnHookCatchCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onCatchCreeps/${creepId}`)) as PlayerPetOV,
|
||||
|
||||
}
|
9
JisolGameCocos/assets/script/consts/GAPI.ts.meta
Normal file
9
JisolGameCocos/assets/script/consts/GAPI.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "4ecc480c-6d05-4b57-bc01-1605ae0c1512",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -8,9 +8,5 @@ export enum GAction {
|
||||
|
||||
|
||||
/*************** 游戏模式 : 无尽模式(OnHook) **************/
|
||||
MODE_ON_HOOK_SPAWN_PET = 3001, //生成宠物
|
||||
MODE_ON_HOOK_CAPTURE_PET = 3002, //捕捉宠物
|
||||
MODE_ON_HOOK_SELL_PET = 3003, //卖出宠物
|
||||
|
||||
|
||||
}
|
@@ -1,13 +1,14 @@
|
||||
import { sys } from "cc";
|
||||
import { WorldCanvas } from "../WorldCanvas";
|
||||
|
||||
//UI 动画
|
||||
export enum UIPetAnim{
|
||||
std = "std",
|
||||
}
|
||||
|
||||
//存储Key
|
||||
export enum StorageEnum{
|
||||
|
||||
Token = "Storage_Token", // Token
|
||||
|
||||
}
|
||||
|
||||
export class StorageData {
|
||||
@@ -26,10 +27,13 @@ export class StorageData {
|
||||
|
||||
}
|
||||
|
||||
export const GData = {
|
||||
export class GData {
|
||||
//层级
|
||||
layer: {
|
||||
static layer = {
|
||||
World: 1,
|
||||
}
|
||||
};
|
||||
|
||||
//世界画布节点
|
||||
static WorldCanvas: WorldCanvas;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user