mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 18:26:23 +00:00
提交
This commit is contained in:
@@ -12,7 +12,6 @@ import JNLayerBase from "../../extensions/ngame/assets/ngame/ui/base/JNLayerBase
|
||||
import { EventDispatcher } from "../../extensions/ngame/assets/ngame/util/EventDispatcher";
|
||||
import { JsonLoad, JsonUtil } from "../../extensions/ngame/assets/ngame/util/JsonUtil";
|
||||
import NGameMessage from "../../extensions/ngame/assets/ngame/util/NGameMessage";
|
||||
import axios from "../../extensions/ngame/assets/plugins/axios.js";
|
||||
import GBattleModeManager from "./battle/GBattleModeManager";
|
||||
import { GLayer, GUI, UIConfig } from "./ui/UIConfig";
|
||||
import JLoaderSystem from "../../extensions/ngame/assets/ngame/system/JLoaderSystem";
|
||||
@@ -23,8 +22,12 @@ import { TB, Tables } from "../resources/config/data/schema";
|
||||
import { JsonAsset } from "cc";
|
||||
import { GAction } from "./consts/GActionEnum";
|
||||
import { StorageData, StorageEnum } from "./consts/GData";
|
||||
import { Axios, Env, JNGame } from "../../extensions/ngame/assets/ngame/JNGame";
|
||||
|
||||
let IP = "kyu.jisol.cn";
|
||||
//设置微信环境
|
||||
JNGame.setEnv(Env.WX);
|
||||
|
||||
let IP = "localhost";
|
||||
|
||||
//重写UI
|
||||
class JNGLayer extends JNLayer{
|
||||
@@ -231,9 +234,10 @@ export const app = {
|
||||
sync : new JNGSyncFrame(), //同步
|
||||
event : EventDispatcher.getIns(), //通知
|
||||
proto : NGameMessage.getIns(), //消息
|
||||
api : axios.create({
|
||||
baseURL: `http://${IP}:8080`,
|
||||
}), //请求
|
||||
// api : Axios.create({
|
||||
// baseURL: `http://${IP}:8080`,
|
||||
// }), //请求
|
||||
// api : {}, //请求
|
||||
battle : GBattleModeManager.getIns(), //战斗
|
||||
config : new JNGConfig(), //配置文件
|
||||
battleRes : new JLoaderBattle("battle"), //battle包
|
||||
@@ -242,4 +246,10 @@ export const app = {
|
||||
[JLoaderBattle.loading]:{title:"加载战斗资源"},
|
||||
[JLoaderBattle.loadingInit]:{title:"初始化战斗资源"},
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
// app.api.interceptors.request.use(function(config){
|
||||
// //设置Token
|
||||
// config.headers.set("Token",StorageData.get(StorageEnum.Token));
|
||||
// return config;
|
||||
// })
|
@@ -1,6 +1,6 @@
|
||||
import { _decorator, Component, director, instantiate, Node, Prefab } from 'cc';
|
||||
import { app } from './App';
|
||||
import { JNGame } from '../../extensions/ngame/assets/ngame/JNGame';
|
||||
import { Env, JNGame } from '../../extensions/ngame/assets/ngame/JNGame';
|
||||
import { JNSyncAction } from '../../extensions/ngame/assets/ngame/sync/JNSyncAction';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
@@ -13,6 +13,11 @@ const RData = (data:any) => {
|
||||
}
|
||||
}
|
||||
|
||||
export interface NewsContext{
|
||||
state:number,
|
||||
msg:string,
|
||||
data:any,
|
||||
}
|
||||
export interface UserVO{
|
||||
userId:number, //玩家Id
|
||||
userName:string, //玩家名称
|
||||
@@ -25,8 +30,9 @@ export interface UserLoginVO{
|
||||
|
||||
export const API = {
|
||||
|
||||
UserRegister : async () => RData(await http.post(`/user/register`)) as UserVO,
|
||||
UserLogin : async (account:string,password:string) => RData(await http.post(`/user/login`,{userId:account,userPass:password})) as UserLoginVO,
|
||||
UserRegister : async () => RData(await http.post(`/user/register`)) as UserVO, //玩家注册
|
||||
UserLogin : async (account:string,password:string) => RData(await http.post(`/user/login`,{userId:account,userPass:password})) as UserLoginVO, //玩家登录
|
||||
GetPlayerInfo : async () => (await http.get(`/game/player/info`)).data as NewsContext, //获取玩家信息
|
||||
|
||||
}
|
||||
|
||||
|
@@ -6,6 +6,7 @@ import { director } from 'cc';
|
||||
import { WorldCanvas } from '../../WorldCanvas';
|
||||
import { StorageData, StorageEnum } from '../../consts/GData';
|
||||
import { GUI } from '../UIConfig';
|
||||
import { API } from '../../consts/API';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('HomeView')
|
||||
@@ -14,6 +15,10 @@ export class HomeView extends JNGLayerBase {
|
||||
@property(Label)
|
||||
frameText:Label;
|
||||
|
||||
async onLoad(){
|
||||
app.layer.Open(GUI.Tips,{text:(await API.GetPlayerInfo()).msg});
|
||||
}
|
||||
|
||||
update(){
|
||||
this.frameText.string = `当前帧数: ${app.sync.frame}`;
|
||||
}
|
||||
|
Reference in New Issue
Block a user