商店商品++
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -836,7 +836,7 @@
|
|||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": -338,
|
"x": -338,
|
||||||
"y": 5,
|
"y": 37,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
"_lrot": {
|
"_lrot": {
|
||||||
@@ -848,8 +848,8 @@
|
|||||||
},
|
},
|
||||||
"_lscale": {
|
"_lscale": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 1,
|
"x": 0.8,
|
||||||
"y": 1,
|
"y": 0.8,
|
||||||
"z": 1
|
"z": 1
|
||||||
},
|
},
|
||||||
"_mobility": 0,
|
"_mobility": 0,
|
||||||
@@ -1081,7 +1081,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 955,
|
"width": 720,
|
||||||
"height": 320
|
"height": 320
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -1103,14 +1103,14 @@
|
|||||||
"node": {
|
"node": {
|
||||||
"__id__": 45
|
"__id__": 45
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": false,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 59
|
"__id__": 59
|
||||||
},
|
},
|
||||||
"_alignFlags": 41,
|
"_alignFlags": 9,
|
||||||
"_target": null,
|
"_target": null,
|
||||||
"_left": 0,
|
"_left": 0,
|
||||||
"_right": -279,
|
"_right": 176,
|
||||||
"_top": 0,
|
"_top": 0,
|
||||||
"_bottom": 0,
|
"_bottom": 0,
|
||||||
"_horizontalCenter": 0,
|
"_horizontalCenter": 0,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -38,11 +38,12 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
exp:0,
|
exp:0,
|
||||||
}
|
}
|
||||||
shop:any={
|
shop:any={
|
||||||
daily_goods:[],
|
daily:[1001,1004,1002,1005],
|
||||||
weekly_goods:[],
|
weekly:[],
|
||||||
monthly_goods:[],
|
monthly:[],
|
||||||
special_goods:[],
|
special:[],
|
||||||
goods_count:[1,3,1,3],
|
goods_count:[1,1,3,3,10,10,10,10,10,10,10,10],
|
||||||
|
|
||||||
}
|
}
|
||||||
fight_heros:any={ 0:5001, 1:5005, 2:0, 3:0, 4:0, }
|
fight_heros:any={ 0:5001, 1:5005, 2:0, 3:0, 4:0, }
|
||||||
heros:any = {
|
heros:any = {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export enum GameEvent {
|
|||||||
MAP_MOVE_END_LEFT = "MAP_MOVE_END_LEFT",
|
MAP_MOVE_END_LEFT = "MAP_MOVE_END_LEFT",
|
||||||
MAP_MOVE_END_RIGHT = "MAP_MOVE_END_RIGHT",
|
MAP_MOVE_END_RIGHT = "MAP_MOVE_END_RIGHT",
|
||||||
UpdateHero = "UpdateHero",
|
UpdateHero = "UpdateHero",
|
||||||
|
UpdateFightHero = "UpdateFightHero",
|
||||||
CastSkill = "CastSkill",
|
CastSkill = "CastSkill",
|
||||||
CardsClose = "CardsClose",
|
CardsClose = "CardsClose",
|
||||||
CardRefresh = "CardRefresh",
|
CardRefresh = "CardRefresh",
|
||||||
|
|||||||
@@ -13,6 +13,15 @@ export enum CType{
|
|||||||
FREE=3, //免费
|
FREE=3, //免费
|
||||||
AD=4, //广告
|
AD=4, //广告
|
||||||
}
|
}
|
||||||
|
export const getRandomGoods=()=>{
|
||||||
|
let goods=[1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023]
|
||||||
|
// 随机打乱数组
|
||||||
|
for (let i = goods.length - 1; i > 0; i--) {
|
||||||
|
const j = Math.floor(Math.random() * (i + 1));
|
||||||
|
[goods[i], goods[j]] = [goods[j], goods[i]];
|
||||||
|
}
|
||||||
|
return goods.slice(0, 8);
|
||||||
|
}
|
||||||
export const Goods={
|
export const Goods={
|
||||||
1001:{i_uuid:Items[9001].uuid,num:10000,cast:0,type:GType.GOLD,c_type:CType.FREE},
|
1001:{i_uuid:Items[9001].uuid,num:10000,cast:0,type:GType.GOLD,c_type:CType.FREE},
|
||||||
1002:{i_uuid:Items[9002].uuid,num:100000,cast:0,type:GType.GOLD,c_type:CType.AD,},
|
1002:{i_uuid:Items[9002].uuid,num:100000,cast:0,type:GType.GOLD,c_type:CType.AD,},
|
||||||
@@ -21,4 +30,20 @@ export const Goods={
|
|||||||
1005:{i_uuid:Items[9005].uuid,num:200,cast:0,type:GType.DIAMOND,c_type:CType.FREE},
|
1005:{i_uuid:Items[9005].uuid,num:200,cast:0,type:GType.DIAMOND,c_type:CType.FREE},
|
||||||
1006:{i_uuid:Items[9006].uuid,num:300,cast:0,type:GType.DIAMOND,c_type:CType.AD},
|
1006:{i_uuid:Items[9006].uuid,num:300,cast:0,type:GType.DIAMOND,c_type:CType.AD},
|
||||||
1007:{i_uuid:Items[9007].uuid,num:500,cast:0,type:GType.DIAMOND,c_type:CType.AD},
|
1007:{i_uuid:Items[9007].uuid,num:500,cast:0,type:GType.DIAMOND,c_type:CType.AD},
|
||||||
|
1008:{i_uuid:Items[1001].uuid,num:1,cast:1,type:GType.ITEM,c_type:CType.DIAMOND},
|
||||||
|
1009:{i_uuid:Items[1002].uuid,num:1,cast:1,type:GType.ITEM,c_type:CType.DIAMOND},
|
||||||
|
1010:{i_uuid:Items[1003].uuid,num:1,cast:1,type:GType.ITEM,c_type:CType.DIAMOND},
|
||||||
|
1011:{i_uuid:Items[1004].uuid,num:1,cast:1,type:GType.ITEM,c_type:CType.DIAMOND},
|
||||||
|
1012:{i_uuid:Items[1005].uuid,num:1,cast:1,type:GType.ITEM,c_type:CType.DIAMOND},
|
||||||
|
1013:{i_uuid:Items[1006].uuid,num:1,cast:1,type:GType.ITEM,c_type:CType.DIAMOND},
|
||||||
|
1014:{i_uuid:Items[1007].uuid,num:1,cast:1,type:GType.ITEM,c_type:CType.DIAMOND},
|
||||||
|
1015:{i_uuid:Items[1008].uuid,num:1,cast:1,type:GType.ITEM,c_type:CType.DIAMOND},
|
||||||
|
1016:{i_uuid:Items[1001].uuid,num:1,cast:10000,type:GType.ITEM,c_type:CType.GOLD},
|
||||||
|
1017:{i_uuid:Items[1002].uuid,num:1,cast:100000,type:GType.ITEM,c_type:CType.GOLD},
|
||||||
|
1018:{i_uuid:Items[1003].uuid,num:1,cast:500000,type:GType.ITEM,c_type:CType.GOLD},
|
||||||
|
1019:{i_uuid:Items[1004].uuid,num:1,cast:100,type:GType.ITEM,c_type:CType.GOLD},
|
||||||
|
1020:{i_uuid:Items[1005].uuid,num:1,cast:200,type:GType.ITEM,c_type:CType.GOLD},
|
||||||
|
1021:{i_uuid:Items[1006].uuid,num:1,cast:300,type:GType.ITEM,c_type:CType.GOLD},
|
||||||
|
1022:{i_uuid:Items[1007].uuid,num:1,cast:500,type:GType.ITEM,c_type:CType.GOLD},
|
||||||
|
1023:{i_uuid:Items[1008].uuid,num:1,cast:1000,type:GType.ITEM,c_type:CType.GOLD},
|
||||||
}
|
}
|
||||||
@@ -41,21 +41,23 @@ export class GoodsComp extends Component {
|
|||||||
}
|
}
|
||||||
private update_btn( ){
|
private update_btn( ){
|
||||||
if(smc.shop.goods_count[this.goods_count_key]<=0){
|
if(smc.shop.goods_count[this.goods_count_key]<=0){
|
||||||
this.node.getChildByName("ad").active=false
|
this.node.getChildByName("btn").getChildByName("ad").active=false
|
||||||
this.node.getChildByName("free").active=false
|
this.node.getChildByName("btn").getChildByName("free").active=false
|
||||||
this.node.getChildByName("cast").active=false
|
this.node.getChildByName("btn").getChildByName("diamond").active=false
|
||||||
this.node.getChildByName("nothing").active=true
|
this.node.getChildByName("btn").getChildByName("gold").active=false
|
||||||
|
this.node.getChildByName("btn").getChildByName("nothing").active=true
|
||||||
this.node.getChildByName("btn").getComponent(Sprite).grayscale=true
|
this.node.getChildByName("btn").getComponent(Sprite).grayscale=true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.node.getChildByName("nothing").active=false
|
this.node.getChildByName("btn").getChildByName("nothing").active=false
|
||||||
this.node.getChildByName("btn").getComponent(Sprite).grayscale=false
|
this.node.getChildByName("btn").getComponent(Sprite).grayscale=false
|
||||||
this.node.getChildByName("ad").active=this.goodsData.c_type==CType.AD
|
this.node.getChildByName("btn").getChildByName("ad").active=this.goodsData.c_type==CType.AD
|
||||||
this.node.getChildByName("free").active=this.goodsData.c_type==CType.FREE
|
this.node.getChildByName("btn").getChildByName("free").active=this.goodsData.c_type==CType.FREE
|
||||||
this.node.getChildByName("cast").active=this.goodsData.c_type==(CType.DIAMOND||CType.GOLD)
|
this.node.getChildByName("btn").getChildByName("diamond").getChildByName("num").getComponent(Label).string=NumberFormatter.formatNumber(this.goodsData.cast)
|
||||||
this.node.getChildByName("cast").getChildByName("diamond").active=this.goodsData.c_type==CType.DIAMOND
|
this.node.getChildByName("btn").getChildByName("gold").getChildByName("num").getComponent(Label).string=NumberFormatter.formatNumber(this.goodsData.cast)
|
||||||
this.node.getChildByName("cast").getChildByName("gold").active=this.goodsData.c_type==CType.GOLD
|
this.node.getChildByName("btn").getChildByName("diamond").active=this.goodsData.c_type==CType.DIAMOND
|
||||||
this.node.getChildByName("cast").getChildByName("num").getComponent(Label).string=NumberFormatter.formatNumber(this.goodsData.cast)
|
this.node.getChildByName("btn").getChildByName("gold").active=this.goodsData.c_type==CType.GOLD
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 更新图标
|
* 更新图标
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export class HCardUICom extends Component {
|
|||||||
if(oops.gui.has(UIID.HeroSelect)) {
|
if(oops.gui.has(UIID.HeroSelect)) {
|
||||||
this.check_in_slot(this.h_uuid)
|
this.check_in_slot(this.h_uuid)
|
||||||
smc.setFightHero(this.slot,this.h_uuid,true)
|
smc.setFightHero(this.slot,this.h_uuid,true)
|
||||||
oops.message.dispatchEvent(GameEvent.UpdateHero)
|
oops.message.dispatchEvent(GameEvent.UpdateFightHero)
|
||||||
oops.gui.remove(UIID.HeroSelect)
|
oops.gui.remove(UIID.HeroSelect)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ export class HeroPageComp extends Component {
|
|||||||
let heros=getHeroList()
|
let heros=getHeroList()
|
||||||
console.log("[HeroPageComp]:update_heros",heros)
|
console.log("[HeroPageComp]:update_heros",heros)
|
||||||
let height= Math.ceil(heros.length/3)*315+30
|
let height= Math.ceil(heros.length/3)*315+30
|
||||||
this.node.getChildByName("main").getChildByName("view").getChildByName("heros").getComponent(UITransform).height=height
|
this.node.getChildByName("main").getChildByName("view").getChildByName("heros").getComponent(UITransform).setContentSize(720,height)
|
||||||
|
console.log("[HeroPageComp]:UITransform height",this.node.getChildByName("main").getChildByName("view").getChildByName("heros").getComponent(UITransform))
|
||||||
this.clear_heros()
|
this.clear_heros()
|
||||||
for(let i=0;i<heros.length;i++){
|
for(let i=0;i<heros.length;i++){
|
||||||
let hero=heros[i]
|
let hero=heros[i]
|
||||||
console.log("[HeroPageComp]:hero",hero)
|
|
||||||
if(hero){
|
if(hero){
|
||||||
this.load_hero(hero)
|
this.load_hero(hero)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export class HeroReadyCom extends Component {
|
|||||||
slot: number=0;
|
slot: number=0;
|
||||||
protected onLoad(): void {
|
protected onLoad(): void {
|
||||||
oops.message.on(GameEvent.UpdateHero,this.update_hero,this)
|
oops.message.on(GameEvent.UpdateHero,this.update_hero,this)
|
||||||
|
oops.message.on(GameEvent.UpdateFightHero,this.update_hero,this)
|
||||||
}
|
}
|
||||||
start() {
|
start() {
|
||||||
this.update_hero()
|
this.update_hero()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { _decorator, Component, instantiate, Node, Prefab } from 'cc';
|
import { _decorator, Component, instantiate, Node, Prefab, UITransform, Vec3 } from 'cc';
|
||||||
import { oops } from 'db://oops-framework/core/Oops';
|
import { oops } from 'db://oops-framework/core/Oops';
|
||||||
import { HCardUICom } from './HCardUICom';
|
import { HCardUICom } from './HCardUICom';
|
||||||
import { smc } from '../common/SingletonModuleComp';
|
import { smc } from '../common/SingletonModuleComp';
|
||||||
@@ -22,8 +22,9 @@ export class HeroSelectCom extends Component {
|
|||||||
}
|
}
|
||||||
update_heros(){
|
update_heros(){
|
||||||
let heros=smc.getHasHeroUUID()
|
let heros=smc.getHasHeroUUID()
|
||||||
console.log("[HeroPageComp]:update_heros",heros)
|
let width= heros.length*230+20
|
||||||
let width= heros.length*235+30
|
this.node.getChildByName("main").getChildByName("view").getChildByName("heros").getComponent(UITransform).setContentSize(width,320)
|
||||||
|
console.log("[HeroPageComp]:UITransform width",this.node.getChildByName("main").getChildByName("view").getChildByName("heros").getComponent(UITransform))
|
||||||
for(let i=0;i<heros.length;i++){
|
for(let i=0;i<heros.length;i++){
|
||||||
let hero=heros[i]
|
let hero=heros[i]
|
||||||
console.log("[HeroPageComp]:hero",hero)
|
console.log("[HeroPageComp]:hero",hero)
|
||||||
|
|||||||
@@ -1,21 +1,35 @@
|
|||||||
import { _decorator, Component, Node } from 'cc';
|
import { _decorator, Component, Node } from 'cc';
|
||||||
import { GoodsComp } from './GoodsComp';
|
import { GoodsComp } from './GoodsComp';
|
||||||
|
import { smc } from '../common/SingletonModuleComp';
|
||||||
|
import { getRandomGoods } from '../common/config/Goods';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('ShopPageComp')
|
@ccclass('ShopPageComp')
|
||||||
export class ShopPageComp extends Component {
|
export class ShopPageComp extends Component {
|
||||||
daily_goods:any[]=[1001,1002,1004,1006]
|
daily:any[]=[]
|
||||||
weekly_goods:any[]=[]
|
weekly:any[]=[]
|
||||||
monthly_goods:any[]=[]
|
monthly:any[]=[]
|
||||||
special_goods:any[]=[]
|
special:any[]=[]
|
||||||
start() {
|
start() {
|
||||||
this.update_daily_goods()
|
this.update_daily()
|
||||||
|
this.update_weekly()
|
||||||
}
|
}
|
||||||
update_daily_goods(){
|
update_daily(){
|
||||||
let items=this.node.getChildByName("daily").getChildByName("items").children
|
let items=this.node.getChildByName("daily").getChildByName("items").children
|
||||||
for(let i=0;i<items.length;i++){
|
for(let i=0;i<items.length;i++){
|
||||||
let goods=items[i]
|
let goods=items[i]
|
||||||
goods.getComponent(GoodsComp).update_data(this.daily_goods[i],i)
|
goods.getComponent(GoodsComp).update_data(smc.shop.daily[i],i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
update_weekly(){
|
||||||
|
if(smc.shop.weekly.length ==0) {
|
||||||
|
this.weekly=getRandomGoods()
|
||||||
|
}
|
||||||
|
smc.shop.weekly=this.weekly
|
||||||
|
let items=this.node.getChildByName("weekly").getChildByName("items").children
|
||||||
|
for(let i=0;i<items.length;i++){
|
||||||
|
let goods=items[i]
|
||||||
|
goods.getComponent(GoodsComp).update_data(smc.shop.weekly[i],i+4)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update(deltaTime: number) {
|
update(deltaTime: number) {
|
||||||
|
|||||||
Reference in New Issue
Block a user