永久数据不再mvvm显示
This commit is contained in:
@@ -358,7 +358,10 @@
|
|||||||
"_fillRange": 0,
|
"_fillRange": 0,
|
||||||
"_isTrimmedMode": true,
|
"_isTrimmedMode": true,
|
||||||
"_useGrayscale": false,
|
"_useGrayscale": false,
|
||||||
"_atlas": null,
|
"_atlas": {
|
||||||
|
"__uuid__": "9e1b429f-da49-4fbb-a36b-373f9d64b4b4",
|
||||||
|
"__expectedType__": "cc.SpriteAtlas"
|
||||||
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23154,7 +23154,7 @@
|
|||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 32,
|
"x": 25.6,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
@@ -23167,8 +23167,8 @@
|
|||||||
},
|
},
|
||||||
"_lscale": {
|
"_lscale": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 0.5,
|
"x": 0.3,
|
||||||
"y": 0.5,
|
"y": 0.3,
|
||||||
"z": 1
|
"z": 1
|
||||||
},
|
},
|
||||||
"_mobility": 0,
|
"_mobility": 0,
|
||||||
@@ -23293,7 +23293,7 @@
|
|||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 215.048828125,
|
"x": 153.89921875,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
@@ -23334,7 +23334,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 149.048828125,
|
"width": 100.69921875,
|
||||||
"height": 54.4
|
"height": 54.4
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -23373,8 +23373,8 @@
|
|||||||
"_string": "{{0:kmbt}}",
|
"_string": "{{0:kmbt}}",
|
||||||
"_horizontalAlign": 2,
|
"_horizontalAlign": 2,
|
||||||
"_verticalAlign": 1,
|
"_verticalAlign": 1,
|
||||||
"_actualFontSize": 30,
|
"_actualFontSize": 20,
|
||||||
"_fontSize": 30,
|
"_fontSize": 20,
|
||||||
"_fontFamily": "Arial",
|
"_fontFamily": "Arial",
|
||||||
"_lineHeight": 40,
|
"_lineHeight": 40,
|
||||||
"_overflow": 0,
|
"_overflow": 0,
|
||||||
@@ -23476,7 +23476,7 @@
|
|||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 217.048828125,
|
"x": 155.89921875,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
@@ -23635,7 +23635,7 @@
|
|||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 231.3837890625,
|
"x": 170.2341796875,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
@@ -23676,7 +23676,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 54.0537109375,
|
"width": 37.369140625,
|
||||||
"height": 54.4
|
"height": 54.4
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -23715,8 +23715,8 @@
|
|||||||
"_string": "999",
|
"_string": "999",
|
||||||
"_horizontalAlign": 0,
|
"_horizontalAlign": 0,
|
||||||
"_verticalAlign": 1,
|
"_verticalAlign": 1,
|
||||||
"_actualFontSize": 30,
|
"_actualFontSize": 20,
|
||||||
"_fontSize": 30,
|
"_fontSize": 20,
|
||||||
"_fontFamily": "Arial",
|
"_fontFamily": "Arial",
|
||||||
"_lineHeight": 40,
|
"_lineHeight": 40,
|
||||||
"_overflow": 0,
|
"_overflow": 0,
|
||||||
@@ -23936,7 +23936,7 @@
|
|||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 32,
|
"x": 25.6,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
@@ -23949,8 +23949,8 @@
|
|||||||
},
|
},
|
||||||
"_lscale": {
|
"_lscale": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 0.5,
|
"x": 0.3,
|
||||||
"y": 0.5,
|
"y": 0.3,
|
||||||
"z": 1
|
"z": 1
|
||||||
},
|
},
|
||||||
"_mobility": 0,
|
"_mobility": 0,
|
||||||
@@ -24075,7 +24075,7 @@
|
|||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 215.048828125,
|
"x": 153.89921875,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
@@ -24116,7 +24116,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 149.048828125,
|
"width": 100.69921875,
|
||||||
"height": 54.4
|
"height": 54.4
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -24155,8 +24155,8 @@
|
|||||||
"_string": "{{0:kmbt}}",
|
"_string": "{{0:kmbt}}",
|
||||||
"_horizontalAlign": 2,
|
"_horizontalAlign": 2,
|
||||||
"_verticalAlign": 1,
|
"_verticalAlign": 1,
|
||||||
"_actualFontSize": 30,
|
"_actualFontSize": 20,
|
||||||
"_fontSize": 30,
|
"_fontSize": 20,
|
||||||
"_fontFamily": "Arial",
|
"_fontFamily": "Arial",
|
||||||
"_lineHeight": 40,
|
"_lineHeight": 40,
|
||||||
"_overflow": 0,
|
"_overflow": 0,
|
||||||
@@ -24258,7 +24258,7 @@
|
|||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 217.048828125,
|
"x": 155.89921875,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
@@ -24417,7 +24417,7 @@
|
|||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 231.3837890625,
|
"x": 170.2341796875,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
@@ -24458,7 +24458,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 54.0537109375,
|
"width": 37.369140625,
|
||||||
"height": 54.4
|
"height": 54.4
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -24497,8 +24497,8 @@
|
|||||||
"_string": "999",
|
"_string": "999",
|
||||||
"_horizontalAlign": 0,
|
"_horizontalAlign": 0,
|
||||||
"_verticalAlign": 1,
|
"_verticalAlign": 1,
|
||||||
"_actualFontSize": 30,
|
"_actualFontSize": 20,
|
||||||
"_fontSize": 30,
|
"_fontSize": 20,
|
||||||
"_fontFamily": "Arial",
|
"_fontFamily": "Arial",
|
||||||
"_lineHeight": 40,
|
"_lineHeight": 40,
|
||||||
"_overflow": 0,
|
"_overflow": 0,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -56,14 +56,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
vmdata: any = {
|
vmdata: any = {
|
||||||
game_over:false,
|
game_over:false,
|
||||||
game_pause:false,
|
game_pause:false,
|
||||||
data:{
|
|
||||||
score:0,
|
|
||||||
mission:1,
|
|
||||||
gold:100, //升级主要资源
|
|
||||||
diamond:100, //商店购买 及 双倍奖励资源
|
|
||||||
meat:0,
|
|
||||||
exp:0,
|
|
||||||
},
|
|
||||||
mission_data:{
|
mission_data:{
|
||||||
mon_num:0,//怪物数量
|
mon_num:0,//怪物数量
|
||||||
hero_num:0,//英雄数量
|
hero_num:0,//英雄数量
|
||||||
|
|||||||
@@ -68,3 +68,51 @@ export enum QualitySet{
|
|||||||
PURPLE=2,
|
PURPLE=2,
|
||||||
ORANGE=3,
|
ORANGE=3,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 数字格式化工具函数 */
|
||||||
|
export class NumberFormatter {
|
||||||
|
/**
|
||||||
|
* 将数字转换为易读格式
|
||||||
|
* @param num 要转换的数字
|
||||||
|
* @returns 格式化后的字符串
|
||||||
|
* 例如:1234 -> "1.2k", 1234567 -> "1.2M", 1234567890 -> "1.2B"
|
||||||
|
*/
|
||||||
|
static formatNumber(num: number): string {
|
||||||
|
if (num < 1000) {
|
||||||
|
return num.toString();
|
||||||
|
} else if (num < 1000000) {
|
||||||
|
// 5位数用k表示 (1000-999999)
|
||||||
|
return (num / 1000).toFixed(1).replace(/\.0$/, '') + 'k';
|
||||||
|
} else if (num < 1000000000) {
|
||||||
|
// 7位数用M表示 (1000000-999999999)
|
||||||
|
return (num / 1000000).toFixed(1).replace(/\.0$/, '') + 'M';
|
||||||
|
} else if (num < 1000000000000) {
|
||||||
|
// 10位数用B表示 (1000000000-999999999999)
|
||||||
|
return (num / 1000000000).toFixed(1).replace(/\.0$/, '') + 'B';
|
||||||
|
} else {
|
||||||
|
// 更大的数字用T表示
|
||||||
|
return (num / 1000000000000).toFixed(1).replace(/\.0$/, '') + 'T';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将数字转换为中文格式
|
||||||
|
* @param num 要转换的数字
|
||||||
|
* @returns 中文格式的字符串
|
||||||
|
* 例如:1234 -> "1.2千", 1234567 -> "1.2百万"
|
||||||
|
*/
|
||||||
|
static formatNumberChinese(num: number): string {
|
||||||
|
if (num < 10000) {
|
||||||
|
return num.toString();
|
||||||
|
} else if (num < 100000000) {
|
||||||
|
// 万级别
|
||||||
|
return (num / 10000).toFixed(1).replace(/\.0$/, '') + '万';
|
||||||
|
} else if (num < 1000000000000) {
|
||||||
|
// 亿级别
|
||||||
|
return (num / 100000000).toFixed(1).replace(/\.0$/, '') + '亿';
|
||||||
|
} else {
|
||||||
|
// 万亿级别
|
||||||
|
return (num / 1000000000000).toFixed(1).replace(/\.0$/, '') + '万亿';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,17 +15,12 @@ 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",
|
||||||
MSSelected = "MSSelected",
|
|
||||||
LifeChange = "LifeChange",
|
|
||||||
CastSkill = "CastSkill",
|
CastSkill = "CastSkill",
|
||||||
CardsClose = "CardsClose",
|
CardsClose = "CardsClose",
|
||||||
CardRefresh = "CardRefresh",
|
CardRefresh = "CardRefresh",
|
||||||
UseCard = "UseCard",
|
|
||||||
UseHeroCard = "UseHeroCard",
|
UseHeroCard = "UseHeroCard",
|
||||||
UseSkillCard = "UseSkillCard",
|
UseSkillCard = "UseSkillCard",
|
||||||
UseSpecialCard = "UseSpecialCard",
|
UseSpecialCard = "UseSpecialCard",
|
||||||
MaxSkill = "MaxSkill",
|
|
||||||
UseEquipCard = "UseEquipCard",
|
|
||||||
CallHero = "CallHero",
|
CallHero = "CallHero",
|
||||||
Zhaohuan = "Zhaohuan",
|
Zhaohuan = "Zhaohuan",
|
||||||
MissionLoss = "MissionLoss",
|
MissionLoss = "MissionLoss",
|
||||||
@@ -38,7 +33,6 @@ export enum GameEvent {
|
|||||||
EnhancementSelect = "EnhancementSelect",
|
EnhancementSelect = "EnhancementSelect",
|
||||||
CanUpdateLv = "CanUpdateLv",
|
CanUpdateLv = "CanUpdateLv",
|
||||||
UseEnhancement = "UseEnhancement",
|
UseEnhancement = "UseEnhancement",
|
||||||
LuckCardUsed = "LuckCardUsed",
|
|
||||||
MasterCalled = "MasterCalled",
|
MasterCalled = "MasterCalled",
|
||||||
FightStart = "FightStart",
|
FightStart = "FightStart",
|
||||||
FightPause = "FightPause",
|
FightPause = "FightPause",
|
||||||
@@ -47,23 +41,12 @@ export enum GameEvent {
|
|||||||
MissionEnd = "MissionEnd",
|
MissionEnd = "MissionEnd",
|
||||||
MissionComplete = "MissionComplete",//战斗结算完成
|
MissionComplete = "MissionComplete",//战斗结算完成
|
||||||
CastHeroSkill = "CastHeroSkill",
|
CastHeroSkill = "CastHeroSkill",
|
||||||
EquipChange = "EquipChange",
|
|
||||||
EquipAdd = "EquipAdd",
|
EquipAdd = "EquipAdd",
|
||||||
EquipRemove = "EquipRemove",
|
|
||||||
EquipSelect = "EquipSelect",
|
EquipSelect = "EquipSelect",
|
||||||
FuncSelect = "FuncSelect",
|
FuncSelect = "FuncSelect",
|
||||||
TalentSelect = "TalentSelect",
|
TalentSelect = "TalentSelect",
|
||||||
UseTalentCard = "UseTalentCard",
|
UseTalentCard = "UseTalentCard",
|
||||||
RemoveTalent = "RemoveTalent",
|
|
||||||
ChangeTalent = "ChangeTalent",
|
|
||||||
RefreshCard = "RefreshCard",
|
|
||||||
NewWave = "NewWave",
|
NewWave = "NewWave",
|
||||||
ChangeATK = "ChangeATK",
|
|
||||||
ChangeATK_EQUIP_SPECIAL_ATTR = "ChangeATK_EQUIP_SPECIAL_ATTR",
|
|
||||||
UpdateVMData = "UpdateVMData",
|
|
||||||
UpdateHP = "UpdateHP",
|
|
||||||
APChange = "APChange",
|
|
||||||
EXPUP = "EXPUP",
|
|
||||||
AD_BACK_TRUE = "AD_BACK_TRUE",
|
AD_BACK_TRUE = "AD_BACK_TRUE",
|
||||||
AD_BACK_FALSE = "AD_BACK_FALSE",
|
AD_BACK_FALSE = "AD_BACK_FALSE",
|
||||||
DO_AD_BACK = "DO_AD_BACK",
|
DO_AD_BACK = "DO_AD_BACK",
|
||||||
@@ -72,4 +55,8 @@ export enum GameEvent {
|
|||||||
HeroLvUp = "HeroLvUp",
|
HeroLvUp = "HeroLvUp",
|
||||||
MonDead = "MonDead",
|
MonDead = "MonDead",
|
||||||
HeroDead = "HeroDead",
|
HeroDead = "HeroDead",
|
||||||
|
GOLD_UPDATE = "GOLD_UPDATE",
|
||||||
|
DIAMOND_UPDATE = "DIAMOND_UPDATE",
|
||||||
|
MEAT_UPDATE = "MEAT_UPDATE",
|
||||||
|
MISSION_UPDATE = "MISSION_UPDATE",
|
||||||
}
|
}
|
||||||
@@ -17,121 +17,16 @@ const { ccclass, property } = _decorator;
|
|||||||
export class HeroConComp extends CCComp {
|
export class HeroConComp extends CCComp {
|
||||||
private heroView: HeroViewComp = null;
|
private heroView: HeroViewComp = null;
|
||||||
|
|
||||||
// Buff处理方法映射表
|
|
||||||
private static readonly BUFF_HANDLERS = new Map<BuffAttr, string>([
|
|
||||||
[BuffAttr.AP, 'handleAPBuff'],
|
|
||||||
[BuffAttr.ATK, 'handleATKBuff'],
|
|
||||||
[BuffAttr.ATK_CD, 'handleSpeedBuff'],
|
|
||||||
[BuffAttr.DEF, 'handleDefBuff'],
|
|
||||||
[BuffAttr.HP, 'handleHPBuff'], // 生命值比例
|
|
||||||
[BuffAttr.HP_MAX, 'handleHPMaxBuff'], // 生命值数值
|
|
||||||
[BuffAttr.CRITICAL, 'handleCritBuff'],
|
|
||||||
[BuffAttr.CRITICAL_DMG, 'handleCritDmgBuff'],
|
|
||||||
[BuffAttr.DODGE, 'handleDodgeBuff'],
|
|
||||||
[BuffAttr.PUNCTURE, 'handlePunctureBuff'],
|
|
||||||
[BuffAttr.PUNCTURE_DMG, 'handlePunctureDmgBuff'],
|
|
||||||
[BuffAttr.FROST_RATIO, 'handleFrostBuff'],
|
|
||||||
[BuffAttr.KNOCKBACK, 'handleKnockbackBuff'],
|
|
||||||
[BuffAttr.STUN_RATIO, 'handleStunBuff'],
|
|
||||||
[BuffAttr.REFLECT, 'handleReflectBuff'],
|
|
||||||
[BuffAttr.LIFESTEAL, 'handleLifestealBuff']
|
|
||||||
]);
|
|
||||||
|
|
||||||
protected onLoad(): void {
|
protected onLoad(): void {
|
||||||
this.heroView = this.node.getComponent(HeroViewComp);
|
this.heroView = this.node.getComponent(HeroViewComp);
|
||||||
this.registerEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private registerEvents(): void {
|
|
||||||
this.on(GameEvent.EquipAdd, this.onEquipAdd, this);
|
|
||||||
this.on(GameEvent.EquipChange, this.onEquipChange, this);
|
|
||||||
this.on(GameEvent.FightReady, this.onFightReady, this);
|
|
||||||
this.on(GameEvent.UseSpecialCard, this.onUseSpecialCard, this);
|
|
||||||
this.on(GameEvent.UseEnhancement, this.onUseEnhancement, this);
|
|
||||||
this.on(GameEvent.UseTalentCard, this.onUseTalentCard, this);
|
|
||||||
this.on(GameEvent.RemoveTalent, this.onRemoveTalentCard, this);
|
|
||||||
this.on(GameEvent.LuckCardUsed, this.onLuckCardUsed, this);
|
|
||||||
}
|
|
||||||
private onEquipAdd(e: GameEvent, data: any): void {
|
|
||||||
const equip = EquipInfo[data.uuid];
|
|
||||||
if (!equip?.buff) return;
|
|
||||||
|
|
||||||
equip.buff
|
|
||||||
.filter(buff => buff.target === EquipAttrTarget.HERO)
|
|
||||||
.forEach(buff => this.applyBuff(buff.type, buff.value));
|
|
||||||
}
|
|
||||||
|
|
||||||
private onEquipChange(e: GameEvent, data: any): void {
|
|
||||||
// TODO: 处理装备变更逻辑
|
|
||||||
}
|
|
||||||
|
|
||||||
private onFightReady(e: GameEvent, data: any): void {
|
|
||||||
// TODO: 处理战斗准备逻辑
|
|
||||||
}
|
|
||||||
|
|
||||||
private onUseSpecialCard(e: GameEvent, data: any): void {
|
|
||||||
// TODO: 处理特殊卡牌使用逻辑
|
|
||||||
}
|
|
||||||
private onUseEnhancement(e: GameEvent, data: any): void {
|
|
||||||
const enhancementMap = {
|
|
||||||
[EnhancementType.ATTACK]: () => this.handleATKBuff(data.value),
|
|
||||||
[EnhancementType.ATTACK_SPEED]: () => this.handleSpeedBuff(data.value),
|
|
||||||
[EnhancementType.HEALTH]: () => this.handleHPMaxBuff(data.value),
|
|
||||||
[EnhancementType.DEF]: () => this.handleDefBuff(data.value)
|
|
||||||
};
|
|
||||||
|
|
||||||
enhancementMap[data.type]?.();
|
|
||||||
}
|
|
||||||
|
|
||||||
private onUseTalentCard(e: GameEvent, data: any): void {
|
|
||||||
const talent = TalentList[data.uuid];
|
|
||||||
if (talent) {
|
|
||||||
this.applyBuff(talent.buffType, talent.value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private onRemoveTalentCard(e: GameEvent, data: any): void {
|
|
||||||
const talent = TalentList[data.uuid];
|
|
||||||
if (talent) {
|
|
||||||
this.applyBuff(talent.buffType, -talent.value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private onLuckCardUsed(e: GameEvent, card: any): void {
|
|
||||||
switch (card.type) {
|
|
||||||
case SuperCardsType.BUFF:
|
|
||||||
this.applyBuff(card.value1, card.value2);
|
|
||||||
break;
|
|
||||||
case SuperCardsType.AOE:
|
|
||||||
// TODO: 处理AOE技能
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/** 统一的Buff应用方法 */
|
|
||||||
private applyBuff(buffType: BuffAttr, value: number): void {
|
|
||||||
const handlerName = HeroConComp.BUFF_HANDLERS.get(buffType);
|
|
||||||
if (handlerName && typeof this[handlerName] === 'function') {
|
|
||||||
this[handlerName](value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Buff处理方法
|
|
||||||
private handleAPBuff(value: number): void { this.heroView.apply_buff(BuffAttr.AP, value); }
|
|
||||||
private handleATKBuff(value: number): void { this.heroView.apply_buff(BuffAttr.ATK, value); }
|
|
||||||
private handleSpeedBuff(value: number): void { this.heroView.apply_buff(BuffAttr.ATK_CD, value); }
|
|
||||||
private handleDefBuff(value: number): void { this.heroView.apply_buff(BuffAttr.DEF, value); }
|
|
||||||
private handleHPBuff(value: number): void { this.heroView.apply_buff(BuffAttr.HP, value); }
|
|
||||||
private handleHPMaxBuff(value: number): void { this.heroView.apply_buff(BuffAttr.HP_MAX, value); }
|
|
||||||
private handleCritBuff(value: number): void { this.heroView.apply_buff(BuffAttr.CRITICAL, value); }
|
|
||||||
private handleCritDmgBuff(value: number): void { this.heroView.apply_buff(BuffAttr.CRITICAL_DMG, value); }
|
|
||||||
private handleDodgeBuff(value: number): void { this.heroView.apply_buff(BuffAttr.DODGE, value); }
|
|
||||||
private handlePunctureBuff(value: number): void { this.heroView.apply_buff(BuffAttr.PUNCTURE, value); }
|
|
||||||
private handlePunctureDmgBuff(value: number): void { this.heroView.apply_buff(BuffAttr.PUNCTURE_DMG, value); }
|
|
||||||
private handleFrostBuff(value: number): void { this.heroView.apply_buff(BuffAttr.FROST_RATIO, value); }
|
|
||||||
private handleKnockbackBuff(value: number): void { this.heroView.apply_buff(BuffAttr.KNOCKBACK, value); }
|
|
||||||
private handleStunBuff(value: number): void { this.heroView.apply_buff(BuffAttr.STUN_RATIO, value); }
|
|
||||||
private handleReflectBuff(value: number): void { this.heroView.apply_buff(BuffAttr.REFLECT, value); }
|
|
||||||
private handleLifestealBuff(value: number): void { this.heroView.apply_buff(BuffAttr.LIFESTEAL, value); }
|
|
||||||
/** 组件重置 */
|
/** 组件重置 */
|
||||||
reset(): void {
|
reset(): void {
|
||||||
this.node.destroy();
|
this.node.destroy();
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ export class HeroViewComp extends CCComp {
|
|||||||
onLoad() {
|
onLoad() {
|
||||||
this.as = this.getComponent(HeroSpine);
|
this.as = this.getComponent(HeroSpine);
|
||||||
//console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON)
|
//console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON)
|
||||||
this.on(GameEvent.EXPUP,this.exp_up,this)
|
|
||||||
this.on(GameEvent.HeroLvUp,this.to_update_lv,this)
|
this.on(GameEvent.HeroLvUp,this.to_update_lv,this)
|
||||||
this.on(GameEvent.FightEnd,this.do_fight_end,this)
|
this.on(GameEvent.FightEnd,this.do_fight_end,this)
|
||||||
const collider = this.node.getComponent(BoxCollider2D);
|
const collider = this.node.getComponent(BoxCollider2D);
|
||||||
@@ -280,6 +279,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
for(let i=0;i<drop_item.length;i++){
|
for(let i=0;i<drop_item.length;i++){
|
||||||
let d_item=drop_item[i]
|
let d_item=drop_item[i]
|
||||||
smc.addItem(d_item.item_uuid,d_item.count)
|
smc.addItem(d_item.item_uuid,d_item.count)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(exp>0){
|
if(exp>0){
|
||||||
@@ -287,9 +287,11 @@ export class HeroViewComp extends CCComp {
|
|||||||
}
|
}
|
||||||
if(gold>0){
|
if(gold>0){
|
||||||
smc.addGold(gold)
|
smc.addGold(gold)
|
||||||
|
oops.message.dispatchEvent(GameEvent.GOLD_UPDATE)
|
||||||
}
|
}
|
||||||
if(diamond>0){
|
if(diamond>0){
|
||||||
smc.addDiamond(diamond)
|
smc.addDiamond(diamond)
|
||||||
|
oops.message.dispatchEvent(GameEvent.DIAMOND_UPDATE)
|
||||||
}
|
}
|
||||||
console.log("[HeroViewComp]:do_drop",this.hero_uuid,drop_item,exp,gold,diamond)
|
console.log("[HeroViewComp]:do_drop",this.hero_uuid,drop_item,exp,gold,diamond)
|
||||||
}
|
}
|
||||||
@@ -528,11 +530,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
//console.log("[HeroViewComp]:crit",crit)
|
//console.log("[HeroViewComp]:crit",crit)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// dead(){
|
|
||||||
// this.BUFFCOMP.dead()
|
|
||||||
// this.to_drop()
|
|
||||||
|
|
||||||
// }
|
|
||||||
do_dead_trigger(){ //死亡特殊处理
|
do_dead_trigger(){ //死亡特殊处理
|
||||||
if(this.is_dead||this.fac==FacSet.MON) return
|
if(this.is_dead||this.fac==FacSet.MON) return
|
||||||
|
|
||||||
@@ -556,13 +554,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
// this.node.setPosition(HeroPos[this.fight_pos].pos)
|
// this.node.setPosition(HeroPos[this.fight_pos].pos)
|
||||||
// this.BUFFCOMP.heathed()
|
// this.BUFFCOMP.heathed()
|
||||||
// }
|
// }
|
||||||
//掉落物品
|
|
||||||
to_drop(){
|
|
||||||
// let Drops = getMonsterDrops(1, MonsterType.Normal, 1.2);
|
|
||||||
// if(this.is_boss) Drops =getMonsterDrops(1, MonsterType.Elite, 1.2);
|
|
||||||
// if(this.is_big_boss) Drops =getMonsterDrops(1, MonsterType.Boss, 1.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
to_console(value:any,value2:any=null,value3:any=null){
|
to_console(value:any,value2:any=null,value3:any=null){
|
||||||
//console.log("["+this.scale+this.hero_name+']'+value,value2,value3)
|
//console.log("["+this.scale+this.hero_name+']'+value,value2,value3)
|
||||||
}
|
}
|
||||||
@@ -592,10 +584,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exp_up(e:any,data:any){
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
to_update_lv(event:string,data:any){
|
to_update_lv(event:string,data:any){
|
||||||
if(this.fac==FacSet.MON) return
|
if(this.fac==FacSet.MON) return
|
||||||
|
|||||||
@@ -17,9 +17,14 @@ export class HCardUICom extends Component {
|
|||||||
start() {
|
start() {
|
||||||
console.log("[HCardUICom]:start")
|
console.log("[HCardUICom]:start")
|
||||||
}
|
}
|
||||||
|
protected onLoad(): void {
|
||||||
|
oops.message.on(GameEvent.UpdateHero,this.to_update_hero,this)
|
||||||
|
}
|
||||||
update(deltaTime: number) {
|
update(deltaTime: number) {
|
||||||
|
|
||||||
|
}
|
||||||
|
to_update_hero(){
|
||||||
|
this.update_data(this.h_uuid,{type:this.type})
|
||||||
}
|
}
|
||||||
update_data(uuid:number,args:any){
|
update_data(uuid:number,args:any){
|
||||||
this.type=args.type
|
this.type=args.type
|
||||||
|
|||||||
27
assets/script/game/map/MInfoComp.ts
Normal file
27
assets/script/game/map/MInfoComp.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { _decorator, Component, Label, Node } from 'cc';
|
||||||
|
import { oops } from 'db://oops-framework/core/Oops';
|
||||||
|
import { GameEvent } from '../common/config/GameEvent';
|
||||||
|
import { smc } from '../common/SingletonModuleComp';
|
||||||
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
|
@ccclass('MInfoComp')
|
||||||
|
export class MInfoComp extends Component {
|
||||||
|
protected onLoad(): void {
|
||||||
|
oops.message.on(GameEvent.MISSION_UPDATE,this.onMissionUpdate,this);
|
||||||
|
this.update_mission(smc.data.mission)
|
||||||
|
}
|
||||||
|
start() {
|
||||||
|
this.update_mission(smc.data.mission)
|
||||||
|
}
|
||||||
|
onMissionUpdate(event:string,data:any){
|
||||||
|
this.update_mission(smc.data.mission)
|
||||||
|
}
|
||||||
|
|
||||||
|
update_mission(mission:number){
|
||||||
|
this.node.getChildByName("mission").getComponent(Label).string="第 "+mission.toString()+" 关"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
9
assets/script/game/map/MInfoComp.ts.meta
Normal file
9
assets/script/game/map/MInfoComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "4.0.24",
|
||||||
|
"importer": "typescript",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "45cb2edd-7958-45ba-8eb9-bcf587448e5c",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
||||||
61
assets/script/game/map/TopComp.ts
Normal file
61
assets/script/game/map/TopComp.ts
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import { _decorator, Component, Label, Node, tween, v3 } from 'cc';
|
||||||
|
import { GameEvent } from '../common/config/GameEvent';
|
||||||
|
import { smc } from '../common/SingletonModuleComp';
|
||||||
|
import { BoxSet, NumberFormatter } from '../common/config/BoxSet';
|
||||||
|
import { oops } from 'db://oops-framework/core/Oops';
|
||||||
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
|
@ccclass('topComp')
|
||||||
|
export class topComp extends Component {
|
||||||
|
protected onLoad(): void {
|
||||||
|
oops.message.on(GameEvent.GOLD_UPDATE,this.onGoldUpdate,this);
|
||||||
|
oops.message.on(GameEvent.DIAMOND_UPDATE,this.onDiamondUpdate,this);
|
||||||
|
oops.message.on(GameEvent.MEAT_UPDATE,this.onMeatUpdate,this);
|
||||||
|
this.update_all()
|
||||||
|
}
|
||||||
|
start() {
|
||||||
|
|
||||||
|
}
|
||||||
|
onGoldUpdate(event:string,data:any){
|
||||||
|
this.update_gold(smc.data.gold)
|
||||||
|
tween(this.node.getChildByName("bar").getChildByName("gold").getChildByName("num").getComponent(Label).node)
|
||||||
|
.to(0.1,{scale:v3(1.2,1.2,1)})
|
||||||
|
.to(0.1,{scale:v3(1,1,1)})
|
||||||
|
.start()
|
||||||
|
}
|
||||||
|
onDiamondUpdate(event:string,data:any){
|
||||||
|
this.update_diamond(smc.data.diamond)
|
||||||
|
tween(this.node.getChildByName("bar").getChildByName("diamond").getChildByName("num").getComponent(Label).node)
|
||||||
|
.to(0.1,{scale:v3(1.2,1.2,1)})
|
||||||
|
.to(0.1,{scale:v3(1,1,1)})
|
||||||
|
.start()
|
||||||
|
}
|
||||||
|
onMeatUpdate(event:string,data:any){
|
||||||
|
this.update_meat(smc.data.meat)
|
||||||
|
tween(this.node.getChildByName("bar").getChildByName("meat").getChildByName("num").getComponent(Label).node)
|
||||||
|
.to(0.1,{scale:v3(1.2,1.2,1)})
|
||||||
|
.to(0.1,{scale:v3(1,1,1)})
|
||||||
|
.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
update_gold(gold:number){
|
||||||
|
this.node.getChildByName("bar").getChildByName("gold").getChildByName("num").getComponent(Label).string=NumberFormatter.formatNumber(gold);
|
||||||
|
}
|
||||||
|
update_diamond(diamond:number){
|
||||||
|
this.node.getChildByName("bar").getChildByName("diamond").getChildByName("num").getComponent(Label).string=NumberFormatter.formatNumber(diamond);
|
||||||
|
}
|
||||||
|
update_meat(meat:number){
|
||||||
|
this.node.getChildByName("bar").getChildByName("meat").getChildByName("num").getComponent(Label).string=NumberFormatter.formatNumber(meat);
|
||||||
|
}
|
||||||
|
update_all(){
|
||||||
|
this.update_gold(smc.data.gold)
|
||||||
|
this.update_diamond(smc.data.diamond)
|
||||||
|
this.update_meat(smc.data.meat)
|
||||||
|
}
|
||||||
|
|
||||||
|
update(deltaTime: number) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
9
assets/script/game/map/TopComp.ts.meta
Normal file
9
assets/script/game/map/TopComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "4.0.24",
|
||||||
|
"importer": "typescript",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "f05bc555-1d6d-49b7-9047-33054a3b7adc",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
||||||
@@ -445,3 +445,4 @@ export class GameDataManager {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -915,3 +915,4 @@ wx.cloud.callFunction({
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -269,3 +269,4 @@ module.exports = {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user