mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交
This commit is contained in:
@@ -4,6 +4,7 @@ import BaseData from "./data/BaseData";
|
||||
import ChatData from "./data/ChatData";
|
||||
import GBattleData from "./data/GBattleData";
|
||||
import GOnHookData from "./data/GOnHookData";
|
||||
import GiftData from "./data/GiftData";
|
||||
import PetEquipData from "./data/PetEquipData";
|
||||
import PlayerData from "./data/PlayerData";
|
||||
import PlayerPetData from "./data/PlayerPetData";
|
||||
@@ -18,6 +19,7 @@ export class AppData extends SystemBase{
|
||||
loadings:BaseData[] = [
|
||||
PlayerData.getIns(), //玩家信息
|
||||
PetEquipData.getIns(), //宠物装备数据类
|
||||
GiftData.getIns(), //玩家礼包信息
|
||||
PlayerPetData.getIns(), //玩家宠物信息
|
||||
ChatData.getIns(), //聊天
|
||||
PlayerTacticalData.getIns(), //阵法
|
||||
|
@@ -10,6 +10,7 @@ import GBattleData from "../../data/GBattleData";
|
||||
import GAttributeData from "../base/values/GAttributeData";
|
||||
import JNFrameTime from "../../../../extensions/ngame/assets/ngame/sync/frame/game/time/JNFrameTime";
|
||||
import { GAPI } from "../../consts/GAPI";
|
||||
import { Node } from "cc";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
export interface GDungeonModeData{
|
||||
|
@@ -42,14 +42,7 @@ export enum GOnHookModeState{
|
||||
*/
|
||||
@ccclass('GOnHookMode')
|
||||
export default class GOnHookMode extends GNormalModeBase<{},{}>{
|
||||
|
||||
@property(Node)
|
||||
objects: Node = null;
|
||||
|
||||
get scene():Node{
|
||||
return this.objects;
|
||||
}
|
||||
|
||||
|
||||
//玩家宠物
|
||||
playerRoles: GRoleDefault[] = [];
|
||||
//敌方宠物
|
||||
|
@@ -27,7 +27,7 @@ export default class GDefaultMode<T,DT> extends GBaseMode<T,DT>{
|
||||
let scale = this.mapInfo.scale;
|
||||
this.map1.init(app.battleRes.getMap(mapId)[0],1,app.battleRes.getMap(mapId)[0].width * scale,app.battleRes.getMap(mapId)[0].height * scale);
|
||||
this.map2.init(app.battleRes.getMap(mapId)[1],1,app.battleRes.getMap(mapId)[1].width * scale,app.battleRes.getMap(mapId)[1].height * scale);
|
||||
this.map3.init(app.battleRes.getMap(mapId)[2],1,app.battleRes.getMap(mapId)[1].width * scale,1048 * scale);
|
||||
this.map3.init(app.battleRes.getMap(mapId)[2],1,app.battleRes.getMap(mapId)[1].width * scale,1280 * scale);
|
||||
|
||||
//更新地图
|
||||
this.onUpdateMap(0);
|
||||
|
@@ -10,6 +10,7 @@ import JNFrameTime from "../../../../../extensions/ngame/assets/ngame/sync/frame
|
||||
import { v3 } from "cc";
|
||||
import { GModeEvent } from "../GMode";
|
||||
import { app } from "../../../App";
|
||||
import { Node } from "cc";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
@@ -31,6 +32,13 @@ export default class GNormalModeBase<T,DT> extends GDefaultMode<T,DT>{
|
||||
@property(Prefab)
|
||||
enemyPrefab: Prefab = null;
|
||||
|
||||
@property(Node)
|
||||
objects: Node = null;
|
||||
|
||||
get scene():Node{
|
||||
return this.objects;
|
||||
}
|
||||
|
||||
//玩家宠物
|
||||
playerRoles: GRoleDefault[] = [];
|
||||
//敌方宠物
|
||||
@@ -58,7 +66,7 @@ export default class GNormalModeBase<T,DT> extends GDefaultMode<T,DT>{
|
||||
//调整相机
|
||||
this.camera.enabled = true;
|
||||
let camreaPos = this.camera.node.worldPosition;
|
||||
this.camera.node.worldPosition = v3(0,750,camreaPos.z)
|
||||
this.camera.node.worldPosition = v3(0,450,camreaPos.z)
|
||||
}
|
||||
|
||||
//获取配置
|
||||
|
@@ -1165,8 +1165,8 @@ export class TbGGift {
|
||||
this.limit = _json_.limit
|
||||
if (_json_.limitValue === undefined) { throw new Error() }
|
||||
this.limitValue = _json_.limitValue
|
||||
if (_json_.price === undefined) { throw new Error() }
|
||||
this.price = _json_.price
|
||||
if (_json_.exchanges === undefined) { throw new Error() }
|
||||
{ this.exchanges = []; for(let _ele of _json_.exchanges) { let _e; _e = new TbGEntity.TResource(_ele); this.exchanges.push(_e);}}
|
||||
if (_json_.rewards === undefined) { throw new Error() }
|
||||
{ this.rewards = []; for(let _ele of _json_.rewards) { let _e; _e = new TbGEntity.TReward(_ele); this.rewards.push(_e);}}
|
||||
}
|
||||
@@ -1192,9 +1192,9 @@ export class TbGGift {
|
||||
*/
|
||||
readonly limitValue: number
|
||||
/**
|
||||
* 价格
|
||||
* 兑换的资源
|
||||
*/
|
||||
readonly price: number
|
||||
readonly exchanges: TbGEntity.TResource[]
|
||||
/**
|
||||
* 奖励
|
||||
*/
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { app } from "../App";
|
||||
import { TbGEntity } from "../config/data/schema";
|
||||
import PlayerPetData from "../data/PlayerPetData";
|
||||
import ResourceData from "../data/ResourceData";
|
||||
import { GUI } from "../ui/UIConfig";
|
||||
@@ -141,6 +142,24 @@ export interface PetEquipForgingOV{
|
||||
}
|
||||
|
||||
|
||||
//礼包每天充值记录
|
||||
export interface GiftRecord{
|
||||
giftId:number; //礼包Id
|
||||
playerId:number; //玩家Id
|
||||
giftCfgId:number; //礼包配置表Id
|
||||
giftCfgName; //礼包名称
|
||||
giftCfgRewards:TbGEntity.TReward[]; //礼包奖励
|
||||
giftCfgPrice:number; //礼包价格
|
||||
giftBuyingTime:number; //礼包购买时间戳
|
||||
}
|
||||
export interface GiftDayRecord{
|
||||
giftDayId:number; //充值Id
|
||||
playerId:number; //玩家Id
|
||||
giftId:number; //礼包Id
|
||||
giftCfgId:number; //礼包配置表Id
|
||||
}
|
||||
|
||||
|
||||
export const API = {
|
||||
|
||||
/********** debugger *****************/
|
||||
@@ -179,5 +198,10 @@ export const API = {
|
||||
PetEquipForgingUp: async () => RData(await app.api.post(`/game/equip/forging/up`),true) as EquipForgingBench, //升级锻造台
|
||||
PetEquipUseSpeed: async (resType:number) => RData(await app.api.post(`/game/equip/use/speed/${resType}`),true) as EquipForgingBench, //加速锻造台升级
|
||||
|
||||
/*********** 礼包接口 ******************/
|
||||
GetGiftRecord: async () => RData(await app.api.get(`/game/gift/record/all`),false) as GiftRecord[], //查询当天购买记录
|
||||
GetGiftDayRecord: async () => RData(await app.api.get(`/game/gift/record/day`),false) as GiftDayRecord[], //查询当天购买记录
|
||||
BuyGift: async (giftId:number) => RData(await app.api.post(`/game/gift/buy/${giftId}`),true) as Boolean, //查询当天购买记录
|
||||
|
||||
}
|
||||
|
||||
|
45
JisolGameCocos/assets/script/data/GiftData.ts
Normal file
45
JisolGameCocos/assets/script/data/GiftData.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { app } from "../App";
|
||||
import { API, GiftDayRecord, GiftRecord } from "../consts/API";
|
||||
import BaseData from "./BaseData";
|
||||
|
||||
export enum GiftDataEnum{
|
||||
BUY = "GiftDataEnum_Buy", //礼包购买
|
||||
}
|
||||
|
||||
//礼包数据
|
||||
export default class GiftData extends BaseData{
|
||||
|
||||
records:GiftRecord[] = [];
|
||||
dayRecords:GiftDayRecord[] = [];
|
||||
|
||||
onInit() {
|
||||
|
||||
}
|
||||
|
||||
//查询充值记录
|
||||
async UpdateGiftRecord(){
|
||||
return this.records = await API.GetGiftRecord();
|
||||
}
|
||||
//查询当天充值记录
|
||||
async UpdateGiftDayRecord(){
|
||||
return this.dayRecords = await API.GetGiftDayRecord();
|
||||
}
|
||||
|
||||
//查询指定礼包每天的购买次数
|
||||
getGiftDayRecordCount(giftId:number){
|
||||
return this.dayRecords.filter(item => item.giftCfgId == giftId).length;
|
||||
}
|
||||
|
||||
//查询礼包购买次数
|
||||
getGiftRecordCount(giftId:number){
|
||||
return this.records.filter(item => item.giftCfgId == giftId).length;
|
||||
}
|
||||
|
||||
//购买礼包
|
||||
async buy(giftId:number){
|
||||
await API.BuyGift(giftId);
|
||||
app.event.emit(GiftDataEnum.BUY);
|
||||
}
|
||||
|
||||
}
|
||||
|
9
JisolGameCocos/assets/script/data/GiftData.ts.meta
Normal file
9
JisolGameCocos/assets/script/data/GiftData.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "cab5c60b-8521-4aed-a3f1-a23f7751725b",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -38,7 +38,7 @@ export class ModeRender extends Component {
|
||||
let hitNode = instantiate(this.hitPrefab);
|
||||
|
||||
this.node.addChild(hitNode);
|
||||
hitNode.position = rolePos.add(v3(0,100,0));
|
||||
hitNode.position = rolePos.add(v3(0,40,0));
|
||||
|
||||
hitNode.getComponent(ModeRenderHitText).setText(info.hit);
|
||||
|
||||
|
@@ -17,10 +17,6 @@ export class TablePetIcon extends Component {
|
||||
|
||||
info:TB.TbGRole;
|
||||
|
||||
onLoad(){
|
||||
this.onUpdateView();
|
||||
}
|
||||
|
||||
//刷新页面
|
||||
onUpdateView(){
|
||||
|
||||
|
@@ -16,11 +16,21 @@ export class RewardClaimView extends JNGLayerBase {
|
||||
onJNLoad(data?: TbGEntity.TReward[]): void {
|
||||
super.onJNLoad(data);
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
onJNLoadAnimEnd(): void {
|
||||
this.onUpdateView();
|
||||
}
|
||||
|
||||
onUpdateView(){
|
||||
this.views.refreshData(this.data);
|
||||
|
||||
//逐个出现
|
||||
this.data.forEach((item,index) => {
|
||||
this.scheduleOnce(() => {
|
||||
this.views.addData(item);
|
||||
},.1 * index);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,30 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { RewardIcon } from './RewardIcon';
|
||||
import { TbGEntity } from '../../../config/data/schema';
|
||||
import JNScrollViewItem from '../../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollViewItem';
|
||||
import { tween } from 'cc';
|
||||
import { v3 } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('RewardIconScrollScaleAnim')
|
||||
export class RewardIconScrollScaleAnim extends JNScrollViewItem<TbGEntity.TReward> {
|
||||
|
||||
@property(RewardIcon)
|
||||
icon:RewardIcon;
|
||||
|
||||
onLoad(){
|
||||
//播放缩放动画
|
||||
this.node.scale = v3(0,0,0);
|
||||
tween(this.node)
|
||||
.to(.2,{scale:v3(1,1,1)})
|
||||
.start();
|
||||
}
|
||||
|
||||
onInit(data:TbGEntity.TReward){
|
||||
|
||||
this.icon.set(data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "fccbd792-47da-4c8d-a8f9-6ecb5daaea4e",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -128,6 +128,11 @@ export class MainView extends JNGLayerBase {
|
||||
app.layer.Open(GUI.PacksackView);
|
||||
}
|
||||
|
||||
//点击商店页面
|
||||
onClickShop(){
|
||||
app.layer.Open(GUI.ShopView);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
9
JisolGameCocos/assets/script/ui/Shop.meta
Normal file
9
JisolGameCocos/assets/script/ui/Shop.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "f9441538-3d5c-43d4-9bf1-1ede88d23161",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
53
JisolGameCocos/assets/script/ui/Shop/ShopGiftItem.ts
Normal file
53
JisolGameCocos/assets/script/ui/Shop/ShopGiftItem.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { TB, TbGEnum } from '../../config/data/schema';
|
||||
import JNScrollViewItem from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollViewItem';
|
||||
import { TD } from '../../App';
|
||||
import { Label } from 'cc';
|
||||
import JNScrollView from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
|
||||
import GiftData from '../../data/GiftData';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('ShopGiftItem')
|
||||
export class ShopGiftItem extends JNScrollViewItem<TB.TbGShop> {
|
||||
|
||||
@property(Label)
|
||||
giftName:Label; //礼包名称
|
||||
|
||||
@property(Label)
|
||||
giftLimit:Label; //限购
|
||||
|
||||
@property(JNScrollView)
|
||||
views:JNScrollView; //礼包列表
|
||||
|
||||
gift: TB.TbGGift;
|
||||
|
||||
onInit(data: TB.TbGShop): void {
|
||||
|
||||
this.gift = TD.TbGGift.get(data.giftId);
|
||||
|
||||
}
|
||||
|
||||
protected start(): void {
|
||||
|
||||
this.giftName.string = this.data.tig;
|
||||
|
||||
if(this.gift.limit == TbGEnum.TGiftLimit.Unlimited)
|
||||
this.giftLimit.string = "( 无限 )";
|
||||
if(this.gift.limit == TbGEnum.TGiftLimit.DayLimit)
|
||||
this.giftLimit.string = `每天( ${GiftData.getIns().getGiftDayRecordCount(this.gift.id)}/${this.gift.limitValue} )`;
|
||||
if(this.gift.limit == TbGEnum.TGiftLimit.Limit)
|
||||
this.giftLimit.string = `限制( ${GiftData.getIns().getGiftRecordCount(this.gift.id)}/${this.gift.limitValue} )`;
|
||||
|
||||
this.views.refreshData(this.gift.rewards);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//点击购买礼包
|
||||
async onClickBuy(){
|
||||
await GiftData.getIns().buy(this.gift.id)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "3c689f59-1914-4f82-b32f-9b60142cd8f8",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
43
JisolGameCocos/assets/script/ui/Shop/ShopView.ts
Normal file
43
JisolGameCocos/assets/script/ui/Shop/ShopView.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
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 { app, TD } from '../../App';
|
||||
import GiftData, { GiftDataEnum } from '../../data/GiftData';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//商店页面
|
||||
@ccclass('ShopView')
|
||||
export class ShopView extends JNLayerBase {
|
||||
|
||||
//商店礼包列表
|
||||
@property(JNScrollView)
|
||||
views:JNScrollView
|
||||
|
||||
async onJNLoad(data?: any) {
|
||||
|
||||
super.onJNLoad(data);
|
||||
|
||||
await this.onUpdateView();
|
||||
|
||||
//监听
|
||||
app.event.on(GiftDataEnum.BUY,this.onUpdateView,this)
|
||||
|
||||
}
|
||||
|
||||
onJNClose(): void {
|
||||
super.onJNClose();
|
||||
app.event.off(GiftDataEnum.BUY,this.onUpdateView,this)
|
||||
}
|
||||
|
||||
async onUpdateView() {
|
||||
|
||||
await GiftData.getIns().UpdateGiftRecord();
|
||||
await GiftData.getIns().UpdateGiftDayRecord();
|
||||
|
||||
this.views.refreshData(TD.TbGShop.getDataList());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
9
JisolGameCocos/assets/script/ui/Shop/ShopView.ts.meta
Normal file
9
JisolGameCocos/assets/script/ui/Shop/ShopView.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "eb3d9ece-55ba-4a24-8103-75b6ae2c3f4d",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -26,6 +26,7 @@ export enum GUI{
|
||||
MainOnHookView = "MainOnHookView", //挂机弹窗
|
||||
MapSelectView = "MapSelectView", //地图选择页面
|
||||
PacksackView = "PacksackView", //背包页面
|
||||
ShopView = "ShopView", //商店页面
|
||||
|
||||
/** 副本 */
|
||||
DungeonView = "DungeonView", //副本页面
|
||||
@@ -54,6 +55,12 @@ const BackOutScale:JNLayerAnimInfo = {
|
||||
front:JNLayerAnim.BackOutOpen,
|
||||
back:JNLayerAnim.BackInClose
|
||||
}
|
||||
const BackOutMove:JNLayerAnimInfo = {
|
||||
front:JNLayerAnim.Enlarge,
|
||||
back:JNLayerAnim.Smaller,
|
||||
frontInfo:{key:"position",start:v3(1280,0,0),end:v3(0,0,0)},
|
||||
backInfo:{key:"position",start:v3(0,0,0),end:v3(1280,0,0)}
|
||||
}
|
||||
|
||||
|
||||
//系统UI
|
||||
@@ -92,7 +99,7 @@ const UISystemConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
},
|
||||
},
|
||||
[GUI.RewardClaimView]:{
|
||||
layer:GLayer.View,
|
||||
layer:GLayer.Popup,
|
||||
uri: "prefab/ui/常用预制体/奖励/领取奖励页面",
|
||||
anims:BackOutScale
|
||||
},
|
||||
@@ -103,12 +110,7 @@ const UIMainConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
[GUI.MainChat]:{
|
||||
layer:GLayer.Popup,
|
||||
uri: "prefab/ui/主页/聊天/MainChatView",
|
||||
anims:{
|
||||
front:JNLayerAnim.Enlarge,
|
||||
back:JNLayerAnim.Smaller,
|
||||
frontInfo:{key:"position",start:v3(0,-1280,0),end:v3(0,0,0)},
|
||||
backInfo:{key:"position",start:v3(0,0,0),end:v3(0,-1280,0)}
|
||||
}
|
||||
anims:BackOutMove
|
||||
},
|
||||
[GUI.IntoBattleView]:{
|
||||
layer:GLayer.Popup,
|
||||
@@ -130,6 +132,11 @@ const UIMainConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
uri: "prefab/ui/资源/资源背包页面",
|
||||
anims:BackOutScale,
|
||||
},
|
||||
[GUI.ShopView]:{
|
||||
layer:GLayer.Popup,
|
||||
uri: "prefab/ui/商店/商店页面",
|
||||
anims:BackOutMove,
|
||||
},
|
||||
}
|
||||
|
||||
//宠物页面
|
||||
@@ -198,7 +205,12 @@ const UIGModeConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
[GUI.OnHookRinkingView]:{
|
||||
layer:GLayer.Popup,
|
||||
uri: "prefab/ui/模式/OnHook/OnHook排行榜",
|
||||
anims:BackOutScale
|
||||
anims:{
|
||||
front:JNLayerAnim.Enlarge,
|
||||
back:JNLayerAnim.Smaller,
|
||||
frontInfo:{key:"position",start:v3(1280,0,0),end:v3(0,0,0)},
|
||||
backInfo:{key:"position",start:v3(0,0,0),end:v3(1280,0,0)}
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user