This commit is contained in:
pan
2024-08-15 10:53:40 +08:00
parent cc2020086d
commit 8686d50a6c
10 changed files with 2596 additions and 689 deletions

View File

@@ -3,13 +3,13 @@
"__type__": "cc.Prefab",
"_name": "window",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false,
"asyncLoadAssets": false
"persistent": false
},
{
"__type__": "cc.Node",
@@ -65,6 +65,7 @@
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
@@ -78,6 +79,7 @@
"__type__": "cc.Node",
"_name": "lab_title",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
@@ -100,7 +102,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 114,
"y": 143.597,
"z": 0
},
"_lrot": {
@@ -116,6 +118,7 @@
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
@@ -129,6 +132,7 @@
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
@@ -156,6 +160,7 @@
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
@@ -190,6 +195,29 @@
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 1,
"_enableOutline": false,
"_outlineColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_outlineWidth": 2,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": ""
},
{
@@ -200,6 +228,7 @@
"__type__": "110c8vEd5NEPL/N9meGQnaX",
"_name": "lab_ok<LanguageLabel>",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
@@ -223,12 +252,16 @@
"asset": {
"__id__": 0
},
"fileId": "42TIPOfhhM7ra85tXw74QR"
"fileId": "42TIPOfhhM7ra85tXw74QR",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "lab_content",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
@@ -267,6 +300,7 @@
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
@@ -280,6 +314,7 @@
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
},
@@ -307,6 +342,7 @@
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
},
@@ -341,6 +377,29 @@
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 1,
"_enableOutline": false,
"_outlineColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_outlineWidth": 2,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": ""
},
{
@@ -351,6 +410,7 @@
"__type__": "110c8vEd5NEPL/N9meGQnaX",
"_name": "lab_ok<LanguageLabel>",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
},
@@ -374,12 +434,16 @@
"asset": {
"__id__": 0
},
"fileId": "7fk7nP/NJBI7+oI60VkgZO"
"fileId": "7fk7nP/NJBI7+oI60VkgZO",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "btn_ok",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
@@ -425,6 +489,7 @@
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
@@ -438,6 +503,7 @@
"__type__": "cc.Node",
"_name": "lab_ok",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 18
},
@@ -476,6 +542,7 @@
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
@@ -489,6 +556,7 @@
"__type__": "cc.UITransform",
"_name": "Label<UITransform>",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 19
},
@@ -516,6 +584,7 @@
"__type__": "cc.Label",
"_name": "Label<Label>",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 19
},
@@ -550,6 +619,29 @@
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 1,
"_enableOutline": false,
"_outlineColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_outlineWidth": 2,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": ""
},
{
@@ -560,6 +652,7 @@
"__type__": "110c8vEd5NEPL/N9meGQnaX",
"_name": "lab_ok<LanguageLabel>",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 19
},
@@ -583,12 +676,16 @@
"asset": {
"__id__": 0
},
"fileId": "79ujcxm8RNi7nnpjL7+jNw"
"fileId": "79ujcxm8RNi7nnpjL7+jNw",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "btn_ok<UITransform>",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 18
},
@@ -616,6 +713,7 @@
"__type__": "cc.Sprite",
"_name": "btn_ok<Sprite>",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 18
},
@@ -634,7 +732,7 @@
"a": 255
},
"_spriteFrame": {
"__uuid__": "16d030ec-0f1c-4eca-9252-06cb8af7a7ba@f9941",
"__uuid__": "475189e3-a159-45bc-90f5-57864087d290@1b1f2",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1,
@@ -660,6 +758,7 @@
"__type__": "cc.Button",
"_name": "btn_ok<Button>",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 18
},
@@ -702,10 +801,7 @@
"b": 124,
"a": 255
},
"_normalSprite": {
"__uuid__": "16d030ec-0f1c-4eca-9252-06cb8af7a7ba@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_normalSprite": null,
"_hoverSprite": null,
"_pressedSprite": null,
"_disabledSprite": null,
@@ -734,6 +830,7 @@
"__type__": "cc.Widget",
"_name": "btn_ok<Widget>",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 18
},
@@ -773,12 +870,16 @@
"asset": {
"__id__": 0
},
"fileId": "fdFk91GVpJKo4VT/zlGejW"
"fileId": "fdFk91GVpJKo4VT/zlGejW",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "btn_cancel",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
@@ -824,6 +925,7 @@
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
@@ -837,6 +939,7 @@
"__type__": "cc.Node",
"_name": "lab_cancal",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 37
},
@@ -875,6 +978,7 @@
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
@@ -888,6 +992,7 @@
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 38
},
@@ -915,6 +1020,7 @@
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 38
},
@@ -949,6 +1055,29 @@
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 1,
"_enableOutline": false,
"_outlineColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_outlineWidth": 2,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": ""
},
{
@@ -959,6 +1088,7 @@
"__type__": "110c8vEd5NEPL/N9meGQnaX",
"_name": "lab_ok<LanguageLabel>",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 38
},
@@ -982,12 +1112,16 @@
"asset": {
"__id__": 0
},
"fileId": "38cZMAuzVCOJPotiPg+6BM"
"fileId": "38cZMAuzVCOJPotiPg+6BM",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "btn_cancel<UITransform>",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 37
},
@@ -1015,6 +1149,7 @@
"__type__": "cc.Sprite",
"_name": "btn_cancel<Sprite>",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 37
},
@@ -1033,7 +1168,7 @@
"a": 255
},
"_spriteFrame": {
"__uuid__": "16d030ec-0f1c-4eca-9252-06cb8af7a7ba@f9941",
"__uuid__": "475189e3-a159-45bc-90f5-57864087d290@5d1ce",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1,
@@ -1059,6 +1194,7 @@
"__type__": "cc.Button",
"_name": "btn_cancel<Button>",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 37
},
@@ -1101,10 +1237,7 @@
"b": 124,
"a": 255
},
"_normalSprite": {
"__uuid__": "16d030ec-0f1c-4eca-9252-06cb8af7a7ba@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_normalSprite": null,
"_hoverSprite": null,
"_pressedSprite": null,
"_disabledSprite": null,
@@ -1133,6 +1266,7 @@
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 37
},
@@ -1172,12 +1306,16 @@
"asset": {
"__id__": 0
},
"fileId": "3aIfIm6bVFaK62tZkb2Iic"
"fileId": "3aIfIm6bVFaK62tZkb2Iic",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
@@ -1205,6 +1343,7 @@
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
@@ -1223,10 +1362,10 @@
"a": 255
},
"_spriteFrame": {
"__uuid__": "f581195d-cc68-400c-88cb-7863e60c0ec1@f9941",
"__uuid__": "475189e3-a159-45bc-90f5-57864087d290@47364",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_type": 1,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
@@ -1249,6 +1388,7 @@
"__type__": "653bf8VPC5Fn49zFJFqXVgx",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
@@ -1282,6 +1422,8 @@
"asset": {
"__id__": 0
},
"fileId": "c7ZN3fr+hJoZmUZs2A0Ye0"
"fileId": "c7ZN3fr+hJoZmUZs2A0Ye0",
"instance": null,
"targetOverrides": null
}
]

File diff suppressed because it is too large Load Diff

View File

@@ -1244,6 +1244,9 @@
"entityLayer": {
"__id__": 41
},
"SkillLayer": {
"__id__": 47
},
"isFollowPlayer": true,
"_id": ""
},

View File

@@ -209,8 +209,8 @@
"height": 224,
"rawWidth": 360,
"rawHeight": 224,
"borderTop": 0,
"borderBottom": 0,
"borderTop": 42,
"borderBottom": 22,
"borderLeft": 0,
"borderRight": 0,
"packable": true,

File diff suppressed because it is too large Load Diff

View File

@@ -13,7 +13,8 @@ const { ccclass, property } = _decorator;
@ccclass('CardControllerComp')
@ecs.register('CardController', false)
export class CardControllerComp extends CCComp {
card_level = 1;
card_level:number = 1;
in_load:boolean = false
start() {
this.load_cards()
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
@@ -34,7 +35,15 @@ export class CardControllerComp extends CCComp {
this.load_cards()
}
}
palyer_ref(){
if (this.in_load) {
return
}
this.load_cards()
}
load_cards() {
this.in_load = true
let old_cards = ecs.query(ecs.allOf(HeroCardViewComp))
if (old_cards.length > 0) {
old_cards.forEach(element => {
@@ -53,6 +62,8 @@ export class CardControllerComp extends CCComp {
x=x+100
});
this.node.getChildByName("cards").getChildByName("active").active = false
this.in_load = false;
}
/** 转场 */
protected update(dt: number): void {
@@ -67,6 +78,7 @@ export class CardControllerComp extends CCComp {
}
return lists
}
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();

View File

@@ -0,0 +1,41 @@
import { _decorator,v3 ,NodeEventType} from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { smc } from "../common/SingletonModuleComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { HeroCard } from "../monster/HeroCard";
import { HeroCardViewComp } from "../monster/HeroCardViewComp";
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
import { CardList } from "../common/config/CardSet";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('RefControllerComp')
@ecs.register('RefController', false)
export class RefControllerComp extends CCComp {
card_level = 1;
protected onLoad(): void {
}
start() {
}
protected update(dt: number): void {
}
reset() {
this.node.destroy();
}
onTouch(){
}
}

View File

@@ -0,0 +1 @@
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"6527b285-9d12-416e-8963-5e39820b7d4e","files":[],"subMetas":{},"userData":{}}

View File

@@ -3,6 +3,7 @@ import { oops } from "../../../../../extensions/oops-plugin-framework/assets/cor
import MapData from "./map/base/MapData";
import { MapLoadModel } from "./map/base/MapLoadModel";
import EntityLayer from "./map/layer/EntityLayer";
import SkillLayer from "./map/layer/SkillLayer";
import MapLayer from "./map/layer/MapLayer";
const { ccclass, property } = _decorator;
@@ -28,6 +29,9 @@ export class MapViewScene extends Component {
@property(EntityLayer)
public entityLayer: EntityLayer | null = null;
@property(SkillLayer)
public SkillLayer: SkillLayer | null = null;
@property(CCBoolean)
public isFollowPlayer: boolean = true;

View File

@@ -14,59 +14,38 @@ export class HeroCardViewComp extends CCComp {
card_name:string = "hero_card";
card_type:string = "hero";
card_uid:number = 1000;
/** 方向 */
private _dir: Vec2 = new Vec2(0, 0);
public get dir(): Vec2 {
return this._dir;
}
public set dir(value: Vec2) {
this._dir = value;
}
pos_x=0;
pos_y=0;
protected onLoad(): void {
this.node.on(NodeEventType.TOUCH_START, this.onTouch, this);
this.node.on(NodeEventType.TOUCH_MOVE, this.onTouchMove, this);
this.node.on(NodeEventType.TOUCH_END, this.onTouchEnd, this);
this.node.on(NodeEventType.TOUCH_CANCEL, this.onTouchEnd, this);
oops.message.on("destroy hero_card", this.on_destroy_node, this);
// this.node.on(NodeEventType.TOUCH_START, this.onTouch, this);
// this.node.on(NodeEventType.TOUCH_MOVE, this.onTouchMove, this);
// this.node.on(NodeEventType.TOUCH_END, this.onTouchEnd, this);
// this.node.on(NodeEventType.TOUCH_CANCEL, this.onTouchEnd, this);
// oops.message.on("active_card_eid", this.do_active_card_eid, this);
}
private on_destroy_node(event: string, args: any) {
// if(this.ent.eid == args){
// this.reset();
// }
private do_active_card_eid(event: string, args: any) {
console.log("active_card_eid",args,this.ent.eid)
if(this.ent.eid != args.eid){
this.no_active()
}
onTouch(){
smc.vm_data.cards.eid = this.ent.eid;
let parent = this.node.parent;
let active = parent.getChildByName("active");
active.setPosition(this.pos_x,this.pos_y)
active.active = true;
active.setPosition(this.node.position.x+47.5,this.node.position.y+47.5);
}
onTouchMove(event: EventTouch) {
smc.vm_data.cards.eid = this.ent.eid;
// if(this.ent.eid == smc.vm_data.cards.eid){
// this.node.getChildByName("active").active = true;
// }else{
do_active(){
}
no_active(){
// this.node.getChildByName("active").active=false;
// }
let delta = event.getDelta();
this.node.setPosition(this.node.position.x+delta.x,this.node.position.y+delta.y);
}
onTouchEnd(){
let parent = this.node.parent;
let active = parent.getChildByName("active");
active.setPosition(this.pos_x+47.5,this.pos_y+47.5)
if(this.node.position.y-this.pos_y > 110){
active.active = false;
this.use_card()
}else{
this.node.setPosition(this.pos_x,this.pos_y);
// this.node.getChildByName("use").active=false;
// this.node.getChildByName("bag").active=false;
}
doit(){
// this.do_active()
console.log("doit",this.ent)
smc.vm_data.cards.eid = this.ent.eid;
// oops.message.dispatchEvent("active_card_eid",{eid:this.ent.eid})
}
use_card(){
if(smc.vm_data.gold.min >= CardSet[this.card_uid].level){
oops.message.dispatchEvent("do_add_hero",{uuid:this.card_uid})
@@ -74,13 +53,12 @@ export class HeroCardViewComp extends CCComp {
smc.vm_data.gold.min -= CardSet[this.card_uid].level;
}else{
oops.gui.toast("金币不够");
this.node.setPosition(this.pos_x,this.pos_y);
}
}
/** 视图层逻辑代码分离演示 */
start() {
this.pos_x=this.node.position.x;
this.pos_y=this.node.position.y;
}
/** 全局消息逻辑处理 */