mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 03:14:47 +00:00
提交
This commit is contained in:
parent
a5195e3a6d
commit
0556449f0a
File diff suppressed because it is too large
Load Diff
9
JisolGameCocos/assets/resources/prefab/ui/模式/OnHook.meta
Normal file
9
JisolGameCocos/assets/resources/prefab/ui/模式/OnHook.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "9cba9069-da44-48a9-aba5-3c29cb53c065",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
1976
JisolGameCocos/assets/resources/prefab/ui/模式/OnHook/OnHook排行榜.prefab
Normal file
1976
JisolGameCocos/assets/resources/prefab/ui/模式/OnHook/OnHook排行榜.prefab
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.49",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "96d65d45-9df6-4b13-8253-d740249f2ae4",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "OnHook排行榜"
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.49",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "293353b4-edba-4914-8182-bead1548dc57",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "OnHook排行榜节点"
|
||||
}
|
||||
}
|
@ -2720,6 +2720,9 @@
|
||||
"__id__": 85
|
||||
},
|
||||
"petPreview": null,
|
||||
"tacticalLabel": {
|
||||
"__id__": 99
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
|
@ -93,6 +93,14 @@ export interface ResourceOV{
|
||||
version:number; //版本号
|
||||
}
|
||||
|
||||
export interface ModeOnHookRankingOV{
|
||||
playerId:number; //游戏玩家Id
|
||||
playerName:string; //游戏玩家名称
|
||||
levelId:number; //玩家关卡Id
|
||||
rank:number; //玩家当前排名
|
||||
mapId:number; //地图Id
|
||||
}
|
||||
|
||||
export const API = {
|
||||
|
||||
UserRegister : async () => RData(await app.api.post(`/user/register`)) as UserVO, //玩家注册
|
||||
@ -118,5 +126,8 @@ export const API = {
|
||||
/********** 资源接口 ******************/
|
||||
GetPlayerResource: async () => RData(await app.api.get(`/game/resource/get`),false) as ResourceOV[], //获取玩家资源
|
||||
|
||||
/********** 排行榜接口(无限模式) *******************/
|
||||
GOnHookRankings: async (mapId:number) => RData(await app.api.get(`/game/mode/onHook/onRankings/${mapId}`),false) as ModeOnHookRankingOV[], //获取玩家资源
|
||||
|
||||
}
|
||||
|
||||
|
@ -112,11 +112,11 @@ export default class GOnHookManager extends Singleton{
|
||||
|
||||
//生成野怪
|
||||
onSpawnSreeps = NGameUtil.ThrottleASync((async () => {
|
||||
GAPI.GOnHookSpawnCreeps().then(data => {
|
||||
data.pets.forEach(pet => {
|
||||
this._sreeps.set(pet.key,pet as GOnHookPet);
|
||||
})
|
||||
});
|
||||
let data = await GAPI.GOnHookSpawnCreeps();
|
||||
if(!data) return;
|
||||
data.pets.forEach(pet => {
|
||||
this._sreeps.set(pet.key,pet as GOnHookPet);
|
||||
})
|
||||
}).bind(this))
|
||||
|
||||
//获取下一只野怪
|
||||
|
@ -83,24 +83,26 @@ export class PlayerTacticalItem extends Component {
|
||||
//如果拖拽了则不生效点击事件
|
||||
if(this.drag.isMove) return;
|
||||
|
||||
//如果没有宠物则弹出选择宠物 负责 删除宠物
|
||||
if(this.petId){
|
||||
//移除宠物
|
||||
//提示是否移除宠物
|
||||
app.layer.Open(GUI.SelectionBox,{
|
||||
tigText:"是否移除宠物?",
|
||||
cancel:()=>{},
|
||||
confirm:async ()=>{
|
||||
//移除宠物 (0就是移除)
|
||||
await PlayerTacticalData.getIns().UpdateIndexTactical(this.index,0);
|
||||
}
|
||||
})
|
||||
}else{
|
||||
//选择宠物
|
||||
app.layer.Open(GUI.IntoBattleView,{
|
||||
index:this.index, //当前选择的阵法下标
|
||||
});
|
||||
}
|
||||
// //如果没有宠物则弹出选择宠物 负责 删除宠物
|
||||
// if(this.petId){
|
||||
// //移除宠物
|
||||
// //提示是否移除宠物
|
||||
// app.layer.Open(GUI.SelectionBox,{
|
||||
// tigText:"是否移除宠物?",
|
||||
// cancel:()=>{},
|
||||
// confirm:async ()=>{
|
||||
// //移除宠物 (0就是移除)
|
||||
// await PlayerTacticalData.getIns().UpdateIndexTactical(this.index,0);
|
||||
// }
|
||||
// })
|
||||
// }else{
|
||||
// }
|
||||
|
||||
//选择宠物
|
||||
app.layer.Open(GUI.IntoBattleView,{
|
||||
index:this.index, //当前选择的阵法下标
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//交换阵法
|
||||
|
@ -95,6 +95,11 @@ export class MainView extends JNGLayerBase {
|
||||
app.layer.Open(GUI.MapSelectView);
|
||||
}
|
||||
|
||||
//点击排行榜
|
||||
onOpenOnHookRinking(){
|
||||
app.layer.Open(GUI.OnHookRinkingView);
|
||||
}
|
||||
|
||||
//点击下一关
|
||||
async onClickNextLevel(){
|
||||
GOnHookManager.getIns().onNextLevel();
|
||||
|
9
JisolGameCocos/assets/script/ui/Mode/OnHook.meta
Normal file
9
JisolGameCocos/assets/script/ui/Mode/OnHook.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "3e290ee9-c2f6-45f0-9d24-52f03fc8de30",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import JNScrollViewItem from '../../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollViewItem';
|
||||
import { ModeOnHookRankingOV } from '../../../consts/API';
|
||||
import { Label } from 'cc';
|
||||
import { TD } from '../../../App';
|
||||
import GOnHookData from '../../../data/GOnHookData';
|
||||
import { TbGEntity } from '../../../config/data/schema';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('OnHookRinkingItem')
|
||||
export class OnHookRinkingItem extends JNScrollViewItem<ModeOnHookRankingOV> {
|
||||
|
||||
//排名
|
||||
@property(Label)
|
||||
rinking:Label;
|
||||
|
||||
//玩家名称
|
||||
@property(Label)
|
||||
playerName:Label;
|
||||
|
||||
//关卡名称
|
||||
@property(Label)
|
||||
levelName:Label;
|
||||
|
||||
onInit(myData:ModeOnHookRankingOV){
|
||||
this.data = myData;
|
||||
|
||||
this.rinking.string = `${this.data.rank}`;
|
||||
this.playerName.string = `${this.data.playerName}`;
|
||||
|
||||
let table:{data:TbGEntity.TOnHookLevel} = TD[TD.TbGOnHookMaps.get(this.data.mapId)?.sign].get(this.data.levelId);
|
||||
if(table)
|
||||
this.levelName.string = `难度 : ${table.data.level}-${table.data.childLevel}`;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "1cbc57bf-4f5e-4a96-a054-97af1394b599",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { JNGLayerBase } from '../../../components/JNComponent';
|
||||
import { API } from '../../../consts/API';
|
||||
import { TD } from '../../../App';
|
||||
import JNScrollView from '../../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
|
||||
import { OnHookRinkingItem } from './OnHookRinkingItem';
|
||||
import PlayerData from '../../../data/PlayerData';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/**
|
||||
* OnHook 排行榜
|
||||
*/
|
||||
@ccclass('OnHookRinkingView')
|
||||
export class OnHookRinkingView extends JNGLayerBase {
|
||||
|
||||
mapId:number;
|
||||
|
||||
@property(JNScrollView)
|
||||
rankings:JNScrollView;
|
||||
|
||||
@property(OnHookRinkingItem)
|
||||
myItem:OnHookRinkingItem;
|
||||
|
||||
onJNLoad(mapId?: number): void {
|
||||
|
||||
this.mapId = mapId || TD.TbGOnHookMaps.getDataList()[0].id;
|
||||
super.onJNLoad(mapId);
|
||||
|
||||
this.onInit();
|
||||
|
||||
}
|
||||
|
||||
async onInit(){
|
||||
|
||||
let ranks = await API.GOnHookRankings(this.mapId);
|
||||
|
||||
this.rankings.refreshData(ranks.filter(item => item.rank <= 10));
|
||||
let myData = ranks.filter(item => item.playerId == PlayerData.getIns().data.playerId)[0]
|
||||
if(myData)
|
||||
this.myItem.onInit(myData);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "7eb7c0ae-51dd-437d-a37f-80dfcfcfc7d2",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@ -12,6 +12,7 @@ import { GUI } from '../UIConfig';
|
||||
import PlayerTacticalData from '../../data/PlayerTacticalData';
|
||||
import { PetIconSelectScroll } from '../Consts/Pet/PetIconSelectScroll';
|
||||
import { PetPreviewWindow } from '../Consts/Pet/info/PetPreviewWindow';
|
||||
import { Label } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//上阵页面
|
||||
@ -25,6 +26,9 @@ export class IntoBattleView extends JNLayerBase {
|
||||
@property(PetPreviewWindow)
|
||||
petPreview:PetPreviewWindow; //宠物显示窗口
|
||||
|
||||
@property(Label)
|
||||
tacticalLabel:Label;//上阵文本
|
||||
|
||||
//宠物数据
|
||||
pets:PlayerPetOV[] = [];
|
||||
|
||||
@ -51,6 +55,14 @@ export class IntoBattleView extends JNLayerBase {
|
||||
|
||||
//获取所有玩家宠物
|
||||
this.pets = PlayerPetData.getIns().getData();
|
||||
|
||||
//获取当前阵法下标是否存在宠物
|
||||
let petId = PlayerTacticalData.getIns().getItem(this.tIndex);
|
||||
if(petId){
|
||||
//如果存在则默认选中
|
||||
this.index = this.pets.indexOf(PlayerPetData.getIns().petIdQueryPetInfo(petId));
|
||||
}
|
||||
|
||||
this.views.refreshData(this.pets);
|
||||
|
||||
//设置不可选中
|
||||
@ -83,6 +95,14 @@ export class IntoBattleView extends JNLayerBase {
|
||||
this.petPreview.bind(this.pets[this.index]);
|
||||
}
|
||||
|
||||
this.onUpdateTactical();
|
||||
}
|
||||
|
||||
//刷新上阵
|
||||
onUpdateTactical(){
|
||||
//获取当前阵法下标是否存在宠物
|
||||
let petId = PlayerTacticalData.getIns().getItem(this.tIndex);
|
||||
this.tacticalLabel.string = `${petId ? "下阵" : "上阵"}`
|
||||
}
|
||||
|
||||
//点击Item
|
||||
@ -102,13 +122,21 @@ export class IntoBattleView extends JNLayerBase {
|
||||
app.layer.Open(GUI.Tips,{text:"请选择要上阵的宠物."})
|
||||
return;
|
||||
}
|
||||
if(this.views.getItems<PetIconSelectScroll>()[this.index].select.isNoSelect) {
|
||||
app.layer.Open(GUI.Tips,{text:"当前宠物已上阵"})
|
||||
//获取当前阵法下标是否存在宠物
|
||||
let petId = PlayerTacticalData.getIns().getItem(this.tIndex);
|
||||
|
||||
if(petId) {
|
||||
//下阵
|
||||
await PlayerTacticalData.getIns().UpdateIndexTactical(this.tIndex,0);
|
||||
app.layer.Open(GUI.Tips,{text:"下阵成功"});
|
||||
//上阵完 关闭页面
|
||||
app.layer.CloseNode(this.node);
|
||||
return;
|
||||
}
|
||||
|
||||
//修改上阵信息
|
||||
await PlayerTacticalData.getIns().UpdateIndexTactical(this.tIndex,this.pets[this.index].petId);
|
||||
app.layer.Open(GUI.Tips,{text:"上阵成功"});
|
||||
|
||||
//上阵完 关闭页面
|
||||
app.layer.CloseNode(this.node);
|
||||
|
@ -28,6 +28,7 @@ export enum GUI{
|
||||
/**游戏模式页面 */
|
||||
PVPModeMatchView = "PVPModeMatchView", //PVP模式匹配页面
|
||||
CampGuardianView = "CampGuardianView", //阵营守护战斗页面
|
||||
OnHookRinkingView = "OnHookRinkingView", //OnHook 排行榜页面
|
||||
|
||||
Home = "Home", //主页面
|
||||
Main = "Main", //主页面2
|
||||
@ -137,6 +138,11 @@ const UIGModeConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
uri: "prefab/ui/模式/CampGuardian/阵营守护战斗页面",
|
||||
anims:BackOutScale
|
||||
},
|
||||
[GUI.OnHookRinkingView]:{
|
||||
layer:GLayer.Popup,
|
||||
uri: "prefab/ui/模式/OnHook/OnHook排行榜",
|
||||
anims:BackOutScale
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 10cb5e383994f61503b951861ccee9911f0149b7
|
||||
Subproject commit f147b04ddd86f482f842c803027a963a6bcc59de
|
@ -18,6 +18,7 @@ import cn.jisol.game.service.ModeOnHookService;
|
||||
import cn.jisol.game.service.PlayerPetService;
|
||||
import cn.jisol.game.service.ResourceService;
|
||||
import cn.jisol.game.table.GTbGOnHookLevels;
|
||||
import cn.jisol.game.vo.mode.ModeOnHookRankingOV;
|
||||
import cn.jisol.game.vo.news.NewsResource;
|
||||
import cn.jisol.game.vo.news.ov.ResourceUpdateOV;
|
||||
import cn.jisol.ngame.util.NewsContext;
|
||||
@ -260,9 +261,9 @@ public class GOnHookController {
|
||||
@ApiImplicitParams({})
|
||||
@ApiOperation(value = "排行榜")
|
||||
@GetMapping("/onRankings/{mapId}")
|
||||
public NewsContext<List<ModeOnHook>> onRankings(@PathVariable Integer mapId){
|
||||
public NewsContext<List<ModeOnHookRankingOV>> onRankings(@PathVariable Integer mapId,@CurrentPlayer Player player){
|
||||
|
||||
return NewsContext.onSuccess("查询成功",this.modeOnHookMapper.onRankings(mapId.toString()));
|
||||
return NewsContext.onSuccess("查询成功",this.modeOnHookMapper.onRankings(mapId.toString(),player.getPlayerId()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package cn.jisol.game.mapper;
|
||||
|
||||
import cn.jisol.game.entity.game.Player;
|
||||
import cn.jisol.game.entity.mode.ModeOnHook;
|
||||
import cn.jisol.game.vo.mode.ModeOnHookRankingOV;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
@ -13,7 +14,22 @@ import java.util.List;
|
||||
public interface ModeOnHookMapper extends BaseMapper<ModeOnHook> {
|
||||
|
||||
//排行榜
|
||||
@Select("SELECT * FROM mode_on_hook ORDER BY JSON_EXTRACT(on_hook_info, CONCAT('$.maps.\"',#{mapId},'\"')) DESC LIMIT 10;")
|
||||
List<ModeOnHook> onRankings(@Param("mapId") String mapId);
|
||||
@Select("SET @rank = 0;\n" +
|
||||
"SELECT \n" +
|
||||
" p.player_id,\n" +
|
||||
" p.player_name,\n" +
|
||||
" IFNULL(o.level_id,0) AS level_id,\n" +
|
||||
" o.rank,\n" +
|
||||
" #{mapId} AS map_id\n" +
|
||||
"FROM \n" +
|
||||
" (SELECT \n" +
|
||||
" player_id,\n" +
|
||||
" JSON_EXTRACT(on_hook_info, CONCAT('$.maps.\"',#{mapId},'\"')) AS level_id,\n" +
|
||||
" @rank := @rank + 1 AS rank\n" +
|
||||
" FROM mode_on_hook \n" +
|
||||
" ORDER BY JSON_EXTRACT(on_hook_info, CONCAT('$.maps.\"',#{mapId},'\"')) DESC) AS o\n" +
|
||||
"RIGHT JOIN player AS p ON o.player_id = p.player_id\n" +
|
||||
"WHERE o.player_id = #{playerId} OR o.rank < 11;")
|
||||
List<ModeOnHookRankingOV> onRankings(@Param("mapId") String mapId,@Param("playerId") Long playerId);
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package cn.jisol.game.vo.mode;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Builder
|
||||
@Data
|
||||
public class ModeOnHookRankingOV {
|
||||
private Long playerId; //游戏玩家Id
|
||||
private String playerName; //游戏玩家名称
|
||||
private Integer levelId; //玩家关卡Id
|
||||
private Integer rank; //玩家当前排名
|
||||
private Integer mapId; //地图Id
|
||||
}
|
@ -4,8 +4,8 @@ spring:
|
||||
datasource:
|
||||
username: pet_jisol_cn
|
||||
password: sThsBwjfDcaw2wJR
|
||||
url: jdbc:mysql://kyu.jisol.cn:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://localhost:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://kyu.jisol.cn:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
url: jdbc:mysql://localhost:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
jackson:
|
||||
serialization:
|
||||
|
Loading…
x
Reference in New Issue
Block a user