mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 10:16:14 +00:00
提交
This commit is contained in:
@@ -28,5 +28,11 @@
|
||||
"name": "钥匙:锻造石副本",
|
||||
"tig": "锻造石副本的钥匙",
|
||||
"args": ""
|
||||
},
|
||||
{
|
||||
"id": 90006,
|
||||
"name": "魂:一品宠物魂",
|
||||
"tig": "用于宠物升星",
|
||||
"args": ""
|
||||
}
|
||||
]
|
@@ -38,5 +38,85 @@
|
||||
{
|
||||
"grade": 10,
|
||||
"merge": 512
|
||||
},
|
||||
{
|
||||
"grade": 11,
|
||||
"merge": 1024
|
||||
},
|
||||
{
|
||||
"grade": 12,
|
||||
"merge": 2048
|
||||
},
|
||||
{
|
||||
"grade": 13,
|
||||
"merge": 4096
|
||||
},
|
||||
{
|
||||
"grade": 14,
|
||||
"merge": 8192
|
||||
},
|
||||
{
|
||||
"grade": 15,
|
||||
"merge": 16384
|
||||
},
|
||||
{
|
||||
"grade": 16,
|
||||
"merge": 32768
|
||||
},
|
||||
{
|
||||
"grade": 17,
|
||||
"merge": 65536
|
||||
},
|
||||
{
|
||||
"grade": 18,
|
||||
"merge": 131072
|
||||
},
|
||||
{
|
||||
"grade": 19,
|
||||
"merge": 262144
|
||||
},
|
||||
{
|
||||
"grade": 20,
|
||||
"merge": 524288
|
||||
},
|
||||
{
|
||||
"grade": 21,
|
||||
"merge": 1048576
|
||||
},
|
||||
{
|
||||
"grade": 22,
|
||||
"merge": 2097152
|
||||
},
|
||||
{
|
||||
"grade": 23,
|
||||
"merge": 4194304
|
||||
},
|
||||
{
|
||||
"grade": 24,
|
||||
"merge": 8388608
|
||||
},
|
||||
{
|
||||
"grade": 25,
|
||||
"merge": 16777216
|
||||
},
|
||||
{
|
||||
"grade": 26,
|
||||
"merge": 33554432
|
||||
},
|
||||
{
|
||||
"grade": 27,
|
||||
"merge": 67108864
|
||||
},
|
||||
{
|
||||
"grade": 28,
|
||||
"merge": 134217728
|
||||
},
|
||||
{
|
||||
"grade": 29,
|
||||
"merge": 268435456
|
||||
},
|
||||
{
|
||||
"grade": 30,
|
||||
"merge": 536870912
|
||||
}
|
||||
]
|
@@ -32,10 +32,13 @@
|
||||
},
|
||||
{
|
||||
"__id__": 12
|
||||
},
|
||||
{
|
||||
"__id__": 14
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 14
|
||||
"__id__": 16
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -130,8 +133,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 40
|
||||
"width": 55.60546875,
|
||||
"height": 50.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -173,7 +176,7 @@
|
||||
"_fontSize": 20,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 40,
|
||||
"_overflow": 1,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": false,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
@@ -216,7 +219,7 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"width": 85.60546875,
|
||||
"height": 40
|
||||
},
|
||||
"_anchorPoint": {
|
||||
@@ -289,7 +292,7 @@
|
||||
},
|
||||
"clickEvents": [],
|
||||
"_interactable": true,
|
||||
"_transition": 2,
|
||||
"_transition": 3,
|
||||
"_normalColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 214,
|
||||
@@ -345,6 +348,44 @@
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "fdfZMrUD5LeJ3JUsm5gbF3"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Layout",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 15
|
||||
},
|
||||
"_resizeMode": 1,
|
||||
"_layoutType": 1,
|
||||
"_cellSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 40,
|
||||
"height": 40
|
||||
},
|
||||
"_startAxis": 0,
|
||||
"_paddingLeft": 15,
|
||||
"_paddingRight": 15,
|
||||
"_paddingTop": 0,
|
||||
"_paddingBottom": 0,
|
||||
"_spacingX": 0,
|
||||
"_spacingY": 0,
|
||||
"_verticalDirection": 1,
|
||||
"_horizontalDirection": 0,
|
||||
"_constraint": 0,
|
||||
"_constraintNum": 2,
|
||||
"_affectedByScale": false,
|
||||
"_isAlign": false,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "baBTXQ6nBHCZceybmU4sDK"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
@@ -354,6 +395,7 @@
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "82Bvk1koJK0rGlT67CNSun",
|
||||
"instance": null,
|
||||
"targetOverrides": null
|
||||
}
|
||||
]
|
@@ -942,8 +942,8 @@
|
||||
"_paddingRight": 0,
|
||||
"_paddingTop": 0,
|
||||
"_paddingBottom": 0,
|
||||
"_spacingX": 0,
|
||||
"_spacingY": 0,
|
||||
"_spacingX": 5,
|
||||
"_spacingY": 5,
|
||||
"_verticalDirection": 1,
|
||||
"_horizontalDirection": 0,
|
||||
"_constraint": 0,
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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.118:8080`
|
||||
let WsPath = `ws://192.168.0.118:8080/websocket`
|
||||
// let APIPath = `http://192.168.0.118:8080`
|
||||
// let WsPath = `ws://192.168.0.118:8080/websocket`
|
||||
// let APIPath = `https://api.pet.jisol.cn`
|
||||
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
||||
|
||||
|
@@ -153,9 +153,7 @@ export const API = {
|
||||
/********** 宠物接口 ******************/
|
||||
GetPlayerPets: async () => RData(await app.api.get(`/game/pet/list`),false) as PlayerPetOV[], //获取玩家全部宠物
|
||||
//petId 需合成的Id pets 被合成的Id列表
|
||||
PetUpStar: async (petId:number,pets:number[]) => RData(await app.api.post(`/game/pet/up/star`,{petId,pets}),true) as PlayerPetOV, //提升宠物星
|
||||
//petId 升级的宠物Id
|
||||
PetUpLevel: async (petId:number) => RData(await app.api.post(`/game/pet/up/level/${petId}`),true) as PlayerPetOV, //升级宠物
|
||||
PetUpStar: async (petId:number,consume:number) => RData(await app.api.post(`/game/pet/up/star/${petId}/${consume}`),true) as PlayerPetOV, //提升宠物星
|
||||
|
||||
/********** 阵法接口 ******************/
|
||||
GetPlayerTactical: async () => RData(await app.api.get(`/game/tactical/get`),false) as PlayerTacticalOV, //获取玩家阵法
|
||||
|
@@ -26,7 +26,7 @@ export const GAPI = {
|
||||
//生成野怪
|
||||
GOnHookSpawnCreeps : async () => RProto(await app.api.get(`/game/mode/onHook/onSpawnCreeps`,{responseType:'arraybuffer'},false),GActionType.GOnHookPets) as GOnHookPets,
|
||||
//捕捉野怪
|
||||
GOnHookCatchCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onCatchCreeps/${creepId}`),true) as PlayerPetOV,
|
||||
GOnHookCatchCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onCatchCreeps/${creepId}`),true) as boolean,
|
||||
//出售野怪
|
||||
GOnHookSellCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onSellCreeps/${creepId}`),true) as boolean,
|
||||
//下一关
|
||||
|
@@ -98,23 +98,23 @@ export default class PlayerPetData extends BaseData{
|
||||
if(operation == ResourceUpdateType.UPDATE){
|
||||
//更新资源
|
||||
//找到需要被刷新的宠物 然后刷新 找不到则添加
|
||||
let pet = this.datas.filter(pet => pet.petId == resource.petId)[0];
|
||||
if(pet){
|
||||
let pet1 = this.datas.filter(pet => pet.petId == resource.petId)[0];
|
||||
if(pet1){
|
||||
//更新数据
|
||||
Object.assign(pet,resource);
|
||||
app.event.emit(PlayerPetEvent.UPDATE_INFO,pet)
|
||||
Object.assign(pet1,resource);
|
||||
app.event.emit(PlayerPetEvent.UPDATE_INFO,pet1)
|
||||
}else{
|
||||
operation = ResourceUpdateType.ADD;
|
||||
this.onUpdateOV(operation,resource);
|
||||
}
|
||||
}else if(operation == ResourceUpdateType.ADD){
|
||||
//查询如果没有这个宠物则添加 负责 刷新
|
||||
let pet = this.datas.filter(pet => pet.petId != resource.petId)[0];
|
||||
if(!pet){
|
||||
let pet1 = this.datas.filter(pet => pet.petId == resource.petId)[0];
|
||||
if(!pet1){
|
||||
//没有则添加
|
||||
this.datas.push(resource);
|
||||
app.event.emit(PlayerPetEvent.UPDATE)
|
||||
app.event.emit(PlayerPetEvent.UPDATE_ADD,pet)
|
||||
app.event.emit(PlayerPetEvent.UPDATE_ADD,resource)
|
||||
}else{
|
||||
operation = ResourceUpdateType.UPDATE;
|
||||
this.onUpdateOV(operation,resource);
|
||||
|
@@ -8,9 +8,12 @@ export enum ResourceEvent{
|
||||
|
||||
//资源类型
|
||||
export enum ResourceType{
|
||||
Gold = 90001, //金币
|
||||
ForgedStones = 90002, //锻造石
|
||||
SpeedUp = 90003, //加速卷
|
||||
Gold = 90001, //金币
|
||||
ForgedStones = 90002, //锻造石
|
||||
SpeedUp = 90003, //加速卷
|
||||
DungeonGold = 90004, //钥匙:金币副本
|
||||
DungeonForgedStones = 90005, //钥匙:锻造石副本
|
||||
Q1S = 90006, //魂:一品宠物魂
|
||||
}
|
||||
|
||||
//资源刷新类型
|
||||
|
@@ -52,8 +52,6 @@ export default class GOnHookManager extends Singleton{
|
||||
|
||||
//需要捕捉的宠物
|
||||
onHookCatchPets:TB.TbGRole[] = [];
|
||||
//需要主动吞噬的宠物 (主动吞噬其他 0星 宠物 升星)
|
||||
onHookEngulfPets:PlayerPetOV[] = [];
|
||||
|
||||
//是否挂机
|
||||
_isOnHook:boolean = false;
|
||||
@@ -93,21 +91,6 @@ export default class GOnHookManager extends Singleton{
|
||||
await this.onSellCreeps(pet)
|
||||
}
|
||||
}
|
||||
|
||||
//自动吞噬
|
||||
for (const item of this.onHookEngulfPets) {
|
||||
|
||||
//获取可吞噬的宠物 ( 等级0, 同类宠物, 不是自己, 不在阵法中)
|
||||
let engulfs = PlayerPetData.getIns().getData()
|
||||
.filter(value => (value.petStar || 0) == 0 && item.petTbId == value.petTbId && item.petId != value.petId && PlayerTacticalData.getIns().getItemIndex(value.petId) != -1)
|
||||
.map(value => value.petId);
|
||||
|
||||
//吞噬
|
||||
if(engulfs.length){
|
||||
await API.PetUpStar(item.petId,engulfs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}).bind(this))
|
||||
|
||||
@@ -161,14 +144,7 @@ export default class GOnHookManager extends Singleton{
|
||||
//通知添加野怪被删除
|
||||
app.event.emit(GOnHookManagerEvent.DEL_KILL_SREEP,creeps);
|
||||
|
||||
let pet:PlayerPetOV = await GAPI.GOnHookCatchCreeps(creeps.key);
|
||||
|
||||
//保存宠物
|
||||
if(pet){
|
||||
PlayerPetData.getIns().addPet(pet);
|
||||
}
|
||||
|
||||
return !!pet;
|
||||
return !!await GAPI.GOnHookCatchCreeps(creeps.key);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -4,23 +4,18 @@ import JNScrollView from '../../../../extensions/ngame/assets/ngame/util/compone
|
||||
import PlayerPetData, { PlayerPetEvent } from '../../data/PlayerPetData';
|
||||
import { API, PlayerPetOV } from '../../consts/API';
|
||||
import { PetOV, PlayerPetOVSelect } from '../VO/PetOV';
|
||||
import { PetIconSelectScroll } from '../Consts/Pet/PetIconSelectScroll';
|
||||
import { NodeEventType } from 'cc';
|
||||
import { Label } from 'cc';
|
||||
import { app, TD } from '../../App';
|
||||
import { GUI } from '../UIConfig';
|
||||
import { ProgressBar } from 'cc';
|
||||
import JProgressBar from '../../../../extensions/ngame/assets/ngame/util/components/Progress/JProgressBar';
|
||||
import { Toggle } from 'cc';
|
||||
import GOnHookManager from '../../manager/battle/mode/GOnHookManager';
|
||||
import { Slider } from 'cc';
|
||||
import ResourceData, { ResourceType } from '../../data/ResourceData';
|
||||
import { GUI } from '../UIConfig';
|
||||
import { PetPreviewWindow } from '../Consts/Pet/info/PetPreviewWindow';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('PetUpStarView')
|
||||
export class PetUpStarView extends JNLayerBase {
|
||||
|
||||
@property(JNScrollView)
|
||||
views:JNScrollView; //宠物列表
|
||||
|
||||
@property(Label)
|
||||
petNameLabel:Label; //宠物名称
|
||||
@property(Label)
|
||||
@@ -32,8 +27,27 @@ export class PetUpStarView extends JNLayerBase {
|
||||
@property(JProgressBar)
|
||||
viewPetExpProgress:JProgressBar; //预览宠物经验条
|
||||
|
||||
@property(Toggle)
|
||||
isEngulfToggle:Toggle; //是否主动吞噬 0 星 宠物
|
||||
@property(PetPreviewWindow)
|
||||
petPreview:PetPreviewWindow; //宠物显示窗口
|
||||
|
||||
@property(Slider)
|
||||
slider:Slider; //滑块
|
||||
|
||||
@property(Label)
|
||||
qsLabel:Label; //魂数量
|
||||
|
||||
//消耗数量
|
||||
_consume:number = 0;
|
||||
get consume(){
|
||||
return Math.min(ResourceData.getIns().getValue(ResourceType.Q1S),this._consume);
|
||||
}
|
||||
set consume(value:number){
|
||||
let max = ResourceData.getIns().getValue(ResourceType.Q1S);
|
||||
this._consume = value;
|
||||
//修正
|
||||
this.slider.progress = this.consume / max;
|
||||
this.qsLabel.string = `${ResourceData.getIns().getValue(ResourceType.Q1S) - this.consume}`
|
||||
}
|
||||
|
||||
data:PlayerPetOV;
|
||||
|
||||
@@ -45,39 +59,20 @@ export class PetUpStarView extends JNLayerBase {
|
||||
|
||||
//监听
|
||||
app.event.on(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this); //刷新宠物信息
|
||||
app.event.on(PlayerPetEvent.UPDATE_MINUS,this.onPetMinus,this); //减少宠物
|
||||
|
||||
}
|
||||
|
||||
onJNClose(): void {
|
||||
//取消监听
|
||||
app.event.off(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this); //刷新宠物信息
|
||||
app.event.off(PlayerPetEvent.UPDATE_MINUS,this.onPetMinus,this); //减少宠物
|
||||
}
|
||||
|
||||
|
||||
//刷新页面
|
||||
onUpdateView(){
|
||||
|
||||
//显示选中宠物
|
||||
this.petPreview.bind(this.data);
|
||||
this.onUpdateInfo();
|
||||
|
||||
//当前需要升星的宠物并且未上阵 并且排除自己
|
||||
let pets = PetOV.PlayerPetOVSelects(
|
||||
PlayerPetData.getIns().getPetIdData(
|
||||
this.data.petTbId, //同一种宠物
|
||||
PlayerPetData.getIns().getNoTacticalData() //非上阵宠物
|
||||
).filter(pet => pet.petId != this.data.petId) //排除自己
|
||||
);
|
||||
this.views.refreshData(pets);
|
||||
|
||||
//向子节点添加点击事件
|
||||
this.views.addItemEvent(NodeEventType.TOUCH_START,this.onClickItem.bind(this));
|
||||
|
||||
this.onUpdateSelect();
|
||||
|
||||
//更新吞噬
|
||||
this.isEngulfToggle.isChecked = GOnHookManager.getIns().onHookEngulfPets.indexOf(this.data) >= 0;
|
||||
|
||||
}
|
||||
|
||||
//刷新信息
|
||||
@@ -91,37 +86,15 @@ export class PetUpStarView extends JNLayerBase {
|
||||
this.petStarExp.string = `升级进度: ${upStarExp} / ${this.data.petStarExp}`;
|
||||
this.petExpProgress.value = this.data.petStar + (this.data.petStarExp / upStarExp);
|
||||
|
||||
}
|
||||
|
||||
//减少宠物
|
||||
onPetMinus(pet:PlayerPetOV){
|
||||
this.views.getItems<PetIconSelectScroll>().forEach(item => {
|
||||
if(item.data.petId == pet.petId)
|
||||
this.views.delData(item.data);
|
||||
});
|
||||
}
|
||||
|
||||
//刷新选择
|
||||
onUpdateSelect(){
|
||||
|
||||
//刷新
|
||||
this.views.getItems<PetIconSelectScroll>().forEach((item) => {
|
||||
let data = item.data as PlayerPetOVSelect;
|
||||
item.select.isSelect = data.isSelect;
|
||||
})
|
||||
|
||||
this.onUpdatePreview();
|
||||
this.qsLabel.string = `${ResourceData.getIns().getValue(ResourceType.Q1S) - this.consume}`
|
||||
|
||||
}
|
||||
|
||||
//更新预览进度条
|
||||
onUpdatePreview(){
|
||||
|
||||
//选择得到的经验
|
||||
let exp = this.views.getItems<PetIconSelectScroll>().filter(item => item.select.isSelect).length;
|
||||
|
||||
let upStarExp;
|
||||
let petStarExp = this.data.petStarExp + exp;
|
||||
let petStarExp = this.data.petStarExp + this.consume;
|
||||
let petStar = this.data.petStar;
|
||||
|
||||
while(petStarExp >= (upStarExp = TD.TbGRoleUpStar.get(petStar + 1).merge)){
|
||||
@@ -133,50 +106,41 @@ export class PetUpStarView extends JNLayerBase {
|
||||
this.petStarExp.string = `升级进度: ${upStarExp} / ${petStarExp}`;
|
||||
//预览进度
|
||||
this.viewPetExpProgress.value = petStar + (petStarExp / upStarExp);
|
||||
this.qsLabel.string = `${ResourceData.getIns().getValue(ResourceType.Q1S) - this.consume}`
|
||||
|
||||
}
|
||||
|
||||
//滑动滑块
|
||||
onSliderMove(slider: Slider){
|
||||
|
||||
let max = ResourceData.getIns().getValue(ResourceType.Q1S);
|
||||
if(!max){
|
||||
this.consume = 0;
|
||||
return;
|
||||
}
|
||||
this.consume = Math.ceil(max * slider.progress);
|
||||
|
||||
this.onUpdatePreview();
|
||||
|
||||
}
|
||||
|
||||
//选择全部
|
||||
onClickAll(){
|
||||
let pets = this.views.getData<PlayerPetOVSelect>();
|
||||
//如果全部选择则全部取消
|
||||
if(pets.filter(pet => pet.isSelect).length == pets.length){
|
||||
pets.forEach(pet => pet.isSelect = false);
|
||||
}else{
|
||||
pets.forEach(pet => pet.isSelect = true);
|
||||
}
|
||||
this.onUpdateSelect();
|
||||
}
|
||||
|
||||
//点击Item
|
||||
onClickItem(index:number){
|
||||
let pets = this.views.getData<PlayerPetOVSelect>();
|
||||
pets[index].isSelect = !pets[index].isSelect;
|
||||
this.onUpdateSelect();
|
||||
}
|
||||
|
||||
//点击合成
|
||||
async onClickUp(){
|
||||
|
||||
//获取被合成的Id
|
||||
let pets = this.views.getData<PlayerPetOVSelect>().filter(pet => pet.isSelect).map(pet => pet.petId);
|
||||
|
||||
if(pets.length <= 0){
|
||||
app.layer.Open(GUI.Tips,{text:"请选择需要被合成的宠物"});
|
||||
if(!this.consume){
|
||||
app.layer.Open(GUI.Tips,{text:"拖拽进行升星吧~"})
|
||||
return;
|
||||
}
|
||||
|
||||
await API.PetUpStar(this.data.petId,pets);
|
||||
await API.PetUpStar(this.data.petId,this.consume);
|
||||
this.consume = 0;
|
||||
|
||||
}
|
||||
|
||||
//点击吞噬选择
|
||||
onClickEngulfToggle(){
|
||||
GOnHookManager.getIns().onHookEngulfPets.splice(GOnHookManager.getIns().onHookEngulfPets.indexOf(this.data),1);
|
||||
if(this.isEngulfToggle.isChecked){
|
||||
GOnHookManager.getIns().onHookEngulfPets.push(this.data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -193,17 +193,6 @@ export class IntoBattleView extends JNLayerBase {
|
||||
|
||||
}
|
||||
|
||||
//点击升级
|
||||
async onClickUpLevel(){
|
||||
if(this.index < 0){
|
||||
app.layer.Open(GUI.Tips,{text:"请选择宠物."})
|
||||
return;
|
||||
}
|
||||
await API.PetUpLevel(this.pets[this.index].petId)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user