This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2024-01-23 02:53:23 +08:00
parent c6710e7dfa
commit 26cc480866
27 changed files with 2061 additions and 988 deletions

View File

@@ -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.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`
// 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`
//重写UI
class JNGLayer extends JNLayer{

View File

@@ -66,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,450,camreaPos.z)
this.camera.node.worldPosition = v3(0,400,camreaPos.z)
}
//获取配置

View File

@@ -1212,18 +1212,14 @@ 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
if (_json_.type === undefined) { throw new Error() }
this.type = _json_.type
}
/**
* id
*/
readonly id: number
/**
* 备注
*/
@@ -1232,6 +1228,10 @@ export class TbGShop {
* 礼包Id
*/
readonly giftId: number
/**
* 0.点卷商店 1.金币商店
*/
readonly type: number
resolve(tables:Tables)
{
@@ -2012,23 +2012,23 @@ export class TbGGift{
export class TbGShop{
private _dataMap: Map<number, TB.TbGShop>
private _dataMap: Map<string, TB.TbGShop>
private _dataList: TB.TbGShop[]
constructor(_json_: any) {
this._dataMap = new Map<number, TB.TbGShop>()
this._dataMap = new Map<string, 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)
this._dataMap.set(_v.tig, _v)
}
}
getDataMap(): Map<number, TB.TbGShop> { return this._dataMap; }
getDataMap(): Map<string, TB.TbGShop> { return this._dataMap; }
getDataList(): TB.TbGShop[] { return this._dataList; }
get(key: number): TB.TbGShop | undefined { return this._dataMap.get(key); }
get(key: string): TB.TbGShop | undefined { return this._dataMap.get(key); }
resolve(tables:Tables)
{

View File

@@ -12,8 +12,9 @@ export default class GiftData extends BaseData{
records:GiftRecord[] = [];
dayRecords:GiftDayRecord[] = [];
onInit() {
async onInit() {
await this.UpdateGiftRecord();
await this.UpdateGiftDayRecord();
}
//查询充值记录
@@ -38,6 +39,8 @@ export default class GiftData extends BaseData{
//购买礼包
async buy(giftId:number){
await API.BuyGift(giftId);
await this.UpdateGiftRecord();
await this.UpdateGiftDayRecord();
app.event.emit(GiftDataEnum.BUY);
}

View File

@@ -119,7 +119,7 @@ export default class PetEquipData extends BaseData{
//获取指定宠物等级
getForgingBenchPetLevel(petId:number = this.info.forgingPetId){
let exp = this.info.forgingPetLevels[`${petId}`] || 0;
let list = TD.TbGRoleEquipLevel.getDataList().filter(info => info.exp <= exp);
let list = TD.TbGRoleEquipLevel.getDataList().filter(info => (exp-=info.exp) >= 0);
return list[list.length - 1].id;
}

View File

@@ -14,6 +14,7 @@ export enum ResourceType{
DungeonGold = 90004, //钥匙:金币副本
DungeonForgedStones = 90005, //钥匙:锻造石副本
Q1S = 90006, //魂:一品宠物魂
GiftCoupons = 90007, //兑换券
}
//资源刷新类型

View File

@@ -25,8 +25,6 @@ export class PetIcon extends Component {
info:PlayerPetOV;
onLoad(){
this.reset();
//监听
app.event.on(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this)
}
@@ -35,13 +33,6 @@ export class PetIcon extends Component {
app.event.off(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this)
}
//初始化
reset(){
this.starNode.active = false;
}
//信息更新
onUpdateInfo(info:PlayerPetOV){
if(this.info && info.petId == this.info.petId){
@@ -51,6 +42,9 @@ export class PetIcon extends Component {
//刷新页面
onUpdateView(){
this.starNode.active = false;
this.spine.skeletonData = app.battleRes.getRoleSpine(this.info.petTbId);
this.spine.setAnimation(0,UIPetAnim.std,true);
@@ -67,7 +61,6 @@ export class PetIcon extends Component {
//设置icon
set(info:PlayerPetOV){
this.reset();
this.info = info;
this.onUpdateView();
}

View File

@@ -5,6 +5,7 @@ import { TD } from '../../App';
import { Label } from 'cc';
import JNScrollView from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
import GiftData from '../../data/GiftData';
import NumberTools from '../../tools/NumberTools';
const { ccclass, property } = _decorator;
@ccclass('ShopGiftItem')
@@ -16,6 +17,9 @@ export class ShopGiftItem extends JNScrollViewItem<TB.TbGShop> {
@property(Label)
giftLimit:Label; //限购
@property(Label)
giftPrice:Label; //价格
@property(JNScrollView)
views:JNScrollView; //礼包列表
@@ -25,10 +29,6 @@ export class ShopGiftItem extends JNScrollViewItem<TB.TbGShop> {
this.gift = TD.TbGGift.get(data.giftId);
}
protected start(): void {
this.giftName.string = this.data.tig;
if(this.gift.limit == TbGEnum.TGiftLimit.Unlimited)
@@ -38,10 +38,11 @@ export class ShopGiftItem extends JNScrollViewItem<TB.TbGShop> {
if(this.gift.limit == TbGEnum.TGiftLimit.Limit)
this.giftLimit.string = `限制( ${GiftData.getIns().getGiftRecordCount(this.gift.id)}/${this.gift.limitValue} )`;
this.giftPrice.string = `${NumberTools.NumberStr(this.gift.exchanges[0].value)} ${TD.TbGResource.get(this.gift.exchanges[0].id).name}`;
this.views.refreshData(this.gift.rewards);
}
}
//点击购买礼包
async onClickBuy(){

View File

@@ -3,6 +3,9 @@ import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLay
import JNScrollView from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
import { app, TD } from '../../App';
import GiftData, { GiftDataEnum } from '../../data/GiftData';
import { Sprite } from 'cc';
import { color } from 'cc';
import { EventTouch } from 'cc';
const { ccclass, property } = _decorator;
//商店页面
@@ -13,6 +16,13 @@ export class ShopView extends JNLayerBase {
@property(JNScrollView)
views:JNScrollView
//商店标签
@property(Node)
tigs:Node;
//页面下标
index:number = 0;
async onJNLoad(data?: any) {
super.onJNLoad(data);
@@ -31,13 +41,24 @@ export class ShopView extends JNLayerBase {
async onUpdateView() {
await GiftData.getIns().UpdateGiftRecord();
await GiftData.getIns().UpdateGiftDayRecord();
this.tigs.children.forEach((item,index) => {
if(this.index == index){
item.getComponentInChildren(Sprite).color = color(0,0,0);
}else{
item.getComponentInChildren(Sprite).color = color(255,255,255);
}
})
this.views.refreshData(TD.TbGShop.getDataList());
this.views.refreshData(TD.TbGShop.getDataList().filter(item => item.type == this.index));
}
//切换下标
onClickTigs(touch:EventTouch){
this.index = touch.target.getSiblingIndex();
this.onUpdateView();
}
}