This commit is contained in:
PC-20230316NUNE\Administrator
2024-01-17 00:05:44 +08:00
parent 68e0f81616
commit 8ad2313502
57 changed files with 12231 additions and 2286 deletions

View File

@@ -6,20 +6,18 @@ import { Node } from "cc";
import { instantiate } from "cc";
import { TD, app } from "../App";
import { JNFrameInfo, JNSyncFrameEvent } from "../../../extensions/ngame/assets/ngame/sync/frame/JNSyncFrame";
import { CCObject } from "cc";
import { Env, EnvCurrent } from "../Env";
import { TB } from "../config/data/schema";
import BattleResource from "../tools/BattleResource";
import { director } from "cc";
import { game } from "cc";
export enum BattleMode{
//无尽模式
OnHook = 0,
OnHook = "OnHook",
//PVP 模式
PVP = 1,
PVP = "PVP",
//阵营守护
CampGuardian = 2,
CampGuardian = "CampGuardian",
//副本
GDungeonMode = "GDungeonMode",
}
export interface GBattleModeInfo{

View File

@@ -41,7 +41,7 @@ export default class GPetAttribute extends GAttributeBase{
if(!baseAttribute[attr.sign] || !grow[attr.sign]) return;
//计算 累加 ((base * value) * level)
this.attributes[attr.id] += (baseAttribute[attr.sign] * grow[attr.sign]) * level;
this.attributes[attr.id] = (baseAttribute[attr.sign] * grow[attr.sign]) * level;
})

View File

@@ -125,7 +125,7 @@ export default class GCampGuardianMode extends GBaseMode<{},{}>{
entity.addKillBackEvent(this.onRoleKillBack.bind(this))
//添加宠物属性
entity.onEffectiveValue(new GPetAttribute({
entity.onEffectiveValues(new GPetAttribute({
petId:info.id,
petPlayerId:0,
petTbId:info.id,

View File

@@ -0,0 +1,105 @@
import { _decorator } from "cc";
import GBaseMode from "../GBaseMode";
import { TB, TbGEntity } from "../../config/data/schema";
import PlayerTacticalData from "../../data/PlayerTacticalData";
import PlayerPetData from "../../data/PlayerPetData";
import { TD, app } from "../../App";
import { GUI } from "../../ui/UIConfig";
import { GOnHookModePlayerEnum } from "./GOnHookMode";
import GRoleDefault from "../base/role/GRoleDefault";
const { ccclass, property } = _decorator;
//角色
export enum GDungeonModeEnum{
PLAYER, //玩家
ENEMY, //怪物
}
/**
* 副本(默认) 模式
*/
@ccclass('GDungeonMode')
export default class GDungeonMode extends GBaseMode<{},TbGEntity.TDungeon>{
//生成玩家宠物
onGenPlayerPet(index:number,petId:number){
//获取玩家阵容
let infos = PlayerTacticalData.getIns().getTacticalInfo();
infos.forEach(petId => {
//获取要生成的宠物
let info = PlayerPetData.getIns().petIdQueryPetInfo(petId);
if(!info){
app.layer.Open(GUI.Tips,{text:"未拥有当前上阵的宠物"});
return;
}
let role = this.onGenRole(GOnHookModePlayerEnum.PLAYER,index,TD.TbGRole.get(info.petTbId));
})
//如果场上有这个宠物则更新阵法位置
let passRole:GRoleDefault;
this.playerRoles.forEach(role => {
if(role.getComponent(GRoleOnHookPlayerExpand).petId == petId)
passRole = role;
})
if(passRole){
//更新宠物阵法位置
passRole.tacticalIndex = index;
return;
}
if(!info){
app.layer.Open(GUI.Tips,{text:"未拥有当前上阵的宠物"});
return;
}
let role = this.onGenRole(GOnHookModePlayerEnum.PLAYER,index,TD.TbGRole.get(info.petTbId));
//向宠物添加 OnHook 扩展
let expand = role.node.addComponent(GRoleOnHookPlayerExpand);
expand.petId = petId;
//添加宠物属性
role.onEffectiveValue(GBattleData.getIns().data.getPetAttribute(petId));
}
//生成宠物
onGenRole(type: GOnHookModePlayerEnum,index:number,info:TB.TbGRole):GRoleDefault {
let tactical = this.getInfo(type).tactical;
let pos:Vec2 = this.getInfo(type).tactical.getPosition(index);
if(!pos) return;
let role = instantiate(this.rolePrefab);
let entity = role.getComponent(GRoleDefault);
//初始化
entity.onInit(type,info,tactical,index);
//绑定寻敌
entity.onQueryEunmy = () => {
return this.getEnumy(entity,type);
}
//绑定死亡回调
entity.addKillBackEvent(this.onRoleKillBack.bind(this))
//绑定受击回调
entity.addHitCallback(this.onHitBack.bind(this));
this.addGObject(entity,tactical.getPosition(index));
this.getOnesRole(type).push(entity);
return entity;
}
}

View File

@@ -0,0 +1,44 @@
import { TB } from "../../../config/data/schema";
import GRoleDefault from "../../base/role/GRoleDefault";
import GDefaultMode from "./GDefaultMode";
//角色
export enum GNormalModeEnum{
PLAYER, //玩家
ENEMY, //怪物
}
export default class GNormalModeBase extends GDefaultMode<{},{}>{
//生成宠物
onGenRole(type: GNormalModeEnum,index:number,info:TB.TbGRole):GRoleDefault {
let tactical = this.getInfo(type).tactical;
let pos:Vec2 = this.getInfo(type).tactical.getPosition(index);
if(!pos) return;
let role = instantiate(this.rolePrefab);
let entity = role.getComponent(GRoleDefault);
//初始化
entity.onInit(type,info,tactical,index);
//绑定寻敌
entity.onQueryEunmy = () => {
return this.getEnumy(entity,type);
}
//绑定死亡回调
entity.addKillBackEvent(this.onRoleKillBack.bind(this))
//绑定受击回调
entity.addHitCallback(this.onHitBack.bind(this));
this.addGObject(entity,tactical.getPosition(index));
this.getOnesRole(type).push(entity);
return entity;
}
}

View File

@@ -315,63 +315,6 @@ export class TbGResource {
}
export namespace TB {
export class TbGRoleUpLevel {
constructor(_json_: any) {
if (_json_.grade === undefined) { throw new Error() }
this.grade = _json_.grade
if (_json_.materials === undefined) { throw new Error() }
{ this.materials = []; for(let _ele of _json_.materials) { let _e; _e = new TbGEntity.TResource(_ele); this.materials.push(_e);}}
}
/**
* 宠物等级
*/
readonly grade: number
/**
* 消耗的材料
*/
readonly materials: TbGEntity.TResource[]
resolve(tables:Tables)
{
}
}
}
export namespace TbGEntity {
/**
* 资源信息
*/
export class TResource {
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 TbGRoleUpStar {
@@ -918,6 +861,36 @@ export class TbGRoleEquipQuality {
}
export namespace TbGEntity {
/**
* 资源信息
*/
export class TResource {
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 TbGRoleEquipType {
@@ -946,13 +919,17 @@ export class TbGRoleEquipType {
export namespace TB {
export class TbGSysFuben {
export class TbGSysDungeon {
constructor(_json_: any) {
if (_json_.id === undefined) { throw new Error() }
this.id = _json_.id
if (_json_.name === undefined) { throw new Error() }
this.name = _json_.name
if (_json_.banner === undefined) { throw new Error() }
this.banner = _json_.banner
if (_json_.tigs === undefined) { throw new Error() }
this.tigs = _json_.tigs
}
/**
@@ -963,6 +940,110 @@ export class TbGSysFuben {
* 副本名称
*/
readonly name: string
/**
* 副本封面
*/
readonly banner: string
/**
* 类标识
*/
readonly tigs: string
resolve(tables:Tables)
{
}
}
}
export namespace TB {
export class TbGSysDungeon160001 {
constructor(_json_: any) {
if (_json_.id === undefined) { throw new Error() }
this.id = _json_.id
if (_json_.data === undefined) { throw new Error() }
this.data = new TbGEntity.TDungeon(_json_.data)
}
/**
* id
*/
readonly id: number
/**
* 副本关卡
*/
readonly data: TbGEntity.TDungeon
resolve(tables:Tables)
{
}
}
}
export namespace TbGEntity {
/**
* 普通副本信息
*/
export class TDungeon {
constructor(_json_: any) {
if (_json_.level === undefined) { throw new Error() }
this.level = _json_.level
if (_json_.boss === undefined) { throw new Error() }
this.boss = _json_.boss
if (_json_.attributes === undefined) { throw new Error() }
{ this.attributes = []; for(let _ele of _json_.attributes) { let _e; _e = new TbGEntity.TAttributeValue(_ele); this.attributes.push(_e);}}
if (_json_.rewards === undefined) { throw new Error() }
{ this.rewards = []; for(let _ele of _json_.rewards) { let _e; _e = new TbGEntity.TResource(_ele); this.rewards.push(_e);}}
}
/**
* 副本关卡
*/
readonly level: number
/**
* BOSS ID
*/
readonly boss: number
/**
* BOSS 属性
*/
readonly attributes: TbGEntity.TAttributeValue[]
/**
* 关卡奖励
*/
readonly rewards: TbGEntity.TResource[]
resolve(tables:Tables)
{
}
}
}
export namespace TB {
export class TbGSysDungeon160002 {
constructor(_json_: any) {
if (_json_.id === undefined) { throw new Error() }
this.id = _json_.id
if (_json_.data === undefined) { throw new Error() }
this.data = new TbGEntity.TDungeon(_json_.data)
}
/**
* id
*/
readonly id: number
/**
* 副本关卡
*/
readonly data: TbGEntity.TDungeon
resolve(tables:Tables)
{
@@ -1198,38 +1279,6 @@ export class TbGResource{
export class TbGRoleUpLevel{
private _dataMap: Map<number, TB.TbGRoleUpLevel>
private _dataList: TB.TbGRoleUpLevel[]
constructor(_json_: any) {
this._dataMap = new Map<number, TB.TbGRoleUpLevel>()
this._dataList = []
for(var _json2_ of _json_) {
let _v: TB.TbGRoleUpLevel
_v = new TB.TbGRoleUpLevel(_json2_)
this._dataList.push(_v)
this._dataMap.set(_v.grade, _v)
}
}
getDataMap(): Map<number, TB.TbGRoleUpLevel> { return this._dataMap; }
getDataList(): TB.TbGRoleUpLevel[] { return this._dataList; }
get(key: number): TB.TbGRoleUpLevel | undefined { return this._dataMap.get(key); }
resolve(tables:Tables)
{
for(let data of this._dataList)
{
data.resolve(tables)
}
}
}
export class TbGRoleUpStar{
private _dataMap: Map<number, TB.TbGRoleUpStar>
private _dataList: TB.TbGRoleUpStar[]
@@ -1646,24 +1695,88 @@ export class TbGRoleEquipType{
export class TbGSysFuben{
private _dataMap: Map<number, TB.TbGSysFuben>
private _dataList: TB.TbGSysFuben[]
export class TbGSysDungeon{
private _dataMap: Map<number, TB.TbGSysDungeon>
private _dataList: TB.TbGSysDungeon[]
constructor(_json_: any) {
this._dataMap = new Map<number, TB.TbGSysFuben>()
this._dataMap = new Map<number, TB.TbGSysDungeon>()
this._dataList = []
for(var _json2_ of _json_) {
let _v: TB.TbGSysFuben
_v = new TB.TbGSysFuben(_json2_)
let _v: TB.TbGSysDungeon
_v = new TB.TbGSysDungeon(_json2_)
this._dataList.push(_v)
this._dataMap.set(_v.id, _v)
}
}
getDataMap(): Map<number, TB.TbGSysFuben> { return this._dataMap; }
getDataList(): TB.TbGSysFuben[] { return this._dataList; }
getDataMap(): Map<number, TB.TbGSysDungeon> { return this._dataMap; }
getDataList(): TB.TbGSysDungeon[] { return this._dataList; }
get(key: number): TB.TbGSysFuben | undefined { return this._dataMap.get(key); }
get(key: number): TB.TbGSysDungeon | undefined { return this._dataMap.get(key); }
resolve(tables:Tables)
{
for(let data of this._dataList)
{
data.resolve(tables)
}
}
}
export class TbGSysDungeon160001{
private _dataMap: Map<number, TB.TbGSysDungeon160001>
private _dataList: TB.TbGSysDungeon160001[]
constructor(_json_: any) {
this._dataMap = new Map<number, TB.TbGSysDungeon160001>()
this._dataList = []
for(var _json2_ of _json_) {
let _v: TB.TbGSysDungeon160001
_v = new TB.TbGSysDungeon160001(_json2_)
this._dataList.push(_v)
this._dataMap.set(_v.id, _v)
}
}
getDataMap(): Map<number, TB.TbGSysDungeon160001> { return this._dataMap; }
getDataList(): TB.TbGSysDungeon160001[] { return this._dataList; }
get(key: number): TB.TbGSysDungeon160001 | undefined { return this._dataMap.get(key); }
resolve(tables:Tables)
{
for(let data of this._dataList)
{
data.resolve(tables)
}
}
}
export class TbGSysDungeon160002{
private _dataMap: Map<number, TB.TbGSysDungeon160002>
private _dataList: TB.TbGSysDungeon160002[]
constructor(_json_: any) {
this._dataMap = new Map<number, TB.TbGSysDungeon160002>()
this._dataList = []
for(var _json2_ of _json_) {
let _v: TB.TbGSysDungeon160002
_v = new TB.TbGSysDungeon160002(_json2_)
this._dataList.push(_v)
this._dataMap.set(_v.id, _v)
}
}
getDataMap(): Map<number, TB.TbGSysDungeon160002> { return this._dataMap; }
getDataList(): TB.TbGSysDungeon160002[] { return this._dataList; }
get(key: number): TB.TbGSysDungeon160002 | undefined { return this._dataMap.get(key); }
resolve(tables:Tables)
{
@@ -1695,8 +1808,6 @@ export class Tables {
get TbGOnHookGlobal(): TbGOnHookGlobal { return this._TbGOnHookGlobal;}
private _TbGResource: TbGResource
get TbGResource(): TbGResource { return this._TbGResource;}
private _TbGRoleUpLevel: TbGRoleUpLevel
get TbGRoleUpLevel(): TbGRoleUpLevel { return this._TbGRoleUpLevel;}
private _TbGRoleUpStar: TbGRoleUpStar
get TbGRoleUpStar(): TbGRoleUpStar { return this._TbGRoleUpStar;}
private _TbGRoleUpGrow: TbGRoleUpGrow
@@ -1723,8 +1834,12 @@ export class Tables {
get TbGRoleEquipQuality(): TbGRoleEquipQuality { return this._TbGRoleEquipQuality;}
private _TbGRoleEquipType: TbGRoleEquipType
get TbGRoleEquipType(): TbGRoleEquipType { return this._TbGRoleEquipType;}
private _TbGSysFuben: TbGSysFuben
get TbGSysFuben(): TbGSysFuben { return this._TbGSysFuben;}
private _TbGSysDungeon: TbGSysDungeon
get TbGSysDungeon(): TbGSysDungeon { return this._TbGSysDungeon;}
private _TbGSysDungeon160001: TbGSysDungeon160001
get TbGSysDungeon160001(): TbGSysDungeon160001 { return this._TbGSysDungeon160001;}
private _TbGSysDungeon160002: TbGSysDungeon160002
get TbGSysDungeon160002(): TbGSysDungeon160002 { return this._TbGSysDungeon160002;}
constructor(loader: JsonLoader) {
this._TbGGlobal = new TbGGlobal(loader('tbgglobal'))
@@ -1734,7 +1849,6 @@ export class Tables {
this._TbGMap = new TbGMap(loader('tbgmap'))
this._TbGOnHookGlobal = new TbGOnHookGlobal(loader('tbgonhookglobal'))
this._TbGResource = new TbGResource(loader('tbgresource'))
this._TbGRoleUpLevel = new TbGRoleUpLevel(loader('tbgroleuplevel'))
this._TbGRoleUpStar = new TbGRoleUpStar(loader('tbgroleupstar'))
this._TbGRoleUpGrow = new TbGRoleUpGrow(loader('tbgroleupgrow'))
this._TbSServerInfo = new TbSServerInfo(loader('tbsserverinfo'))
@@ -1748,7 +1862,9 @@ export class Tables {
this._TbGRoleEquipLevel = new TbGRoleEquipLevel(loader('tbgroleequiplevel'))
this._TbGRoleEquipQuality = new TbGRoleEquipQuality(loader('tbgroleequipquality'))
this._TbGRoleEquipType = new TbGRoleEquipType(loader('tbgroleequiptype'))
this._TbGSysFuben = new TbGSysFuben(loader('tbgsysfuben'))
this._TbGSysDungeon = new TbGSysDungeon(loader('tbgsysdungeon'))
this._TbGSysDungeon160001 = new TbGSysDungeon160001(loader('tbgsysdungeon160001'))
this._TbGSysDungeon160002 = new TbGSysDungeon160002(loader('tbgsysdungeon160002'))
this._TbGGlobal.resolve(this)
this._TbGRole.resolve(this)
@@ -1757,7 +1873,6 @@ export class Tables {
this._TbGMap.resolve(this)
this._TbGOnHookGlobal.resolve(this)
this._TbGResource.resolve(this)
this._TbGRoleUpLevel.resolve(this)
this._TbGRoleUpStar.resolve(this)
this._TbGRoleUpGrow.resolve(this)
this._TbSServerInfo.resolve(this)
@@ -1771,6 +1886,8 @@ export class Tables {
this._TbGRoleEquipLevel.resolve(this)
this._TbGRoleEquipQuality.resolve(this)
this._TbGRoleEquipType.resolve(this)
this._TbGSysFuben.resolve(this)
this._TbGSysDungeon.resolve(this)
this._TbGSysDungeon160001.resolve(this)
this._TbGSysDungeon160002.resolve(this)
}
}

View File

@@ -89,10 +89,11 @@ export default class PlayerPetData extends BaseData{
//刷新返回宠物
onUpdateOV(operation:number,resource:PlayerPetOV){
resource.petLevel = PetEquipData.getIns().getForgingBenchPetLevel(resource.petId);
//如果没有刷新的宠物 则 返回
if(!resource) return;
resource.petLevel = PetEquipData.getIns().getForgingBenchPetLevel(resource.petId);
if(operation == ResourceUpdateType.UPDATE){
//更新资源

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "a02d7ff0-fe8f-4970-be6d-5d7c6be4c220",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,28 @@
import { _decorator, Component, Node } from 'cc';
import JNScrollViewItem from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollViewItem';
import { TB } from '../../config/data/schema';
import { Label } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('DungeonShowItem')
export class DungeonShowItem extends JNScrollViewItem<TB.TbGSysDungeon> {
//副本名称
@property(Label)
title:Label;
onInit(){
this.onUpdateView();
}
onUpdateView(){
this.title.string = this.data.name;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "337e32c7-5580-4897-925b-19deb6621d34",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,27 @@
import { _decorator, Component, Node } from 'cc';
import { JNGLayerBase } from '../../components/JNComponent';
import { TD } from '../../App';
import JNScrollView from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
const { ccclass, property } = _decorator;
@ccclass('DungeonView')
export class DungeonView extends JNGLayerBase {
@property(JNScrollView)
views:JNScrollView
onJNLoad(data?: any): void {
super.onJNLoad(data);
this.onUpdateView();
}
onUpdateView(){
//显示全部副本
this.views.refreshData(TD.TbGSysDungeon.getDataList());
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "aa8b9c47-a4d4-49bb-a26e-2b78a7f60d0b",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -116,6 +116,11 @@ export class MainView extends JNGLayerBase {
GOnHookManager.getIns().onNextLevel();
}
//点击进入副本
onClickDungeon(){
app.layer.Open(GUI.DungeonView);
}
}

View File

@@ -25,6 +25,9 @@ export enum GUI{
MainOnHookView = "MainOnHookView", //挂机弹窗
MapSelectView = "MapSelectView", //地图选择页面
/** 副本 */
DungeonView = "DungeonView", //副本页面
/**宠物 */
PetUpStarView = "PetUpStarView", //宠物升星页面
@@ -158,6 +161,15 @@ const UINoviceConfig:{ [key: string]: JNLayerInfo; } = {
}
//副本页面
const UIDungeonConfig:{ [key: string]: JNLayerInfo; } = {
[GUI.DungeonView]:{
layer:GLayer.Popup,
uri: "prefab/ui/副本页面/副本页面",
anims:BackOutScale
}
}
//游戏模式页面
const UIGModeConfig:{ [key: string]: JNLayerInfo; } = {
@@ -214,6 +226,7 @@ export const UIConfig:{ [key: string]: JNLayerInfo; } = {
...UINoviceConfig, //新手引导页面
...UIMainConfig, //主页面
...UIPetConfig, //宠物页面
...UIDungeonConfig, //副本页面
...UIGModeConfig, //游戏模式页面
}