mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 18:26:23 +00:00
提交
This commit is contained in:
@@ -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`
|
||||
|
||||
|
@@ -8,6 +8,38 @@
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
export namespace TbGEnum {
|
||||
/**
|
||||
* 奖励类型
|
||||
*/
|
||||
export enum TReward {
|
||||
/**
|
||||
* 资源类型
|
||||
*/
|
||||
Resource = 1,
|
||||
}
|
||||
|
||||
}
|
||||
export namespace TbGEnum {
|
||||
/**
|
||||
* 礼包限购类型
|
||||
*/
|
||||
export enum TGiftLimit {
|
||||
/**
|
||||
* 无限购
|
||||
*/
|
||||
Unlimited = 1,
|
||||
/**
|
||||
* 限制次数
|
||||
*/
|
||||
Limit = 2,
|
||||
/**
|
||||
* 每天限制
|
||||
*/
|
||||
DayLimit = 3,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1028,7 +1060,7 @@ export class TDungeon {
|
||||
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);}}
|
||||
{ this.rewards = []; for(let _ele of _json_.rewards) { let _e; _e = new TbGEntity.TReward(_ele); this.rewards.push(_e);}}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1046,7 +1078,43 @@ export class TDungeon {
|
||||
/**
|
||||
* 关卡奖励
|
||||
*/
|
||||
readonly rewards: TbGEntity.TResource[]
|
||||
readonly rewards: TbGEntity.TReward[]
|
||||
|
||||
resolve(tables:Tables)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export namespace TbGEntity {
|
||||
/**
|
||||
* 奖励信息
|
||||
*/
|
||||
export class TReward {
|
||||
|
||||
constructor(_json_: any) {
|
||||
if (_json_.type === undefined) { throw new Error() }
|
||||
this.type = _json_.type
|
||||
if (_json_.id === undefined) { throw new Error() }
|
||||
this.id = _json_.id
|
||||
if (_json_.value === undefined) { throw new Error() }
|
||||
this.value = _json_.value
|
||||
}
|
||||
|
||||
/**
|
||||
* 奖励类型
|
||||
*/
|
||||
readonly type: TbGEnum.TReward
|
||||
/**
|
||||
* 奖励Id
|
||||
*/
|
||||
readonly id: number
|
||||
/**
|
||||
* 奖励数量
|
||||
*/
|
||||
readonly value: number
|
||||
|
||||
resolve(tables:Tables)
|
||||
{
|
||||
@@ -1083,6 +1151,96 @@ export class TbGSysDungeon160002 {
|
||||
}
|
||||
|
||||
|
||||
export namespace TB {
|
||||
export class TbGGift {
|
||||
|
||||
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_.tig === undefined) { throw new Error() }
|
||||
this.tig = _json_.tig
|
||||
if (_json_.limit === undefined) { throw new Error() }
|
||||
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_.rewards === undefined) { throw new Error() }
|
||||
{ this.rewards = []; for(let _ele of _json_.rewards) { let _e; _e = new TbGEntity.TReward(_ele); this.rewards.push(_e);}}
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼包唯一Id
|
||||
*/
|
||||
readonly id: number
|
||||
/**
|
||||
* 礼包名称
|
||||
*/
|
||||
readonly name: string
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
readonly tig: string
|
||||
/**
|
||||
* 礼包购买限制
|
||||
*/
|
||||
readonly limit: TbGEnum.TGiftLimit
|
||||
/**
|
||||
* 限购数量
|
||||
*/
|
||||
readonly limitValue: number
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
readonly price: number
|
||||
/**
|
||||
* 奖励
|
||||
*/
|
||||
readonly rewards: TbGEntity.TReward[]
|
||||
|
||||
resolve(tables:Tables)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export namespace TB {
|
||||
export class TbGShop {
|
||||
|
||||
constructor(_json_: any) {
|
||||
if (_json_.id === undefined) { throw new Error() }
|
||||
this.id = _json_.id
|
||||
if (_json_.tig === undefined) { throw new Error() }
|
||||
this.tig = _json_.tig
|
||||
if (_json_.giftId === undefined) { throw new Error() }
|
||||
this.giftId = _json_.giftId
|
||||
}
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
readonly id: number
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
readonly tig: string
|
||||
/**
|
||||
* 礼包Id
|
||||
*/
|
||||
readonly giftId: number
|
||||
|
||||
resolve(tables:Tables)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export class TbGGlobal{
|
||||
@@ -1821,6 +1979,70 @@ export class TbGSysDungeon160002{
|
||||
|
||||
|
||||
|
||||
export class TbGGift{
|
||||
private _dataMap: Map<number, TB.TbGGift>
|
||||
private _dataList: TB.TbGGift[]
|
||||
constructor(_json_: any) {
|
||||
this._dataMap = new Map<number, TB.TbGGift>()
|
||||
this._dataList = []
|
||||
for(var _json2_ of _json_) {
|
||||
let _v: TB.TbGGift
|
||||
_v = new TB.TbGGift(_json2_)
|
||||
this._dataList.push(_v)
|
||||
this._dataMap.set(_v.id, _v)
|
||||
}
|
||||
}
|
||||
|
||||
getDataMap(): Map<number, TB.TbGGift> { return this._dataMap; }
|
||||
getDataList(): TB.TbGGift[] { return this._dataList; }
|
||||
|
||||
get(key: number): TB.TbGGift | undefined { return this._dataMap.get(key); }
|
||||
|
||||
resolve(tables:Tables)
|
||||
{
|
||||
for(let data of this._dataList)
|
||||
{
|
||||
data.resolve(tables)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export class TbGShop{
|
||||
private _dataMap: Map<number, TB.TbGShop>
|
||||
private _dataList: TB.TbGShop[]
|
||||
constructor(_json_: any) {
|
||||
this._dataMap = new Map<number, TB.TbGShop>()
|
||||
this._dataList = []
|
||||
for(var _json2_ of _json_) {
|
||||
let _v: TB.TbGShop
|
||||
_v = new TB.TbGShop(_json2_)
|
||||
this._dataList.push(_v)
|
||||
this._dataMap.set(_v.id, _v)
|
||||
}
|
||||
}
|
||||
|
||||
getDataMap(): Map<number, TB.TbGShop> { return this._dataMap; }
|
||||
getDataList(): TB.TbGShop[] { return this._dataList; }
|
||||
|
||||
get(key: number): TB.TbGShop | undefined { return this._dataMap.get(key); }
|
||||
|
||||
resolve(tables:Tables)
|
||||
{
|
||||
for(let data of this._dataList)
|
||||
{
|
||||
data.resolve(tables)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
type JsonLoader = (file: string) => any
|
||||
|
||||
export class Tables {
|
||||
@@ -1870,6 +2092,10 @@ export class Tables {
|
||||
get TbGSysDungeon160001(): TbGSysDungeon160001 { return this._TbGSysDungeon160001;}
|
||||
private _TbGSysDungeon160002: TbGSysDungeon160002
|
||||
get TbGSysDungeon160002(): TbGSysDungeon160002 { return this._TbGSysDungeon160002;}
|
||||
private _TbGGift: TbGGift
|
||||
get TbGGift(): TbGGift { return this._TbGGift;}
|
||||
private _TbGShop: TbGShop
|
||||
get TbGShop(): TbGShop { return this._TbGShop;}
|
||||
|
||||
constructor(loader: JsonLoader) {
|
||||
this._TbGGlobal = new TbGGlobal(loader('tbgglobal'))
|
||||
@@ -1895,6 +2121,8 @@ export class Tables {
|
||||
this._TbGSysDungeon = new TbGSysDungeon(loader('tbgsysdungeon'))
|
||||
this._TbGSysDungeon160001 = new TbGSysDungeon160001(loader('tbgsysdungeon160001'))
|
||||
this._TbGSysDungeon160002 = new TbGSysDungeon160002(loader('tbgsysdungeon160002'))
|
||||
this._TbGGift = new TbGGift(loader('tbggift'))
|
||||
this._TbGShop = new TbGShop(loader('tbgshop'))
|
||||
|
||||
this._TbGGlobal.resolve(this)
|
||||
this._TbGRole.resolve(this)
|
||||
@@ -1919,5 +2147,7 @@ export class Tables {
|
||||
this._TbGSysDungeon.resolve(this)
|
||||
this._TbGSysDungeon160001.resolve(this)
|
||||
this._TbGSysDungeon160002.resolve(this)
|
||||
this._TbGGift.resolve(this)
|
||||
this._TbGShop.resolve(this)
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,11 @@ export const RData = (data:any,isTips:boolean = false) => {
|
||||
PlayerPetData.getIns().onUpdateOV(res.operation,res.pet); //刷新宠物
|
||||
})
|
||||
}
|
||||
//如果有 rewards 字段 表示要弹出获得资源
|
||||
if(data.data['rewards']){
|
||||
//弹出获得资源
|
||||
app.layer.Open(GUI.RewardClaimView,data.data['rewards'])
|
||||
}
|
||||
//弹出提示
|
||||
if(isTips){
|
||||
app.layer.Open(GUI.Tips,{text:data.data.msg});
|
||||
|
@@ -111,6 +111,7 @@ export default class GOnHookManager extends Singleton{
|
||||
|
||||
//获取下一只野怪
|
||||
getNextCreeps(){
|
||||
if(this.getKillSreepsIds().length > 50) return;
|
||||
if(!this.sreeps) return;
|
||||
let creeps = this.sreeps.get(this.sreeps.keys().next()?.value);
|
||||
this.sreeps.delete(creeps.key);
|
||||
|
9
JisolGameCocos/assets/script/ui/Consts/Reward.meta
Normal file
9
JisolGameCocos/assets/script/ui/Consts/Reward.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "92c659b6-f0f2-42ba-a6c1-eb30b3dee78b",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { JNGLayerBase } from '../../../components/JNComponent';
|
||||
import { TbGEntity } from '../../../config/data/schema';
|
||||
import JNScrollView from '../../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('RewardClaimView')
|
||||
export class RewardClaimView extends JNGLayerBase {
|
||||
|
||||
//奖励页面
|
||||
@property(JNScrollView)
|
||||
views:JNScrollView;
|
||||
|
||||
data:TbGEntity.TReward[] = [];
|
||||
|
||||
onJNLoad(data?: TbGEntity.TReward[]): void {
|
||||
super.onJNLoad(data);
|
||||
this.data = data;
|
||||
this.onUpdateView();
|
||||
}
|
||||
|
||||
onUpdateView(){
|
||||
this.views.refreshData(this.data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "e4a39951-dd79-4562-be9b-8325a60d612b",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
53
JisolGameCocos/assets/script/ui/Consts/Reward/RewardIcon.ts
Normal file
53
JisolGameCocos/assets/script/ui/Consts/Reward/RewardIcon.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { Label } from 'cc';
|
||||
import { Sprite } from 'cc';
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { TbGEntity, TbGEnum } from '../../../config/data/schema';
|
||||
import { TD } from '../../../App';
|
||||
import TbResource, { IconTypeEnum } from '../../../tools/TbResource';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('RewardIcon')
|
||||
export class RewardIcon extends Component {
|
||||
|
||||
//资源品质
|
||||
@property(Sprite)
|
||||
quality:Sprite;
|
||||
|
||||
//资源图标
|
||||
@property(Sprite)
|
||||
icon:Sprite;
|
||||
|
||||
//资源数量
|
||||
@property(Label)
|
||||
num:Label;
|
||||
|
||||
info:TbGEntity.TReward;
|
||||
|
||||
//设置icon
|
||||
set(info:TbGEntity.TReward){
|
||||
|
||||
this.info = info;
|
||||
if(info.type == TbGEnum.TReward.Resource)
|
||||
this.onUpdateResource();
|
||||
|
||||
}
|
||||
|
||||
//刷新资源
|
||||
onUpdateResource(){
|
||||
|
||||
let config = TD.TbGResource.get(this.info.id);
|
||||
|
||||
//设置ICON
|
||||
TbResource.loadSpriteIcon(IconTypeEnum.资源,config.icon,this.icon,this);
|
||||
//设置品质
|
||||
TbResource.loadSpriteIcon(IconTypeEnum.品质,config.quality,this.quality,this);
|
||||
|
||||
this.num.string = ``;
|
||||
if(this.info.value > 1){
|
||||
//显示数量
|
||||
this.num.string = `${this.info.value}`;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "8ac90e26-e207-4650-8340-4f780af3dc09",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import JNScrollViewItem from '../../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollViewItem';
|
||||
import { TbGEntity } from '../../../config/data/schema';
|
||||
import { RewardIcon } from './RewardIcon';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('RewardIconScroll')
|
||||
export class RewardIconScroll extends JNScrollViewItem<TbGEntity.TReward> {
|
||||
|
||||
@property(RewardIcon)
|
||||
icon:RewardIcon;
|
||||
|
||||
onInit(data:TbGEntity.TReward){
|
||||
|
||||
this.icon.set(data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "11083861-f00f-4d28-a231-df849bec8f86",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -57,6 +57,7 @@ export class IntoBattleView extends JNLayerBase {
|
||||
}
|
||||
|
||||
onJNClose(): void {
|
||||
super.onJNClose();
|
||||
//取消监听
|
||||
app.event.off(PlayerPetEvent.UPDATE_INFO,this.onPetMinus,this); //减少宠物
|
||||
}
|
||||
|
@@ -9,11 +9,12 @@ export enum GLayer{
|
||||
|
||||
export enum GUI{
|
||||
/** 系统UI */
|
||||
Login = "Login", //登录页面
|
||||
Loading = "Loading", //加载页面
|
||||
Tips = "Tips", //提示
|
||||
SelectionBox = "SelectionBox", //选择提示页面 (用于玩家确定该操作)
|
||||
Debugger = "Debugger", //Debugger
|
||||
Login = "Login", //登录页面
|
||||
Loading = "Loading", //加载页面
|
||||
Tips = "Tips", //提示
|
||||
SelectionBox = "SelectionBox", //选择提示页面 (用于玩家确定该操作)
|
||||
Debugger = "Debugger", //Debugger
|
||||
RewardClaimView = "RewardClaimView", //奖励领取通用界面
|
||||
|
||||
/** 新手引导 */
|
||||
NoviceNamingView = "NoviceNamingView", //新手引导页面 - 取名
|
||||
@@ -90,6 +91,11 @@ const UISystemConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
backInfo:{key:"position",start:v3(0,0,0),end:v3(-720,0,0)}
|
||||
},
|
||||
},
|
||||
[GUI.RewardClaimView]:{
|
||||
layer:GLayer.View,
|
||||
uri: "prefab/ui/常用预制体/奖励/领取奖励页面",
|
||||
anims:BackOutScale
|
||||
},
|
||||
}
|
||||
|
||||
//主页UI
|
||||
|
Reference in New Issue
Block a user