From 620bcd3e53929257fa256461fe51f912092b2b92 Mon Sep 17 00:00:00 2001 From: "DESKTOP-5RP3AKU\\Jisol" <2858626794@qq.com> Date: Fri, 10 Nov 2023 03:56:07 +0800 Subject: [PATCH] update --- DataTables/Datas/新手引导/选择宠物.xlsx | Bin 0 -> 9915 bytes .../prefab/ui/{Home.meta => 主页.meta} | 0 .../prefab/ui/{Home => 主页}/HomeView.prefab | 0 .../ui/{Home => 主页}/HomeView.prefab.meta | 0 .../prefab/ui/{Loading.meta => 加载页面.meta} | 0 .../{Loading => 加载页面}/LoadingView.prefab | 0 .../LoadingView.prefab.meta | 0 .../resources/prefab/ui/新手引导页面.meta | 9 + .../ui/新手引导页面/NoviceNamingView.prefab | 1365 ++++++++++++++ .../新手引导页面/NoviceNamingView.prefab.meta | 13 + .../新手引导页面/NoviceSelectPetView.prefab | 1583 +++++++++++++++++ .../NoviceSelectPetView.prefab.meta | 13 + .../prefab/ui/{System.meta => 系统页面.meta} | 0 .../ui/{System => 系统页面}/LoginView.prefab | 0 .../LoginView.prefab.meta | 0 .../prefab/ui/{System => 系统页面}/Tips.meta | 0 .../{System => 系统页面}/Tips/TipsView.prefab | 0 .../Tips/TipsView.prefab.meta | 0 JisolGameCocos/assets/script/App.ts | 15 +- JisolGameCocos/assets/script/AppData.ts | 42 + JisolGameCocos/assets/script/AppData.ts.meta | 9 + JisolGameCocos/assets/script/consts/API.ts | 26 +- .../assets/script/consts/GActionEnum.ts | 1 + JisolGameCocos/assets/script/consts/GData.ts | 1 + .../assets/script/ui/Loading/LoadingView.ts | 8 +- JisolGameCocos/assets/script/ui/Novice.meta | 9 + .../assets/script/ui/Novice/NoviceManager.ts | 20 + .../script/ui/Novice/NoviceManager.ts.meta | 9 + .../script/ui/Novice/NoviceNamingView.ts | 24 + .../script/ui/Novice/NoviceNamingView.ts.meta | 9 + .../script/ui/Novice/NoviceSelectPetView.ts | 9 + .../ui/Novice/NoviceSelectPetView.ts.meta | 9 + JisolGameCocos/assets/script/ui/UIConfig.ts | 37 +- .../controller/game/PlayerController.java | 53 +- .../cn/jisol/game/entity/game/Player.java | 11 +- .../Main/src/main/resources/application.yml | 3 + 36 files changed, 3246 insertions(+), 32 deletions(-) create mode 100644 DataTables/Datas/新手引导/选择宠物.xlsx rename JisolGameCocos/assets/resources/prefab/ui/{Home.meta => 主页.meta} (100%) rename JisolGameCocos/assets/resources/prefab/ui/{Home => 主页}/HomeView.prefab (100%) rename JisolGameCocos/assets/resources/prefab/ui/{Home => 主页}/HomeView.prefab.meta (100%) rename JisolGameCocos/assets/resources/prefab/ui/{Loading.meta => 加载页面.meta} (100%) rename JisolGameCocos/assets/resources/prefab/ui/{Loading => 加载页面}/LoadingView.prefab (100%) rename JisolGameCocos/assets/resources/prefab/ui/{Loading => 加载页面}/LoadingView.prefab.meta (100%) create mode 100644 JisolGameCocos/assets/resources/prefab/ui/新手引导页面.meta create mode 100644 JisolGameCocos/assets/resources/prefab/ui/新手引导页面/NoviceNamingView.prefab create mode 100644 JisolGameCocos/assets/resources/prefab/ui/新手引导页面/NoviceNamingView.prefab.meta create mode 100644 JisolGameCocos/assets/resources/prefab/ui/新手引导页面/NoviceSelectPetView.prefab create mode 100644 JisolGameCocos/assets/resources/prefab/ui/新手引导页面/NoviceSelectPetView.prefab.meta rename JisolGameCocos/assets/resources/prefab/ui/{System.meta => 系统页面.meta} (100%) rename JisolGameCocos/assets/resources/prefab/ui/{System => 系统页面}/LoginView.prefab (100%) rename JisolGameCocos/assets/resources/prefab/ui/{System => 系统页面}/LoginView.prefab.meta (100%) rename JisolGameCocos/assets/resources/prefab/ui/{System => 系统页面}/Tips.meta (100%) rename JisolGameCocos/assets/resources/prefab/ui/{System => 系统页面}/Tips/TipsView.prefab (100%) rename JisolGameCocos/assets/resources/prefab/ui/{System => 系统页面}/Tips/TipsView.prefab.meta (100%) create mode 100644 JisolGameCocos/assets/script/AppData.ts create mode 100644 JisolGameCocos/assets/script/AppData.ts.meta create mode 100644 JisolGameCocos/assets/script/ui/Novice.meta create mode 100644 JisolGameCocos/assets/script/ui/Novice/NoviceManager.ts create mode 100644 JisolGameCocos/assets/script/ui/Novice/NoviceManager.ts.meta create mode 100644 JisolGameCocos/assets/script/ui/Novice/NoviceNamingView.ts create mode 100644 JisolGameCocos/assets/script/ui/Novice/NoviceNamingView.ts.meta create mode 100644 JisolGameCocos/assets/script/ui/Novice/NoviceSelectPetView.ts create mode 100644 JisolGameCocos/assets/script/ui/Novice/NoviceSelectPetView.ts.meta diff --git a/DataTables/Datas/新手引导/选择宠物.xlsx b/DataTables/Datas/新手引导/选择宠物.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..ddd31373b853d6e26ceb0008ce628a26269051a2 GIT binary patch literal 9915 zcma)i1z223vo`J?f=h6Bf@_c4YQM_#pmd+GSF-o0f#<^7RF!hhvH+L))k!ZYU1&^q3*q<$O`UVgjbHu0^*KWM7S=Pg=ysy9b# zwUz2o%I5WUA_wKZjE*Zj>@w6z!`yOg=r*)?r5B?F593ub?Vz7XReVo+))lzwvra)r5# z)zmI$&nv3Jy){EJX<0-ZH*x1ARVs5ekOSNdO-PmQ={`CVWQH<16=zRID7k$ckQJVW zq$`S?-ny*o8Og_`i%DC)u{9wczEF^J5hHL2*Ae+H)xo?vu7v8O$^^_2_M#D6Nh4b~ zPThM6v6&*)+G^W)#-Md~*Kh;%PkIHh!yZ(?^lF3Y#r!+HAFS<+p7?c-`6>fq#p?m{ z3pP(|iN(~Y!-^pdywCG4EvZ(^E-of%;QSc(Q4aSq=u$BqR6TDNxW;zz?w!u z2NM6Bkz4Z;G!sM>w*XU?sm)Uk>?_sUg)M8S-$HJOekEBCGeA{G#4XZx5M&Y};q(_?pV}zOq*(I!l+{o!kViK!cHMpPWU_G~UF{@+&Dr@0#ey3fk_Lbh^WvXyj zT~%oDMWIJovIe4vDI@GNg8EXR3vaNk^=w$#O84+W+!k+dmE6tw#o6`E$?*fx`f{dN z&37#lsgZ^+rPo3Yh%{TX*tyWJ0)_Ce4HL(L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qndMCNX36asCd zHXd6(sMeq@XWbsK9mONah0ARV^Y%GWc5_Yk!r^Sb2@-uD=&b!bphsR8ke7H?dNq`M z%*fxt>mK967pjHQm5h>~81e1J$)GJ=w1q4mE?&!(?dEU6@PcDaz(?>xM+FDOpOU{? zV%AnbBP-y06=xeGfX>r`FO3_JhhoDHxTJ0c#Z6UQm#RNyJ+V;OGxuM zx=5qbgA(-)OOfW=zixZHYeA7@Fb|;;|F$$)^8Q>MQr;zZvBa1(_R~q)^F%-84k!4R zTF{kaM>l4y8u0BtMZ{Aj(sTkg5tWb(Urr#2hTgbWlaH|uJ7L%{8@F4#w(v8z$gU_Q zX`*rw34B#yd_$l1?#y+a(nnNHzzV0fBsmx(EP*^)xfQtUrDTQpT=o0QnQbp_L*L_U zKZoy*?X?HtS;3m3Y&dK!NU~h@Cw4^cBJu%6ZK@G7XA^}9A_T~?m@1>SB_i?Olw{PX z!fB6&vZSkaSIpV9HwJ4^v2~v~&F^g&HQjkX(*E$u7SpRa_oAJp z^VaCvHpb@Ducsfl?%)(;A)&DU*u#Gop8ReZuyG(DAzpxcII@4W)6WV1JstAoa(=d_ z8Wt;(Uk>P>N`H4jPne%dWB$VYv1I<6vZpoqvpp$$YJaP(`KP|$t81Qwf9j+8JM4dJ zZGNZd_u`RX=m795{g=`|OG$o*|6cg;3yuiR*Z+e5RR;0j9{MT6|Fbpem^Y!nx`A=Aph;?`1=gM2Tgy?@KhZ2 zG{avZ)c^ly9|uzbhW?qW`{x_-d$#VE#_PYse&z0dzvbVLGruOlC;mh4-)Z}AH~mzi y@v}Wy*ypE(|532<&pZFUWaA0@(`se^f&Ep$p&$$U$700 { - resolve(`ws://${IP}:8080/websocket/${token}`); + resolve(`${WsPath}/${token}`); } //如果没有Token则弹出登入页面 app.layer.Open(GUI.Login,loginResolve); @@ -232,20 +235,22 @@ export const app = { event : EventDispatcher.getIns(), //通知 proto : NGameMessage.getIns(), //消息 api : JAPI.create({ - baseURL: `http://${IP}:8080`, + baseURL: `${APIPath}`, }), //请求 // api : {}, //请求 battle : GBattleModeManager.getIns(), //战斗 config : new JNGConfig(), //配置文件 battleRes : new JLoaderBattle("battle"), //battle包 + data : new AppData(), //游戏基础信息 loading: new Loading({ [JNGConfig.loading]:{title:"加载配置文件"}, [JLoaderBattle.loading]:{title:"加载战斗资源"}, [JLoaderBattle.loadingInit]:{title:"初始化战斗资源"}, + [AppData.loading]:{title:"初始化信息"}, }), } -app.api.addInterceptor((config:JAPIConfig) => { +app.api.addRequestInterceptors((config:JAPIConfig) => { //设置Token config.headers["Token"] = StorageData.get(StorageEnum.Token); return true; diff --git a/JisolGameCocos/assets/script/AppData.ts b/JisolGameCocos/assets/script/AppData.ts new file mode 100644 index 00000000..a3940011 --- /dev/null +++ b/JisolGameCocos/assets/script/AppData.ts @@ -0,0 +1,42 @@ +import SystemBase from "../../extensions/ngame/assets/ngame/system/SystemBase"; +import { app } from "./App"; +import { API, NewsContext, PlayerInfoOV } from "./consts/API"; + + +//数据类 (用于初始化游戏信息) +export class AppData extends SystemBase{ + + static loading = "AppData"; + + //玩家信息 + static PLAYER_INFO:string = "PLAYER_INFO"; + + get loadings():{[key:string]:Function}{ + return { + [AppData.PLAYER_INFO]:API.GetPlayerInfo, //玩家信息 + } + } + + data:{[key:string]:any} = {}; + + async onInit(): Promise { + + app.loading.setCurrent(AppData.loading); + + //加载信息 + let keys = Object.keys(this.loadings); + for (let index = 0; index < keys.length; index++) { + this.data[keys[index]] = (await this.loadings[keys[index]]()); + } + + app.loading.ok(AppData.loading); + + } + + //获取玩家信息 + getPlayerInfo():PlayerInfoOV{ + return this.data[AppData.PLAYER_INFO]; + } + +} + diff --git a/JisolGameCocos/assets/script/AppData.ts.meta b/JisolGameCocos/assets/script/AppData.ts.meta new file mode 100644 index 00000000..dc48370b --- /dev/null +++ b/JisolGameCocos/assets/script/AppData.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "edb3bebb-69b2-4a49-aaa8-3b3c53988f46", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/JisolGameCocos/assets/script/consts/API.ts b/JisolGameCocos/assets/script/consts/API.ts index b35048bf..80838e1c 100644 --- a/JisolGameCocos/assets/script/consts/API.ts +++ b/JisolGameCocos/assets/script/consts/API.ts @@ -1,15 +1,15 @@ import { app } from "../App"; import { GUI } from "../ui/UIConfig"; -const http = app.api; - -const RData = (data:any) => { +const RData = (data:any,isTips:boolean = true) => { if(data.data.state == 200){ return data.data.data; }else{ //弹出提示 - app.layer.Open(GUI.Tips,{text:data.data.msg}); - return null; + if(isTips){ + app.layer.Open(GUI.Tips,{text:data.data.msg}); + } + return data.data.data; } } @@ -27,12 +27,22 @@ export interface UserLoginVO{ token:string, //token user:UserVO, //玩家信息 } +export interface PlayerInfoOV{ + playerId:number, //玩家Id + userId: number, //用户Id + playerName:string, //玩家名 + playerCreateTime:number, //玩家创建时间 + novice: false, //是否过引导 +} 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, //玩家登录 - GetPlayerInfo : async () => (await http.get(`/game/player/info`)).data as NewsContext, //获取玩家信息 + 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 NewsContext, //获取玩家信息 + + /********** 新手引导接口 *****************/ + SavePlayerInfo : async (playerName:string,novice:boolean = true) => (await app.api.post(`/game/player/info/save`,{playerName,novice})).data as NewsContext, //保存玩家信息 } diff --git a/JisolGameCocos/assets/script/consts/GActionEnum.ts b/JisolGameCocos/assets/script/consts/GActionEnum.ts index 05e2180e..9c8d88ea 100644 --- a/JisolGameCocos/assets/script/consts/GActionEnum.ts +++ b/JisolGameCocos/assets/script/consts/GActionEnum.ts @@ -1,5 +1,6 @@ export enum GAction { TOKEN_EXPIRED = 1001, //Token过期 + NOT_CREATE_PLAYER_INFO = 2001, //没有玩家信息 - 前往引导页面 } \ No newline at end of file diff --git a/JisolGameCocos/assets/script/consts/GData.ts b/JisolGameCocos/assets/script/consts/GData.ts index e5f8e852..8e82dee7 100644 --- a/JisolGameCocos/assets/script/consts/GData.ts +++ b/JisolGameCocos/assets/script/consts/GData.ts @@ -23,6 +23,7 @@ export class StorageData { } export const GData = { + //层级 layer: { World: 1, } diff --git a/JisolGameCocos/assets/script/ui/Loading/LoadingView.ts b/JisolGameCocos/assets/script/ui/Loading/LoadingView.ts index 4917a896..0f1ef5a5 100644 --- a/JisolGameCocos/assets/script/ui/Loading/LoadingView.ts +++ b/JisolGameCocos/assets/script/ui/Loading/LoadingView.ts @@ -3,6 +3,9 @@ import { _decorator } from "cc"; import { JNGLayerBase, app } from "../../App"; import { Label } from "cc"; import { GUI } from "../UIConfig"; +import { API } from "../../consts/API"; +import { GAction } from "../../consts/GActionEnum"; +import NoviceManager from "../Novice/NoviceManager"; const { ccclass, property } = _decorator; @ccclass('LoadingView') @@ -29,9 +32,10 @@ export default class LoadingView extends JNGLayerBase { async onSuccess(){ - //打开主页 - await app.layer.Open(GUI.Home); + await NoviceManager.getIns().onStart(); + //关闭加载页 + await app.layer.Open(GUI.Home); app.layer.Close(GUI.Loading); } diff --git a/JisolGameCocos/assets/script/ui/Novice.meta b/JisolGameCocos/assets/script/ui/Novice.meta new file mode 100644 index 00000000..cad36f58 --- /dev/null +++ b/JisolGameCocos/assets/script/ui/Novice.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "22b638a6-c17e-4935-adb5-b5309777f71c", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/JisolGameCocos/assets/script/ui/Novice/NoviceManager.ts b/JisolGameCocos/assets/script/ui/Novice/NoviceManager.ts new file mode 100644 index 00000000..fd74b220 --- /dev/null +++ b/JisolGameCocos/assets/script/ui/Novice/NoviceManager.ts @@ -0,0 +1,20 @@ +import Singleton from "../../../../extensions/ngame/assets/ngame/util/Singleton"; +import { app } from "../../App"; +import { GUI } from "../UIConfig"; + +export default class NoviceManager extends Singleton{ + + //新手引导执行 + async onStart(){ + + if(!(app.data.getPlayerInfo().novice)){ + //如果没有过引导则打开引导页面 + await app.layer.OpenToClose(GUI.NoviceNamingView); + } + + console.log("新手引导结束"); + + } + +} + diff --git a/JisolGameCocos/assets/script/ui/Novice/NoviceManager.ts.meta b/JisolGameCocos/assets/script/ui/Novice/NoviceManager.ts.meta new file mode 100644 index 00000000..be074a4f --- /dev/null +++ b/JisolGameCocos/assets/script/ui/Novice/NoviceManager.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "8b5cc1e0-3fa2-4ee3-b93b-2da9878f9c8c", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/JisolGameCocos/assets/script/ui/Novice/NoviceNamingView.ts b/JisolGameCocos/assets/script/ui/Novice/NoviceNamingView.ts new file mode 100644 index 00000000..b7f3d578 --- /dev/null +++ b/JisolGameCocos/assets/script/ui/Novice/NoviceNamingView.ts @@ -0,0 +1,24 @@ +import { _decorator, Component, Node } from 'cc'; +import { app, JNGLayerBase } from '../../App'; +import { EditBox } from 'cc'; +import { API } from '../../consts/API'; +const { ccclass, property } = _decorator; + +@ccclass('NoviceNamingView') +export class NoviceNamingView extends JNGLayerBase { + + @property(EditBox) + text:EditBox; + + //保存名称 + async onSave(){ + if(this.text.string){ + await API.SavePlayerInfo(this.text.string); + //关闭页面 + app.layer.CloseNode(this.node); + } + } + +} + + diff --git a/JisolGameCocos/assets/script/ui/Novice/NoviceNamingView.ts.meta b/JisolGameCocos/assets/script/ui/Novice/NoviceNamingView.ts.meta new file mode 100644 index 00000000..513592ff --- /dev/null +++ b/JisolGameCocos/assets/script/ui/Novice/NoviceNamingView.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "ccac142a-85d0-4cc2-9f66-e71110e1d69d", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/JisolGameCocos/assets/script/ui/Novice/NoviceSelectPetView.ts b/JisolGameCocos/assets/script/ui/Novice/NoviceSelectPetView.ts new file mode 100644 index 00000000..a1fed136 --- /dev/null +++ b/JisolGameCocos/assets/script/ui/Novice/NoviceSelectPetView.ts @@ -0,0 +1,9 @@ +import { _decorator, Component, Node } from 'cc'; +import { JNGLayerBase } from '../../App'; +const { ccclass, property } = _decorator; + +@ccclass('NoviceSelectPetView') +export class NoviceSelectPetView extends JNGLayerBase { +} + + diff --git a/JisolGameCocos/assets/script/ui/Novice/NoviceSelectPetView.ts.meta b/JisolGameCocos/assets/script/ui/Novice/NoviceSelectPetView.ts.meta new file mode 100644 index 00000000..06de1a95 --- /dev/null +++ b/JisolGameCocos/assets/script/ui/Novice/NoviceSelectPetView.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "0bc93bda-24b6-4fb9-809c-d5d4ebbf22ec", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/JisolGameCocos/assets/script/ui/UIConfig.ts b/JisolGameCocos/assets/script/ui/UIConfig.ts index 3d6b60c5..fae4206a 100644 --- a/JisolGameCocos/assets/script/ui/UIConfig.ts +++ b/JisolGameCocos/assets/script/ui/UIConfig.ts @@ -13,6 +13,10 @@ export enum GUI{ Loading = "Loading", //加载页面 Tips = "Tips", //提示 + /** 新手引导 */ + NoviceNamingView = "NoviceNamingView", //新手引导页面 - 取名 + NoviceSelectPetView = "NoviceSelectPetView", //新手引导页面 - 选择宠物 + Home = "Home", //主页面 } @@ -21,7 +25,7 @@ export enum GUI{ const UISystemConfig:{ [key: string]: JNLayerInfo; } = { [GUI.Tips]:{ layer:GLayer.Tips, - uri: "prefab/ui/System/Tips/TipsView", + uri: "prefab/ui/系统页面/Tips/TipsView", anims:{ front:JNLayerAnim.BackOutOpen, back:JNLayerAnim.BackInClose @@ -29,7 +33,7 @@ const UISystemConfig:{ [key: string]: JNLayerInfo; } = { }, [GUI.Login]:{ layer:GLayer.Popup, - uri: "prefab/ui/System/LoginView", + uri: "prefab/ui/系统页面/LoginView", anims:{ front:JNLayerAnim.BackOutOpen, back:JNLayerAnim.BackInClose @@ -37,7 +41,7 @@ const UISystemConfig:{ [key: string]: JNLayerInfo; } = { }, [GUI.Loading]:{ layer:GLayer.View, - uri: "prefab/ui/Loading/LoadingView", + uri: "prefab/ui/加载页面/LoadingView", anims:{ back:JNLayerAnim.Smaller, backInfo:{key:"position",start:v3(0,0,0),end:v3(-720,0,0)} @@ -45,10 +49,32 @@ const UISystemConfig:{ [key: string]: JNLayerInfo; } = { }, } +//新手引导页面 +const UINoviceConfig:{ [key: string]: JNLayerInfo; } = { + + [GUI.NoviceNamingView]:{ + layer:GLayer.Popup, + uri: "prefab/ui/新手引导页面/NoviceNamingView", + anims:{ + front:JNLayerAnim.BackOutOpen, + back:JNLayerAnim.BackInClose + } + }, + [GUI.NoviceSelectPetView]:{ + layer:GLayer.Popup, + uri: "prefab/ui/新手引导页面/NoviceSelectPetView", + anims:{ + front:JNLayerAnim.BackOutOpen, + back:JNLayerAnim.BackInClose + } + }, + +} + export const UIConfig:{ [key: string]: JNLayerInfo; } = { [GUI.Home]:{ layer:GLayer.View, - uri: "prefab/ui/Home/HomeView", + uri: "prefab/ui/主页/HomeView", anims:{ front:JNLayerAnim.Enlarge, back:JNLayerAnim.Smaller, @@ -56,6 +82,7 @@ export const UIConfig:{ [key: string]: JNLayerInfo; } = { backInfo:{key:"position",start:v3(0,0,0),end:v3(-720,0,0)} }, }, - ...UISystemConfig + ...UISystemConfig, //系统页面 + ...UINoviceConfig, //新手引导页面 } diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/PlayerController.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/PlayerController.java index 07d2f6af..a589e12c 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/PlayerController.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/PlayerController.java @@ -8,17 +8,18 @@ import cn.jisol.game.service.PlayerService; import cn.jisol.game.service.impl.PlayerServiceImpl; import cn.jisol.ngame.util.NewsContext; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.Objects; /** * 新手API */ +@Api(value = "JNGameDemo - API", tags = {"PET - API"}) @RestController @RequestMapping("/game/player") @ResponseBody @@ -28,18 +29,56 @@ public class PlayerController { PlayerServiceImpl playerService; //获取玩家信息 + @ApiImplicitParams({}) + @ApiOperation(value = "获取玩家信息") @GetMapping("/info") public NewsContext getPlayerInfo(@CurrentUser User user){ Player info = playerService.getOne(Wrappers.lambdaQuery(Player.class).eq(Player::getUserId,user.getUserId())); if (Objects.isNull(info)){ - //玩家没有进入过游戏 前往 新手引导 - return NewsContext.onMessage("前往新手引导",null, HttpCode.NOT_CREATE_PLAYER_INFO); - }else{ + try{ + info = Player.builder().userId(user.getUserId()).playerName("冒险者").build(); + playerService.saveOrUpdate(info); + }catch (Exception ignored){} + assert playerService != null; + info = playerService.getOne(Wrappers.lambdaQuery(Player.class).eq(Player::getUserId,user.getUserId())); + } + + if (info.isNovice()){ return NewsContext.onSuccess("获取成功",info); + }else{ + //前往 新手引导 + return NewsContext.onMessage("前往新手引导",info, HttpCode.NOT_CREATE_PLAYER_INFO); } } + //设置玩家信息 + @ApiImplicitParams({}) + @ApiOperation(value = "设置玩家信息") + @PostMapping("/info/save") + public NewsContext savePlayerInfo(@CurrentUser User user,@RequestBody Player player){ + + //获取玩家信息 + Player info = playerService.getOne(Wrappers.lambdaQuery(Player.class).eq(Player::getUserId,user.getUserId())); + + //如果没有玩家信息则初始化信息 + if (Objects.isNull(info)){ + info = Player.builder().userId(user.getUserId()).build(); + } + + info.setPlayerName(player.getPlayerName()); + info.setNovice(player.isNovice()); + + //保存信息 + if(playerService.saveOrUpdate(info)){ + return NewsContext.onSuccess("保存成功",info); + }else{ + return NewsContext.onFail("保存失败",info); + } + + } + + } diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/entity/game/Player.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/entity/game/Player.java index 8e93e3f1..ee512305 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/entity/game/Player.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/entity/game/Player.java @@ -1,18 +1,19 @@ package cn.jisol.game.entity.game; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; import lombok.Builder; import lombok.Data; +import java.util.Date; + @Builder @Data @TableName("`player`") public class Player { @TableId(type = IdType.AUTO) private Long playerId; //游戏玩家Id - private String userId; //玩家Id + private Long userId; //玩家Id private String playerName; //游戏玩家名称 - private Long playerCreateTime; //玩家创建时间 + private Date playerCreateTime; //玩家创建时间 + private boolean isNovice; //玩家是否过了新手引导 } diff --git a/JisolGameServer/Main/src/main/resources/application.yml b/JisolGameServer/Main/src/main/resources/application.yml index d4ae8ac9..345f2c91 100644 --- a/JisolGameServer/Main/src/main/resources/application.yml +++ b/JisolGameServer/Main/src/main/resources/application.yml @@ -6,6 +6,9 @@ spring: password: sThsBwjfDcaw2wJR url: jdbc:mysql://kyu.jisol.cn:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 driver-class-name: com.mysql.cj.jdbc.Driver + jackson: + serialization: + write-dates-as-timestamps: true mybatis-plus: configuration: