mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 18:26:23 +00:00
提交开宝箱
This commit is contained in:
@@ -32,10 +32,10 @@ import { Component } from "cc";
|
||||
// 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.119:8080`
|
||||
let WsPath = `ws://192.168.0.119:8080/websocket`
|
||||
// let APIPath = `https://api.pet.jisol.cn`
|
||||
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
||||
// let APIPath = `http://192.168.0.119:8080`
|
||||
// let WsPath = `ws://192.168.0.119:8080/websocket`
|
||||
let APIPath = `https://api.pet.jisol.cn`
|
||||
let WsPath = `wss://api.pet.jisol.cn/websocket`
|
||||
|
||||
//重写UI
|
||||
class JNGLayer extends JNLayer{
|
||||
|
@@ -2,6 +2,7 @@ import SystemBase from "../../extensions/ngame/assets/ngame/system/SystemBase";
|
||||
import { app } from "./App";
|
||||
import BaseData from "./data/BaseData";
|
||||
import ChatData from "./data/ChatData";
|
||||
import GBattleData from "./data/GBattleData";
|
||||
import GOnHookData from "./data/GOnHookData";
|
||||
import PetEquipData from "./data/PetEquipData";
|
||||
import PlayerData from "./data/PlayerData";
|
||||
@@ -22,6 +23,7 @@ export class AppData extends SystemBase{
|
||||
ResourceData.getIns(), //玩家资源
|
||||
GOnHookData.getIns(), //无限模式信息类 (无限模式是游戏基础模式玩法 需要默认信息)
|
||||
PetEquipData.getIns(), //宠物装备数据类
|
||||
GBattleData.getIns(), //战斗数据(永远最后)
|
||||
];
|
||||
|
||||
async onInit(): Promise<any> {
|
||||
|
@@ -15,6 +15,7 @@ import NOV2DSimple from "../../../../../extensions/ngame/assets/ngame/util/colli
|
||||
import NOVBase from "../../../../../extensions/ngame/assets/ngame/util/collide/OV/NOVBase";
|
||||
import { BoxCollider2D } from "cc";
|
||||
import { Vec3 } from "cc";
|
||||
import GAttribute from "../values/attribute/GAttribute";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
export enum GRoleAnimEvent{
|
||||
@@ -204,7 +205,7 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
}
|
||||
|
||||
//生效数值
|
||||
onEffectiveValue(...values:GAttributeBase[]){
|
||||
onEffectiveValues(...values:GAttributeBase[]){
|
||||
|
||||
this.values.reset();
|
||||
values.forEach(value => {
|
||||
@@ -217,6 +218,17 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
|
||||
}
|
||||
|
||||
//生效属性
|
||||
onEffectiveValue(data:GAttribute){
|
||||
|
||||
this.values.reset(data);
|
||||
this.values.update();
|
||||
|
||||
//赋值血量
|
||||
this.blood = this.fullBlood = this.values.onBlood();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,87 @@
|
||||
import { TD, app } from "../../../App";
|
||||
import { PetEquip, PlayerPetOV } from "../../../consts/API";
|
||||
import GRoleValues from "./GRoleValues";
|
||||
import GAttribute from "./attribute/GAttribute";
|
||||
import GPetAttribute from "./attribute/role/GPetAttribute";
|
||||
import GPetEquipAttribute from "./attribute/role/GPetEquipAttribute";
|
||||
|
||||
//战斗传入数据
|
||||
export interface GBattleDataInfo{
|
||||
//宠物
|
||||
pets?:PlayerPetOV[],
|
||||
//宠物装备
|
||||
petEquips?:PetEquip[]
|
||||
}
|
||||
|
||||
export enum GBattleDataEnum{
|
||||
UPDATE = "GBattleData_UPDATE"
|
||||
}
|
||||
|
||||
//战斗数据类
|
||||
export default class GAttributeData{
|
||||
|
||||
info:GBattleDataInfo;
|
||||
isEmit:boolean;
|
||||
|
||||
constructor(info:GBattleDataInfo = {},isEmit:boolean = false){
|
||||
this.isEmit = isEmit;
|
||||
this.update(info);
|
||||
}
|
||||
|
||||
update(info:GBattleDataInfo){
|
||||
//初始化数据
|
||||
info.pets = info.pets || [];
|
||||
info.petEquips = info.petEquips || [];
|
||||
this.info = info;
|
||||
if(this.isEmit)
|
||||
app.event.emit(GBattleDataEnum.UPDATE)
|
||||
}
|
||||
|
||||
assets(info:GBattleDataInfo){
|
||||
Object.assign(this.info,info);
|
||||
if(this.isEmit)
|
||||
app.event.emit(GBattleDataEnum.UPDATE)
|
||||
}
|
||||
|
||||
//计算总战力数值
|
||||
getAllFC(){
|
||||
let fc = 0;
|
||||
Object.values(this.info.pets).forEach(pet => {
|
||||
let attribute = this.getPetAttribute(pet.petId);
|
||||
//计算战力
|
||||
fc += GAttributeData.FC(attribute);
|
||||
})
|
||||
return fc;
|
||||
}
|
||||
|
||||
//获取共享属性
|
||||
|
||||
//获取指定宠物的属性
|
||||
getPetAttribute(petId:number){
|
||||
let pet = this.info.pets.filter(item => item.petId == petId)[0];
|
||||
if(!pet) return new GAttribute();
|
||||
|
||||
let value = new GAttribute();
|
||||
value.add(new GPetAttribute(pet));
|
||||
value.add(new GPetEquipAttribute(this.info.petEquips.filter(item => item.equipPetId == petId)));
|
||||
value.update();
|
||||
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
//根据属性计算战力
|
||||
static FC(info:GAttribute){
|
||||
|
||||
let fc = 0;
|
||||
|
||||
TD.TbGAttribute.getDataList().forEach(item => {
|
||||
let value = info.info[item.id] || 0;
|
||||
fc += TD.TbGAttributeFC.get(item.id).value * value;
|
||||
})
|
||||
|
||||
return fc;
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "8bc8ee57-3c3f-4e5c-8a0b-9e553ec4cd17",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -25,9 +25,9 @@ export default class GRoleValues {
|
||||
}
|
||||
|
||||
//重置
|
||||
reset(){
|
||||
reset(attribute:GAttribute = new GAttribute()){
|
||||
//初始化属性
|
||||
this.attribute = new GAttribute();
|
||||
this.attribute = attribute;
|
||||
this.update();
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,49 @@
|
||||
import { TD } from "../../../../../App";
|
||||
import { PetEquip, PlayerPetOV } from "../../../../../consts/API";
|
||||
import GAttributeBase from "../GAttributeBase";
|
||||
|
||||
//宠物装备属性
|
||||
export default class GPetEquipAttribute extends GAttributeBase{
|
||||
|
||||
//宠物信息
|
||||
equips:PetEquip[];
|
||||
|
||||
constructor(equips:PetEquip[]){
|
||||
|
||||
super();
|
||||
this.equips = equips;
|
||||
|
||||
//固定属性直接计算
|
||||
this.compute();
|
||||
|
||||
}
|
||||
|
||||
//计算属性
|
||||
compute(){
|
||||
|
||||
this.attributes = {};
|
||||
|
||||
//获取全部属性信息
|
||||
TD.TbGAttribute.getDataList().forEach(attr => {
|
||||
//默认 0
|
||||
this.attributes[attr.id] = 0;
|
||||
});
|
||||
|
||||
//*************** 宠物初始属性 **************************
|
||||
this.equips.forEach(equip => {
|
||||
equip.equipBaseAttributes.forEach(attr => {
|
||||
this.attributes[attr.id] += attr.value
|
||||
})
|
||||
equip.equipHighAttributes.forEach(attr => {
|
||||
this.attributes[attr.id] += attr.value
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
//刷新属性
|
||||
update(): void { }
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "e519d154-ce31-4752-8b3f-d28b3b9628f4",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -27,6 +27,8 @@ import GPetAttribute from "../base/values/attribute/role/GPetAttribute";
|
||||
import GDefaultMode from "./default/GDefaultMode";
|
||||
import GOnHookData from "../../data/GOnHookData";
|
||||
import { GModeEvent, GModeHitInfo } from "./GMode";
|
||||
import GAttributeData from "../base/values/GAttributeData";
|
||||
import GBattleData, { GBattleDataEnum } from "../../data/GBattleData";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//挂机模式状态
|
||||
@@ -103,12 +105,14 @@ export default class GOnHookMode extends GDefaultMode<{},{}>{
|
||||
//添加监听事件
|
||||
addEvent(){
|
||||
app.event.on(PlayerTacticalEvent.UPDATE_TACTICAL,this.onUpdatePlayerPet,this);
|
||||
app.event.on(GBattleDataEnum.UPDARE_ATTRIBUTE_SUCCESS,this.onUpdateAttribute,this);
|
||||
// app.event.on(GOnHookManagerEvent.UPDATE_MAP,this.onUpdateWorld,this);
|
||||
}
|
||||
//移除监听事件
|
||||
onDestroy(){
|
||||
super.onDestroy();
|
||||
app.event.off(PlayerTacticalEvent.UPDATE_TACTICAL,this.onUpdatePlayerPet,this);
|
||||
app.event.off(GBattleDataEnum.UPDARE_ATTRIBUTE_SUCCESS,this.onUpdateAttribute,this);
|
||||
// app.event.off(GOnHookManagerEvent.UPDATE_MAP,this.onUpdateWorld,this);
|
||||
}
|
||||
|
||||
@@ -188,6 +192,15 @@ export default class GOnHookMode extends GDefaultMode<{},{}>{
|
||||
|
||||
}
|
||||
|
||||
//更新属性
|
||||
onUpdateAttribute(){
|
||||
|
||||
this.getOnesRole(GOnHookModePlayerEnum.PLAYER).forEach(pet => {
|
||||
pet.onEffectiveValue(GBattleData.getIns().data.getPetAttribute(pet.getComponent(GRoleOnHookPlayerExpand).petId));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//更新帧
|
||||
onSyncUpdate(dt: number,frame:JNFrameInfo, input?: {}){
|
||||
super.onSyncUpdate(dt,frame,input);
|
||||
@@ -247,7 +260,7 @@ export default class GOnHookMode extends GDefaultMode<{},{}>{
|
||||
expand.petId = petId;
|
||||
|
||||
//添加宠物属性
|
||||
role.onEffectiveValue(new GPetAttribute(info));
|
||||
role.onEffectiveValue(GBattleData.getIns().data.getPetAttribute(petId));
|
||||
|
||||
}
|
||||
|
||||
@@ -261,7 +274,7 @@ export default class GOnHookMode extends GDefaultMode<{},{}>{
|
||||
expand.creeps = creeps;
|
||||
|
||||
//添加野怪属性
|
||||
role.onEffectiveValue(new GPetAttribute({
|
||||
role.onEffectiveValues(new GPetAttribute({
|
||||
petId:0,
|
||||
petPlayerId:0,
|
||||
petTbId:creeps.petTbId,
|
||||
@@ -381,6 +394,7 @@ export default class GOnHookMode extends GDefaultMode<{},{}>{
|
||||
JNFrameTime.getInstance().setTimeout(() => {
|
||||
if(role.isValid)
|
||||
role.node.destroy()
|
||||
else console.log(role,"无法销毁");
|
||||
},3000)
|
||||
|
||||
//清理
|
||||
|
@@ -145,7 +145,7 @@ export default class GPVPMode extends GBaseMode<{},GPVPStart>{
|
||||
entity.addKillBackEvent(this.onRoleKillBack.bind(this))
|
||||
|
||||
//添加宠物属性
|
||||
entity.onEffectiveValue(new GPetAttribute(info));
|
||||
entity.onEffectiveValues(new GPetAttribute(info));
|
||||
|
||||
this.addGObject(entity,tactical.getPosition(index));
|
||||
this.getOnesRole(type).push(entity);
|
||||
|
@@ -504,6 +504,33 @@ export class TbGAttribute {
|
||||
}
|
||||
|
||||
|
||||
export namespace TB {
|
||||
export class TbGAttributeFC {
|
||||
|
||||
constructor(_json_: any) {
|
||||
if (_json_.id === undefined) { throw new Error() }
|
||||
this.id = _json_.id
|
||||
if (_json_.value === undefined) { throw new Error() }
|
||||
this.value = _json_.value
|
||||
}
|
||||
|
||||
/**
|
||||
* 对应属性Id
|
||||
*/
|
||||
readonly id: number
|
||||
/**
|
||||
* 战力
|
||||
*/
|
||||
readonly value: number
|
||||
|
||||
resolve(tables:Tables)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export namespace TB {
|
||||
export class TbGRoleBaseAttribute {
|
||||
|
||||
@@ -834,7 +861,7 @@ export class TbGRoleEquipLevel {
|
||||
*/
|
||||
readonly id: number
|
||||
/**
|
||||
* 下一级所需经验
|
||||
* 所需经验
|
||||
*/
|
||||
readonly exp: number
|
||||
|
||||
@@ -1331,6 +1358,38 @@ export class TbGAttribute{
|
||||
|
||||
|
||||
|
||||
export class TbGAttributeFC{
|
||||
private _dataMap: Map<number, TB.TbGAttributeFC>
|
||||
private _dataList: TB.TbGAttributeFC[]
|
||||
constructor(_json_: any) {
|
||||
this._dataMap = new Map<number, TB.TbGAttributeFC>()
|
||||
this._dataList = []
|
||||
for(var _json2_ of _json_) {
|
||||
let _v: TB.TbGAttributeFC
|
||||
_v = new TB.TbGAttributeFC(_json2_)
|
||||
this._dataList.push(_v)
|
||||
this._dataMap.set(_v.id, _v)
|
||||
}
|
||||
}
|
||||
|
||||
getDataMap(): Map<number, TB.TbGAttributeFC> { return this._dataMap; }
|
||||
getDataList(): TB.TbGAttributeFC[] { return this._dataList; }
|
||||
|
||||
get(key: number): TB.TbGAttributeFC | undefined { return this._dataMap.get(key); }
|
||||
|
||||
resolve(tables:Tables)
|
||||
{
|
||||
for(let data of this._dataList)
|
||||
{
|
||||
data.resolve(tables)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export class TbGRoleBaseAttribute{
|
||||
private _dataMap: Map<number, TB.TbGRoleBaseAttribute>
|
||||
private _dataList: TB.TbGRoleBaseAttribute[]
|
||||
@@ -1646,6 +1705,8 @@ export class Tables {
|
||||
get TbSServerInfo(): TbSServerInfo { return this._TbSServerInfo;}
|
||||
private _TbGAttribute: TbGAttribute
|
||||
get TbGAttribute(): TbGAttribute { return this._TbGAttribute;}
|
||||
private _TbGAttributeFC: TbGAttributeFC
|
||||
get TbGAttributeFC(): TbGAttributeFC { return this._TbGAttributeFC;}
|
||||
private _TbGRoleBaseAttribute: TbGRoleBaseAttribute
|
||||
get TbGRoleBaseAttribute(): TbGRoleBaseAttribute { return this._TbGRoleBaseAttribute;}
|
||||
private _TbGOnHookMaps: TbGOnHookMaps
|
||||
@@ -1678,6 +1739,7 @@ export class Tables {
|
||||
this._TbGRoleUpGrow = new TbGRoleUpGrow(loader('tbgroleupgrow'))
|
||||
this._TbSServerInfo = new TbSServerInfo(loader('tbsserverinfo'))
|
||||
this._TbGAttribute = new TbGAttribute(loader('tbgattribute'))
|
||||
this._TbGAttributeFC = new TbGAttributeFC(loader('tbgattributefc'))
|
||||
this._TbGRoleBaseAttribute = new TbGRoleBaseAttribute(loader('tbgrolebaseattribute'))
|
||||
this._TbGOnHookMaps = new TbGOnHookMaps(loader('tbgonhookmaps'))
|
||||
this._TbGOnHookMap120001 = new TbGOnHookMap120001(loader('tbgonhookmap120001'))
|
||||
@@ -1700,6 +1762,7 @@ export class Tables {
|
||||
this._TbGRoleUpGrow.resolve(this)
|
||||
this._TbSServerInfo.resolve(this)
|
||||
this._TbGAttribute.resolve(this)
|
||||
this._TbGAttributeFC.resolve(this)
|
||||
this._TbGRoleBaseAttribute.resolve(this)
|
||||
this._TbGOnHookMaps.resolve(this)
|
||||
this._TbGOnHookMap120001.resolve(this)
|
||||
|
39
JisolGameCocos/assets/script/data/GBattleData.ts
Normal file
39
JisolGameCocos/assets/script/data/GBattleData.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { app } from "../App";
|
||||
import GAttributeData, { GBattleDataInfo } from "../battle/base/values/GAttributeData";
|
||||
import BaseData from "./BaseData";
|
||||
import PetEquipData from "./PetEquipData";
|
||||
import PlayerPetData from "./PlayerPetData";
|
||||
|
||||
export enum GBattleDataEnum{
|
||||
UPDARE_ATTRIBUTE = "GBattleDataEnum_UPDARE_ATTRIBUTE", //更新属性
|
||||
UPDARE_ATTRIBUTE_SUCCESS = "GBattleDataEnum_UPDARE_ATTRIBUTE_SUCCESS", //更新成功
|
||||
}
|
||||
|
||||
//游戏战斗数据
|
||||
export default class GBattleData extends BaseData{
|
||||
|
||||
//自己的战斗数据
|
||||
data:GAttributeData = new GAttributeData();
|
||||
|
||||
onInit() {
|
||||
this.onUpdateAttribute();
|
||||
app.event.on(GBattleDataEnum.UPDARE_ATTRIBUTE,this.onUpdateAttribute,this);
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
app.event.off(GBattleDataEnum.UPDARE_ATTRIBUTE,this.onUpdateAttribute,this);
|
||||
}
|
||||
|
||||
//刷新属性
|
||||
onUpdateAttribute(){
|
||||
this.data.assets({
|
||||
petEquips:PetEquipData.getIns().equips,
|
||||
pets:PlayerPetData.getIns().getTacticalData()
|
||||
})
|
||||
|
||||
app.event.emit(GBattleDataEnum.UPDARE_ATTRIBUTE_SUCCESS)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
9
JisolGameCocos/assets/script/data/GBattleData.ts.meta
Normal file
9
JisolGameCocos/assets/script/data/GBattleData.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "a403abff-7b31-45c9-9ba9-5eb00b64c86c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -1,11 +1,12 @@
|
||||
import { app } from "../App";
|
||||
import GBattleData, { GBattleDataInfo } from "../battle/base/values/GAttributeData";
|
||||
import { API } from "../consts/API";
|
||||
import { GAPI, ModeOnHookOV } from "../consts/GAPI";
|
||||
import { GUI } from "../ui/UIConfig";
|
||||
import BaseData from "./BaseData";
|
||||
|
||||
export enum GOnHookDataEnum{
|
||||
UPDATE = "GOnHookDataEnum_UPDATE" //刷新信息
|
||||
UPDATE = "GOnHookDataEnum_UPDATE", //刷新信息
|
||||
}
|
||||
|
||||
//无限模式数据类
|
||||
@@ -22,6 +23,7 @@ export default class GOnHookData extends BaseData{
|
||||
async onInit() {
|
||||
await this.onUpdateInfo();
|
||||
console.log("GOnHookData Info",this.info);
|
||||
|
||||
}
|
||||
|
||||
//刷新数据
|
||||
|
@@ -3,6 +3,8 @@ import { TD, app } from "../App";
|
||||
import { API, EquipForgingBench, PetEquip } from "../consts/API";
|
||||
import { GUI } from "../ui/UIConfig";
|
||||
import BaseData from "./BaseData";
|
||||
import { GBattleDataEnum } from "./GBattleData";
|
||||
import GOnHookData from "./GOnHookData";
|
||||
import PlayerPetData from "./PlayerPetData";
|
||||
|
||||
export enum PetEquipDataEnum{
|
||||
@@ -34,8 +36,15 @@ export default class PetEquipData extends BaseData{
|
||||
}
|
||||
|
||||
async onInit() {
|
||||
this.equips = await API.PetEquipAll();
|
||||
this.onUpdateInfo(await API.PetEquipForgingInfo())
|
||||
this.onUpdateEquips(await API.PetEquipAll());
|
||||
this.onUpdateInfo(await API.PetEquipForgingInfo());
|
||||
}
|
||||
|
||||
//更新装备
|
||||
onUpdateEquips(equips:PetEquip[]){
|
||||
this.equips = equips;
|
||||
|
||||
app.event.emit(GBattleDataEnum.UPDARE_ATTRIBUTE); //刷新属性
|
||||
}
|
||||
|
||||
//更新锻造数据
|
||||
@@ -50,8 +59,10 @@ export default class PetEquipData extends BaseData{
|
||||
//锻造
|
||||
async forging(){
|
||||
let info = await API.PetEquipForging();
|
||||
this.onUpdateInfo(info.info);
|
||||
return this.addEquip(info.equip);
|
||||
if(info){
|
||||
this.onUpdateInfo(info.info);
|
||||
return this.addEquip(info.equip);
|
||||
}else return null;
|
||||
}
|
||||
|
||||
//添加装备
|
||||
@@ -84,6 +95,8 @@ export default class PetEquipData extends BaseData{
|
||||
})
|
||||
Object.assign(equip,info);
|
||||
app.event.emit(PetEquipDataEnum.UPDATE_EQUIP);
|
||||
|
||||
app.event.emit(GBattleDataEnum.UPDARE_ATTRIBUTE); //刷新属性
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
import { app } from "../App";
|
||||
import { API, PlayerInfoOV, PlayerPetOV } from "../consts/API";
|
||||
import BaseData from "./BaseData";
|
||||
import { GBattleDataEnum } from "./GBattleData";
|
||||
import GOnHookData from "./GOnHookData";
|
||||
import PlayerTacticalData from "./PlayerTacticalData";
|
||||
import { ResourceUpdateType } from "./ResourceData";
|
||||
|
||||
@@ -39,10 +41,17 @@ export default class PlayerPetData extends BaseData{
|
||||
return this.datas.filter(data => PlayerTacticalData.getIns().getTacticalInfo().indexOf(data.petId) < 0);
|
||||
}
|
||||
|
||||
//获取上阵的宠物
|
||||
getTacticalData():PlayerPetOV[]{
|
||||
return this.datas.filter(data => PlayerTacticalData.getIns().getTacticalInfo().indexOf(data.petId) >= 0);
|
||||
}
|
||||
|
||||
//更新玩家宠物
|
||||
async UpdatePlayerPet(){
|
||||
//获取全部宠物
|
||||
this.datas = await API.GetPlayerPets();
|
||||
|
||||
app.event.emit(GBattleDataEnum.UPDARE_ATTRIBUTE); //刷新属性
|
||||
}
|
||||
|
||||
//选择宠物
|
||||
|
@@ -1,6 +1,8 @@
|
||||
import { app } from "../App";
|
||||
import { API, PlayerTacticalOV } from "../consts/API";
|
||||
import BaseData from "./BaseData";
|
||||
import { GBattleDataEnum } from "./GBattleData";
|
||||
import GOnHookData from "./GOnHookData";
|
||||
import PlayerPetData from "./PlayerPetData";
|
||||
|
||||
export enum PlayerTacticalEvent{
|
||||
@@ -34,9 +36,12 @@ export default class PlayerTacticalData extends BaseData{
|
||||
...ov,
|
||||
roles: JSON.parse(ov.tacticalData).map(id => PlayerPetData.getIns().petIdQueryPetInfo(id) ? id : 0),
|
||||
}
|
||||
|
||||
app.event.emit(GBattleDataEnum.UPDARE_ATTRIBUTE); //刷新属性
|
||||
|
||||
//通知阵法信息已更新
|
||||
app.event.emit(PlayerTacticalEvent.UPDATE_TACTICAL);
|
||||
|
||||
}
|
||||
|
||||
//更新阵法信息
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "3f2e01bd-60eb-4e48-a26c-06b4a91283e6",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { GAttribute } from '../../../../consts/entity/EntityData';
|
||||
import JNScrollViewItem from '../../../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollViewItem';
|
||||
import { Label } from 'cc';
|
||||
import { TD } from '../../../../App';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('PetEquipAttributeItem')
|
||||
export class PetEquipAttributeItem extends JNScrollViewItem<GAttribute> {
|
||||
|
||||
//名称
|
||||
@property(Label)
|
||||
attributeName:Label;
|
||||
|
||||
//值
|
||||
@property(Label)
|
||||
attributeValue:Label;
|
||||
|
||||
onInit(){
|
||||
|
||||
this.attributeName.string = TD.TbGAttribute.get(this.data.id).name+":";
|
||||
this.attributeValue.string = `${this.data.value}`;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "8ce0b443-3cd1-4546-8143-b6f7c2b745f4",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { PetEquip } from '../../../../consts/API';
|
||||
import JNScrollView from '../../../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('PetEquipAttributeView')
|
||||
export class PetEquipAttributeView extends Component {
|
||||
|
||||
//基础属性
|
||||
@property(JNScrollView)
|
||||
baseView:JNScrollView;
|
||||
|
||||
//高级属性
|
||||
@property(JNScrollView)
|
||||
highView:JNScrollView;
|
||||
|
||||
info:PetEquip;
|
||||
|
||||
set(info:PetEquip){
|
||||
this.info = info;
|
||||
this.onUpdateView();
|
||||
}
|
||||
|
||||
onUpdateView(){
|
||||
|
||||
this.baseView.refreshData(this.info.equipBaseAttributes);
|
||||
this.highView.refreshData(this.info.equipHighAttributes);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "c8ab3e3c-fa86-45d0-876d-efdf461d9347",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -10,6 +10,8 @@ import { Label } from 'cc';
|
||||
import TimeUtil from '../../../../../extensions/ngame/assets/ngame/util/TimeUtil';
|
||||
import { ResourceType } from '../../../data/ResourceData';
|
||||
import JComponent from '../../../../../extensions/ngame/assets/ngame/util/components/JComponent';
|
||||
import { Button } from 'cc';
|
||||
import { EventTouch } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
@@ -102,6 +104,20 @@ export class MainForgingBench extends JComponent {
|
||||
await PetEquipData.getIns().upForgingBench();
|
||||
}
|
||||
|
||||
//打开指定装备
|
||||
onClickEquip(event: EventTouch){
|
||||
|
||||
let equip = PetEquipData.getIns().getPetEquip(event.target.getSiblingIndex() + 1);
|
||||
|
||||
if(!equip){
|
||||
app.layer.Open(GUI.Tips,{text:"快锻造装备吧~"});
|
||||
return;
|
||||
}
|
||||
|
||||
app.layer.Open(GUI.PetEquipForgingPopupView,equip)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
9
JisolGameCocos/assets/script/ui/Home/Item.meta
Normal file
9
JisolGameCocos/assets/script/ui/Home/Item.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "4c58e5a6-9a16-484d-b204-7423597c851b",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
49
JisolGameCocos/assets/script/ui/Home/Item/MainPlayerInfo.ts
Normal file
49
JisolGameCocos/assets/script/ui/Home/Item/MainPlayerInfo.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { Label } from 'cc';
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import PlayerData from '../../../data/PlayerData';
|
||||
import GBattleData, { GBattleDataEnum } from '../../../data/GBattleData';
|
||||
import { app } from '../../../App';
|
||||
import { tween } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MainPlayerInfo')
|
||||
export class MainPlayerInfo extends Component {
|
||||
|
||||
//玩家名称
|
||||
@property(Label)
|
||||
playerNameLabel:Label;
|
||||
|
||||
//玩家战力
|
||||
@property(Label)
|
||||
playerFC:Label;
|
||||
|
||||
_FC:number = 0;
|
||||
get FC(){
|
||||
return this._FC
|
||||
}
|
||||
set FC(value:number){
|
||||
this._FC = value;
|
||||
this.playerFC.string = `${Math.floor(value)}`;
|
||||
}
|
||||
|
||||
protected onLoad(): void {
|
||||
this.onUpdateView();
|
||||
app.event.on(GBattleDataEnum.UPDARE_ATTRIBUTE_SUCCESS,this.onUpdateView,this);
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
app.event.off(GBattleDataEnum.UPDARE_ATTRIBUTE_SUCCESS,this.onUpdateView,this);
|
||||
}
|
||||
|
||||
onUpdateView() {
|
||||
this.playerNameLabel.string = `${PlayerData.getIns().getInfo().playerName}`;
|
||||
|
||||
//过度
|
||||
tween(this.getComponent(MainPlayerInfo))
|
||||
.to(.5,{FC:GBattleData.getIns().data.getAllFC()})
|
||||
.start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "fea8eb51-1d9e-4683-a678-05e498a071a8",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -16,9 +16,6 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('MainView')
|
||||
export class MainView extends JNGLayerBase {
|
||||
|
||||
@property(Label)
|
||||
playerNameLabel:Label; //玩家名称
|
||||
|
||||
@property(Label)
|
||||
onHookLabel:Label; //挂机文本
|
||||
|
||||
@@ -60,7 +57,6 @@ export class MainView extends JNGLayerBase {
|
||||
|
||||
//更新UI界面
|
||||
onUpdateView(){
|
||||
this.playerNameLabel.string = `${PlayerData.getIns().getInfo().playerName}`;
|
||||
this.onUpdateOnHookInfo();
|
||||
this.onUpdateOnHook();
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ import { app, TD } from '../../App';
|
||||
import { TablePetEquipIcon } from '../Consts/PetEquip/table/TablePetEquipIcon';
|
||||
import PetEquipData from '../../data/PetEquipData';
|
||||
import { PetEquipIcon } from '../Consts/PetEquip/icon/PetEquipIcon';
|
||||
import { PetEquipAttributeView } from '../Consts/PetEquip/PetEquipAttributeView/PetEquipAttributeView';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//弹出锻造装备页面
|
||||
@@ -20,6 +21,10 @@ export class PetEquipForgingPopupView extends JNLayerBase {
|
||||
@property(PetEquipIcon)
|
||||
icon:PetEquipIcon;
|
||||
|
||||
//装备属性展示
|
||||
@property(PetEquipAttributeView)
|
||||
attribute:PetEquipAttributeView;
|
||||
|
||||
info:PetEquip;
|
||||
|
||||
onJNLoad(info:PetEquip){
|
||||
@@ -31,8 +36,10 @@ export class PetEquipForgingPopupView extends JNLayerBase {
|
||||
|
||||
}
|
||||
|
||||
//刷新页面
|
||||
onUpdateView(){
|
||||
this.icon.set(this.info);
|
||||
this.attribute.set(this.info);
|
||||
}
|
||||
|
||||
//点击穿戴装备
|
||||
|
@@ -2,6 +2,10 @@ import { _decorator, Component, Node } from 'cc';
|
||||
import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
|
||||
import JNScrollView from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
|
||||
import PetEquipData from '../../data/PetEquipData';
|
||||
import { NodeEventType } from 'cc';
|
||||
import { app } from '../../App';
|
||||
import { GUI } from '../UIConfig';
|
||||
import { PetEquip } from '../../consts/API';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('PetEquipView')
|
||||
@@ -13,6 +17,9 @@ export class PetEquipView extends JNLayerBase {
|
||||
|
||||
onJNLoad(data?: any): void {
|
||||
super.onJNLoad(data);
|
||||
|
||||
//添加子节点事件
|
||||
this.list.addItemEvent(NodeEventType.TOUCH_END,this.onClickItem.bind(this));
|
||||
}
|
||||
|
||||
onJNLoadAnimEnd(): void {
|
||||
@@ -21,6 +28,12 @@ export class PetEquipView extends JNLayerBase {
|
||||
this.onUpdateView();
|
||||
}
|
||||
|
||||
onClickItem(index:number){
|
||||
|
||||
app.layer.Open(GUI.PetEquipForgingPopupView,this.list.getData<PetEquip>()[index])
|
||||
|
||||
}
|
||||
|
||||
onUpdateView(){
|
||||
|
||||
this.list.refreshData(PetEquipData.getIns().equips);
|
||||
|
@@ -56,7 +56,12 @@ const UISystemConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
[GUI.Tips]:{
|
||||
layer:GLayer.Tips,
|
||||
uri: "prefab/ui/系统页面/提示/TipsView",
|
||||
anims:BackOutScale
|
||||
anims:{
|
||||
front:JNLayerAnim.Enlarge,
|
||||
back:JNLayerAnim.Smaller,
|
||||
frontInfo:{key:"position",start:v3(720,0,0),end:v3(0,0,0)},
|
||||
backInfo:{key:"position",start:v3(0,0,0),end:v3(720,0,0)}
|
||||
}
|
||||
},
|
||||
[GUI.Debugger]:{
|
||||
layer:GLayer.Popup,
|
||||
|
Reference in New Issue
Block a user