初始版本可以去申请电子版权和软著了

This commit is contained in:
panfudan
2025-08-21 13:54:28 +08:00
parent 0a654d130a
commit 1b56cb7a8c
12 changed files with 1816 additions and 185 deletions

View File

@@ -98,8 +98,16 @@ export class GoodsComp extends Component {
}else if(this.goodsData.c_type==CType.FREE){
this.do_free()
}else if(this.goodsData.c_type==CType.DIAMOND){
if(smc.data.diamond<this.goodsData.cast){
oops.gui.toast("钻石不足")
return
}
this.do_diamond_cast()
}else if(this.goodsData.c_type==CType.GOLD){
if(smc.data.gold<this.goodsData.cast){
oops.gui.toast("金币不足")
return
}
this.do_gold_cast()
}
}

View File

@@ -23,15 +23,18 @@ export class HCardUICom extends Component {
update(deltaTime: number) {
}
to_update_hero(){
this.update_data(this.h_uuid,{type:this.type})
to_update_hero(event:any,args:any){
if(args.uuid==this.h_uuid){
console.log("[HCardUICom]:是我诶:",HeroInfo[args.uuid].name+args.uuid)
this.update_data(args.uuid,{type:this.type})
}
}
update_data(uuid:number,args:any){
this.type=args.type
if(args.slot) this.slot=args.slot
console.log("[HCardUICom]:update_data",uuid,this.type,this.slot,args)
this.h_uuid=uuid
this.node.getChildByName("in_fight").active=this.check_in_fight(uuid)
this.node.getChildByName("in_fight").active=this.check_in_fight()
let hero_data = HeroInfo[uuid]
let hero= this.node.getChildByName("hero")
let anm_path=hero_data.path
@@ -69,7 +72,7 @@ export class HCardUICom extends Component {
break
case HeroConSet.SELECT:
if(oops.gui.has(UIID.HeroSelect)) {
this.check_in_slot(this.h_uuid)
this.check_in_slot()
smc.setFightHero(this.slot,this.h_uuid,true)
oops.message.dispatchEvent(GameEvent.UpdateFightHero)
oops.gui.remove(UIID.HeroSelect)
@@ -77,18 +80,18 @@ export class HCardUICom extends Component {
break
}
}
check_in_slot(uuid:number){ //如果英雄在出战位,则移除久的出战位
check_in_slot(){ //如果英雄在出战位,则移除久的出战位
let heros=smc.fight_heros
for(let i=0;i<GameSet.HERO_NUM;i++){
if(heros[i]==uuid) {
if(heros[i]==this.h_uuid) {
smc.setFightHero(i,0,true)
}
}
}
check_in_fight(uuid:number){
check_in_fight(){
let heros=smc.fight_heros
for(let i=0;i<GameSet.HERO_NUM;i++){
if(heros[i]==uuid) return true
if(heros[i]==this.h_uuid) return true
}
return false
}

View File

@@ -1,10 +1,11 @@
import { _decorator, Animation, AnimationClip, Component, Label, Node, resources } from 'cc';
import { _decorator, Animation, AnimationClip, Component, Label, Node, resources, Sprite, SpriteFrame } from 'cc';
import { oops } from 'db://oops-framework/core/Oops';
import { UIID } from '../common/config/GameUIConfig';
import { getHeroList, getHeroStatsByLevel, getUpgradeResources, HeroInfo, HType } from '../common/config/heroSet';
import { getHeroList, getHeroStatsByLevel, getUpgradeResources, HeroInfo, HType, unlockHeroCost } from '../common/config/heroSet';
import { smc } from '../common/SingletonModuleComp';
import { GameEvent } from '../common/config/GameEvent';
import { NumberFormatter } from '../common/config/BoxSet';
import { Items } from '../common/config/Items';
const { ccclass, property } = _decorator;
@ccclass('HInfoComp')
@@ -22,22 +23,21 @@ export class HInfoComp extends Component {
}
update_data(uuid:number){
console.log("[HInfoComp]:update_data",uuid)
console.log("[HCardUICom]:update_data",uuid)
this.h_uuid=uuid
let hero_data = HeroInfo[uuid]
let hero= this.node.getChildByName("hero")
console.log("[HInfoComp]:update_data",uuid,hero_data,this.node)
let lv=smc.heros[uuid]?.lv??1
let anm_path=hero_data.path
resources.load("game/heros/hero/"+anm_path+"/idle", AnimationClip, (err, clip) => {
hero.getComponent(Animation).addClip(clip);
hero.getComponent(Animation).play("idle");
this.node.getChildByName("hero").getComponent(Animation).addClip(clip);
this.node.getChildByName("hero").getComponent(Animation).play("idle");
});
this.node.getChildByName("name").getComponent(Label).string=hero_data.name
this.node.getChildByName("lv").getChildByName("num").getComponent(Label).string=lv.toString()
this.node.getChildByName("skills").getChildByName("list2").getChildByName("luck").active= lv <5
this.node.getChildByName("skills").getChildByName("list3").getChildByName("luck").active= lv <10
this.node.getChildByName("skills").getChildByName("list4").getChildByName("luck").active= lv <15
this.node.getChildByName("skills").getChildByName("list2").getChildByName("lock").active= lv <5
this.node.getChildByName("skills").getChildByName("list3").getChildByName("lock").active= lv <10
this.node.getChildByName("skills").getChildByName("list4").getChildByName("lock").active= lv <15
let {hp,ap,def}=getHeroStatsByLevel(uuid,lv)
this.node.getChildByName("info").getChildByName("hp").getChildByName("num").getComponent(Label).string=hp.toString()
this.node.getChildByName("info").getChildByName("ap").getChildByName("num").getComponent(Label).string=ap.toString()
@@ -48,7 +48,7 @@ export class HInfoComp extends Component {
this.node.getChildByName("type").getChildByName("w").active=hero_data.type==HType.warrior
this.node.getChildByName("type").getChildByName("r").active=hero_data.type==HType.remote
this.node.getChildByName("type").getChildByName("m").active=hero_data.type==HType.mage
this.show_luck(smc.heros[uuid]?.lv??0)
this.show_lock(smc.heros[uuid]?.lv??0)
}
updata_need(experience:number,gold:number){
let need_node=this.node.getChildByName("upNeed").getChildByName("need")
@@ -57,29 +57,62 @@ export class HInfoComp extends Component {
need_node.getChildByName("exp").getChildByName("has").getComponent(Label).string=NumberFormatter.formatNumber(smc.data.exp)
need_node.getChildByName("gold").getChildByName("has").getComponent(Label).string=NumberFormatter.formatNumber(smc.data.gold)
}
show_luck(lv:number){
show_lock(lv:number){
this.node.getChildByName("upBtn").active=lv > 0
this.node.getChildByName("upNeed").active=lv > 0
this.node.getChildByName("luck").active=lv == 0
this.node.getChildByName("lock").active=lv == 0
this.node.getChildByName("unLock").active=lv == 0
let need_item=unlockHeroCost[HeroInfo[this.h_uuid].quality]
console.log("[HInfoComp]:show_lock item:item_uuid:hero_uuid:hero_data",Items[need_item.i_uuid],need_item.i_uuid,this.h_uuid,HeroInfo[this.h_uuid])
this.node.getChildByName("unLockNeed").getChildByName("need").getChildByName("has").getComponent(Label).string=smc.items[need_item.i_uuid]??0
this.node.getChildByName("unLockNeed").getChildByName("need").getChildByName("need").getComponent(Label).string=NumberFormatter.formatNumber(need_item.num)
let path="gui/items/"+Items[need_item.i_uuid].path
resources.load(path,SpriteFrame, (err, clip) => {
this.node.getChildByName("unLockNeed").getChildByName("need").getChildByName("icon").getComponent(Sprite).spriteFrame=clip
});
this.node.getChildByName("unLockNeed").active=lv == 0
}
uplockhero(){
let need_item=unlockHeroCost[HeroInfo[this.h_uuid].quality]
if(!smc.items[need_item.i_uuid]||smc.items[need_item.i_uuid]<need_item.num){
oops.gui.toast("["+Items[need_item.i_uuid].name+"]数量不足")
return
}
if(!smc.spendItem(need_item.i_uuid,need_item.num)){
smc.error()
return
}
if(!smc.addHero(this.h_uuid)){
smc.addItem(need_item.i_uuid,need_item.num,false)
oops.gui.toast("英雄< "+HeroInfo[this.h_uuid].name+" >解锁失败")
return
}
oops.gui.toast("英雄< "+HeroInfo[this.h_uuid].name+" >解锁成功")
this.update_data(this.h_uuid)
oops.message.dispatchEvent(GameEvent.UpdateHero, {uuid:this.h_uuid})
}
uplevel(){
let lv=smc.heros[this.h_uuid].lv
let {experience,gold}=getUpgradeResources(lv)
if(smc.data.exp<=experience||smc.data.gold<=gold){
if(smc.data.exp<experience||smc.data.gold<gold){
oops.gui.toast("经验或金币不足")
return
}
smc.spendGameProperty({exp:experience,gold:gold},false)
let result=smc.levelUpHero(this.h_uuid,experience,gold)
if(!result){
smc.addExp(experience,false)
smc.addGold(gold,false)
oops.gui.toast("网络出错了,升级失败,请重试")
if(!smc.spendGameProperty({exp:experience,gold:gold},false)){
smc.error()
return
}
if(!smc.levelUpHero(this.h_uuid)){
smc.addExp(experience,false)
smc.addGold(gold,false)
smc.error()
return
}
this.update_data(this.h_uuid)
oops.message.dispatchEvent(GameEvent.UpdateHero, {})
oops.gui.toast(`英雄< ${HeroInfo[this.h_uuid].name} >升级成功`)
oops.message.dispatchEvent(GameEvent.UpdateHero, {uuid:this.h_uuid})
}
next_hero(){
let heros=getHeroList()