mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 18:26:23 +00:00
我也不知道在做什么 反正做的东西不少....
This commit is contained in:
@@ -220,6 +220,7 @@ export const app = {
|
||||
battle : GBattleModeManager.getIns(), //战斗
|
||||
config : new JNGConfig(), //配置文件
|
||||
battleRes : new JLoaderBattle("battle"), //battle包
|
||||
tbRes : new JLoaderSystem("tbresource"), //tbresource包
|
||||
data : new AppData(), //游戏基础信息
|
||||
action : new AppAction(), //游戏行为
|
||||
loading : new Loading({
|
||||
|
@@ -31,6 +31,20 @@ export default class GPetAttribute extends GAttributeBase{
|
||||
this.attributes[attr.id] = baseAttribute[attr.sign] || 0;
|
||||
});
|
||||
|
||||
//计算升级成长属性
|
||||
let level = this.pet.petLevel; //宠物等级
|
||||
let grow = TD.TbGRoleUpGrow.get(this.pet.petId) || TD.TbGRoleUpGrow.get(0); //成长
|
||||
|
||||
TD.TbGAttribute.getDataList().forEach(attr => {
|
||||
|
||||
//过滤没有的属性
|
||||
if(!baseAttribute[attr.sign] || !grow[attr.sign]) return;
|
||||
|
||||
//计算 累加 ((base * value) * level)
|
||||
this.attributes[attr.id] += (baseAttribute[attr.sign] * grow[attr.sign]) * level;
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
//刷新属性
|
||||
|
9
JisolGameCocos/assets/script/tools.meta
Normal file
9
JisolGameCocos/assets/script/tools.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "be0566e4-1b70-468b-8845-15e4e8c0e89b",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
46
JisolGameCocos/assets/script/tools/TbResource.ts
Normal file
46
JisolGameCocos/assets/script/tools/TbResource.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { Asset } from "cc";
|
||||
import { app } from "../App";
|
||||
import { Sprite } from "cc";
|
||||
import { SpriteFrame } from "cc";
|
||||
import { Node } from "cc";
|
||||
import { Component } from "cc";
|
||||
|
||||
export default class TbResource {
|
||||
|
||||
static load<T extends Asset>(res:string,onComplete?:((err: Error | null, data: T) => void)){
|
||||
app.tbRes.get().load<T>(res,onComplete)
|
||||
}
|
||||
|
||||
static loadSpriteFrame(res:string,sprite:Sprite,comp:Component){
|
||||
|
||||
this.load<SpriteFrame>(res,(err,data:SpriteFrame) => {
|
||||
|
||||
if(!data) return;
|
||||
|
||||
if(!sprite.isValid || !comp.isValid) {
|
||||
//提前销毁
|
||||
data.addRef();
|
||||
data.decRef();
|
||||
}
|
||||
|
||||
sprite.spriteFrame = data;
|
||||
//添加引用标记
|
||||
data.addRef();
|
||||
|
||||
//添加销毁资源引用
|
||||
let onDestroy = comp["onDestroy"];
|
||||
|
||||
comp["onDestroy"] = () => {
|
||||
if(onDestroy)
|
||||
onDestroy.bind(comp)();
|
||||
//销毁引用
|
||||
if(sprite.isValid && sprite.spriteFrame == data) sprite.spriteFrame = null;
|
||||
data.decRef();
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
9
JisolGameCocos/assets/script/tools/TbResource.ts.meta
Normal file
9
JisolGameCocos/assets/script/tools/TbResource.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "2b16106c-1170-4a46-bea0-4ea99ccf34f2",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -50,6 +50,16 @@ export class MainView extends JNGLayerBase {
|
||||
app.socket.Send(GAction.S_MODE_PVP_JOIN);
|
||||
}
|
||||
|
||||
//点击挂机按钮
|
||||
onOpenOnHookView(){
|
||||
app.layer.Open(GUI.MainOnHookView);
|
||||
}
|
||||
|
||||
//点击地图
|
||||
onOpenMap(){
|
||||
app.layer.Open(GUI.MapSelectView);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
9
JisolGameCocos/assets/script/ui/Home/OnHook.meta
Normal file
9
JisolGameCocos/assets/script/ui/Home/OnHook.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "3ea68af5-bbc6-48ae-bc9f-7d60a2f55f8c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { JNGLayerBase } from '../../../components/JNComponent';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MainOnHookView')
|
||||
export class MainOnHookView extends JNGLayerBase {
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "2ff462ee-27ac-4917-a72c-932754221b93",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
9
JisolGameCocos/assets/script/ui/Map.meta
Normal file
9
JisolGameCocos/assets/script/ui/Map.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "1421f8ee-f141-4e8e-9d80-53b75b883859",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
40
JisolGameCocos/assets/script/ui/Map/MapSelectShowItem.ts
Normal file
40
JisolGameCocos/assets/script/ui/Map/MapSelectShowItem.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import JNScrollViewItem from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollViewItem';
|
||||
import { TB } from '../../../resources/config/data/schema';
|
||||
import { Label } from 'cc';
|
||||
import { Sprite } from 'cc';
|
||||
import TbResource from '../../tools/TbResource';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MapSelectShowItem')
|
||||
export class MapSelectShowItem extends JNScrollViewItem<TB.TbGOnHookMaps> {
|
||||
|
||||
@property({type:Sprite,displayName:"地图预览图"})
|
||||
mapImage:Sprite;
|
||||
|
||||
@property({type:Label,displayName:"地图名称"})
|
||||
mapName:Label;
|
||||
|
||||
@property({type:Label,displayName:"地图介绍"})
|
||||
mapText:Label;
|
||||
|
||||
onInit(data: TB.TbGOnHookMaps): void {
|
||||
|
||||
this.onUpdateView();
|
||||
|
||||
}
|
||||
|
||||
//刷新页面
|
||||
onUpdateView(){
|
||||
|
||||
this.mapName.string = this.data.name;
|
||||
this.mapText.string = this.data.introduce;
|
||||
|
||||
//加载预览图
|
||||
TbResource.loadSpriteFrame(this.data.mapImage,this.mapImage,this);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "e30501ff-fe51-4db6-9fc9-aaf7df8f6ba0",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
23
JisolGameCocos/assets/script/ui/Map/MapSelectView.ts
Normal file
23
JisolGameCocos/assets/script/ui/Map/MapSelectView.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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 { TD } from '../../App';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MapSelectView')
|
||||
export class MapSelectView extends JNLayerBase {
|
||||
|
||||
//地图列表
|
||||
@property(JNScrollView)
|
||||
views:JNScrollView;
|
||||
|
||||
onJNLoad(data?: any): void {
|
||||
super.onJNLoad(data);
|
||||
|
||||
this.views.refreshData(TD.TbGOnHookMaps.getDataList())
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "dcbf1c81-3947-4aae-9a11-bd14764750a0",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -20,10 +20,10 @@ export enum GUI{
|
||||
|
||||
/** 主页页面 */
|
||||
MainChat = "MainChat", //主页聊天页面
|
||||
|
||||
IntoBattleView = "IntoBattleView", //上阵页面
|
||||
|
||||
PetUpStarView = "PetUpStarView", //宠物升星页面
|
||||
MainOnHookView = "MainOnHookView", //挂机弹窗
|
||||
MapSelectView = "MapSelectView", //地图选择页面
|
||||
|
||||
/**游戏模式页面 */
|
||||
PVPModeMatchView = "PVPModeMatchView", //PVP模式匹配页面
|
||||
@@ -85,6 +85,16 @@ const UIMainConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
uri: "prefab/ui/阵法/阵法选择页面",
|
||||
anims:BackOutScale,
|
||||
},
|
||||
[GUI.MainOnHookView]:{
|
||||
layer:GLayer.Popup,
|
||||
uri: "prefab/ui/主页/挂机/主页挂机页面",
|
||||
anims:BackOutScale,
|
||||
},
|
||||
[GUI.MapSelectView]:{
|
||||
layer:GLayer.Popup,
|
||||
uri: "prefab/ui/地图/地图选择页面",
|
||||
anims:BackOutScale,
|
||||
},
|
||||
}
|
||||
|
||||
//宠物页面
|
||||
|
Reference in New Issue
Block a user