Merge branch 'new' of http://pan.eoxnet.com:33000/pan/fk_hero into new
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.1.50",
|
|
||||||
"importer": "prefab",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "21141edb-3848-4481-ac80-0ea8aa4498d4",
|
|
||||||
"files": [
|
|
||||||
".json"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"syncNodeName": "expbg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
import { _decorator, cclegacy, Color, Component, Director, director, dynamicAtlasManager, Label, macro, profiler, Scene, setDisplayStats, Toggle } from 'cc';
|
|
||||||
import { MultBatch2D } from './multTextures/MultTextures';
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
//仅供测试使用,不用复制到项目
|
|
||||||
macro.CLEANUP_IMAGE_CACHE = false;
|
|
||||||
dynamicAtlasManager.enabled = true;
|
|
||||||
|
|
||||||
let isAutoBatch = true;
|
|
||||||
let isMultexture = true;
|
|
||||||
|
|
||||||
@ccclass('expbg')
|
|
||||||
export class expbg extends Component {
|
|
||||||
@property(Label)
|
|
||||||
drawcall!:Label;
|
|
||||||
|
|
||||||
@property(Label)
|
|
||||||
fps!:Label;
|
|
||||||
|
|
||||||
@property(Label)
|
|
||||||
render!:Label;
|
|
||||||
|
|
||||||
@property(Label)
|
|
||||||
triangle!:Label;
|
|
||||||
|
|
||||||
|
|
||||||
toggle:Array<Toggle> = [];
|
|
||||||
|
|
||||||
protected start(): void {
|
|
||||||
profiler.showStats();
|
|
||||||
|
|
||||||
this.toggle = this.node.getComponentsInChildren(Toggle)!;
|
|
||||||
isMultexture = this.toggle[0].isChecked = MultBatch2D.enable;
|
|
||||||
isAutoBatch = this.toggle[1].isChecked = dynamicAtlasManager.enabled;
|
|
||||||
this.changeColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
changeColor(){
|
|
||||||
|
|
||||||
let all = isMultexture&&isAutoBatch;
|
|
||||||
if(all){
|
|
||||||
this.drawcall.color = Color.GREEN;
|
|
||||||
}else{
|
|
||||||
this.drawcall.color = isMultexture? new Color(255,100,0,255):Color.RED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
btMultexture(){
|
|
||||||
isMultexture = this.toggle[0].isChecked;
|
|
||||||
// _mulMaterial.enable = isMultexture;
|
|
||||||
// resetRenders = !isMultexture;
|
|
||||||
this.changeColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
btAutoBatch(){
|
|
||||||
isAutoBatch = this.toggle[1].isChecked;
|
|
||||||
// dynamicAtlasManager.enabled = isAutoBatch;
|
|
||||||
// resetRenders = !isAutoBatch;
|
|
||||||
this.changeColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
btExit(){
|
|
||||||
director.loadScene('main');
|
|
||||||
}
|
|
||||||
|
|
||||||
lateUpdate(dt:number){
|
|
||||||
|
|
||||||
let state = null;
|
|
||||||
if(cclegacy.profiler.stats){
|
|
||||||
state = cclegacy.profiler.stats;
|
|
||||||
}else{
|
|
||||||
state = cclegacy.profiler._stats;
|
|
||||||
}
|
|
||||||
|
|
||||||
let dc = state.draws.counter._value;
|
|
||||||
let tris = state.tricount.counter._value;
|
|
||||||
let fps = state.fps.counter._averageValue;
|
|
||||||
let render = state.render.counter._averageValue;
|
|
||||||
|
|
||||||
|
|
||||||
//director.root!.device.numDrawCalls;
|
|
||||||
this.drawcall.string = "dc: " + dc;
|
|
||||||
this.fps.string = 'fps: '+fps.toFixed(2);
|
|
||||||
// this.triangle.string = "triangles: "+tris;
|
|
||||||
this.render.string = 'render: '+render.toFixed(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
let renders:Set<any> = new Set();
|
|
||||||
director.on(Director.EVENT_BEFORE_DRAW,()=>{
|
|
||||||
|
|
||||||
let resetRenders = false;
|
|
||||||
if(MultBatch2D.enable != isMultexture){
|
|
||||||
MultBatch2D.enable = isMultexture;
|
|
||||||
resetRenders = true;
|
|
||||||
}
|
|
||||||
if(dynamicAtlasManager.enabled != isAutoBatch){
|
|
||||||
dynamicAtlasManager.enabled = isAutoBatch;
|
|
||||||
resetRenders = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(resetRenders){
|
|
||||||
resetRenders = false;
|
|
||||||
renders.forEach((render)=>{
|
|
||||||
if(render){
|
|
||||||
let rd = render.renderData;
|
|
||||||
rd && render.markForUpdateRenderData(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let UIMeshRenderer = cclegacy.UIMeshRenderer.prototype;
|
|
||||||
let UIMeshDisable = UIMeshRenderer.onDisable;
|
|
||||||
let UIMeshEnable = UIMeshRenderer.onEnable;
|
|
||||||
UIMeshRenderer.onEnable = function(){
|
|
||||||
renders.add(this);
|
|
||||||
UIMeshEnable.call(this);
|
|
||||||
}
|
|
||||||
UIMeshRenderer.onDisable = function(){
|
|
||||||
renders.delete(this);
|
|
||||||
UIMeshDisable.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
let UIRenderer = cclegacy.internal.UIRenderer.prototype;
|
|
||||||
let UIDisable = UIRenderer.onDisable;
|
|
||||||
let UIEnable = UIRenderer.onEnable;
|
|
||||||
UIRenderer.onEnable = function(){
|
|
||||||
renders.add(this);
|
|
||||||
UIEnable.call(this);
|
|
||||||
}
|
|
||||||
UIRenderer.onDisable = function(){
|
|
||||||
renders.delete(this);
|
|
||||||
UIDisable.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "05c5a7a2-f660-4f27-8d2c-e58f7738de6f",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -28,17 +28,17 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 81
|
"__id__": 72
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 83
|
"__id__": 74
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 85
|
"__id__": 76
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 87
|
"__id__": 78
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -197,17 +197,17 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 74
|
"__id__": 65
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 76
|
"__id__": 67
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 78
|
"__id__": 69
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 80
|
"__id__": 71
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -251,23 +251,23 @@
|
|||||||
"__id__": 8
|
"__id__": 8
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 55
|
"__id__": 46
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 59
|
"__id__": 50
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 65
|
"__id__": 56
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 71
|
"__id__": 62
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 73
|
"__id__": 64
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -314,14 +314,14 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 50
|
"__id__": 41
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 52
|
"__id__": 43
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 54
|
"__id__": 45
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -365,23 +365,23 @@
|
|||||||
"__id__": 10
|
"__id__": 10
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 25
|
"__id__": 16
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 31
|
"__id__": 22
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 45
|
"__id__": 36
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 47
|
"__id__": 38
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 49
|
"__id__": 40
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -420,22 +420,18 @@
|
|||||||
"_parent": {
|
"_parent": {
|
||||||
"__id__": 9
|
"__id__": 9
|
||||||
},
|
},
|
||||||
"_children": [
|
"_children": [],
|
||||||
{
|
|
||||||
"__id__": 11
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 20
|
"__id__": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 22
|
"__id__": 13
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 24
|
"__id__": 15
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -466,131 +462,6 @@
|
|||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"__type__": "cc.Node",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_parent": {
|
|
||||||
"__id__": 10
|
|
||||||
},
|
|
||||||
"_prefab": {
|
|
||||||
"__id__": 12
|
|
||||||
},
|
|
||||||
"__editorExtras__": {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.PrefabInfo",
|
|
||||||
"root": {
|
|
||||||
"__id__": 11
|
|
||||||
},
|
|
||||||
"asset": {
|
|
||||||
"__uuid__": "21141edb-3848-4481-ac80-0ea8aa4498d4",
|
|
||||||
"__expectedType__": "cc.Prefab"
|
|
||||||
},
|
|
||||||
"fileId": "588mX12fFBc6tNNhK5kSwP",
|
|
||||||
"instance": {
|
|
||||||
"__id__": 13
|
|
||||||
},
|
|
||||||
"targetOverrides": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.PrefabInstance",
|
|
||||||
"fileId": "3a78SMrvBMNbijh9vr2yQQ",
|
|
||||||
"prefabRootNode": {
|
|
||||||
"__id__": 1
|
|
||||||
},
|
|
||||||
"mountedChildren": [],
|
|
||||||
"mountedComponents": [],
|
|
||||||
"propertyOverrides": [
|
|
||||||
{
|
|
||||||
"__id__": 14
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 16
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 17
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 18
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 19
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"removedComponents": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 15
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_lpos"
|
|
||||||
],
|
|
||||||
"value": {
|
|
||||||
"__type__": "cc.Vec3",
|
|
||||||
"x": -0.827,
|
|
||||||
"y": 264.282,
|
|
||||||
"z": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.TargetInfo",
|
|
||||||
"localID": [
|
|
||||||
"588mX12fFBc6tNNhK5kSwP"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 15
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_name"
|
|
||||||
],
|
|
||||||
"value": "expbg"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 15
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_lrot"
|
|
||||||
],
|
|
||||||
"value": {
|
|
||||||
"__type__": "cc.Quat",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0,
|
|
||||||
"w": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 15
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_euler"
|
|
||||||
],
|
|
||||||
"value": {
|
|
||||||
"__type__": "cc.Vec3",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
|
||||||
"targetInfo": {
|
|
||||||
"__id__": 15
|
|
||||||
},
|
|
||||||
"propertyPath": [
|
|
||||||
"_active"
|
|
||||||
],
|
|
||||||
"value": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"__type__": "cc.UITransform",
|
"__type__": "cc.UITransform",
|
||||||
"_name": "",
|
"_name": "",
|
||||||
@@ -601,7 +472,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 21
|
"__id__": 12
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -629,7 +500,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 23
|
"__id__": 14
|
||||||
},
|
},
|
||||||
"_customMaterial": null,
|
"_customMaterial": null,
|
||||||
"_srcBlendFactor": 2,
|
"_srcBlendFactor": 2,
|
||||||
@@ -689,14 +560,14 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 26
|
"__id__": 17
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 28
|
"__id__": 19
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 30
|
"__id__": 21
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -733,11 +604,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 25
|
"__id__": 16
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 27
|
"__id__": 18
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -761,11 +632,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 25
|
"__id__": 16
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 29
|
"__id__": 20
|
||||||
},
|
},
|
||||||
"_customMaterial": null,
|
"_customMaterial": null,
|
||||||
"_srcBlendFactor": 2,
|
"_srcBlendFactor": 2,
|
||||||
@@ -825,26 +696,26 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 32
|
"__id__": 23
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 34
|
"__id__": 25
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 36
|
"__id__": 27
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 38
|
"__id__": 29
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 40
|
"__id__": 31
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 42
|
"__id__": 33
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 44
|
"__id__": 35
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -881,11 +752,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 31
|
"__id__": 22
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 33
|
"__id__": 24
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -909,11 +780,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 31
|
"__id__": 22
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 35
|
"__id__": 26
|
||||||
},
|
},
|
||||||
"_customMaterial": null,
|
"_customMaterial": null,
|
||||||
"_srcBlendFactor": 2,
|
"_srcBlendFactor": 2,
|
||||||
@@ -954,11 +825,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 31
|
"__id__": 22
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 37
|
"__id__": 28
|
||||||
},
|
},
|
||||||
"enabledContactListener": false,
|
"enabledContactListener": false,
|
||||||
"bullet": true,
|
"bullet": true,
|
||||||
@@ -988,11 +859,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 31
|
"__id__": 22
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 39
|
"__id__": 30
|
||||||
},
|
},
|
||||||
"tag": 0,
|
"tag": 0,
|
||||||
"_group": 1,
|
"_group": 1,
|
||||||
@@ -1022,11 +893,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 31
|
"__id__": 22
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 41
|
"__id__": 32
|
||||||
},
|
},
|
||||||
"tag": 0,
|
"tag": 0,
|
||||||
"_group": 1,
|
"_group": 1,
|
||||||
@@ -1056,11 +927,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 31
|
"__id__": 22
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 43
|
"__id__": 34
|
||||||
},
|
},
|
||||||
"tag": 0,
|
"tag": 0,
|
||||||
"_group": 1,
|
"_group": 1,
|
||||||
@@ -1107,7 +978,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 46
|
"__id__": 37
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -1135,7 +1006,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 48
|
"__id__": 39
|
||||||
},
|
},
|
||||||
"_customMaterial": null,
|
"_customMaterial": null,
|
||||||
"_srcBlendFactor": 2,
|
"_srcBlendFactor": 2,
|
||||||
@@ -1193,7 +1064,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 51
|
"__id__": 42
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -1221,10 +1092,10 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 53
|
"__id__": 44
|
||||||
},
|
},
|
||||||
"bgImg": {
|
"bgImg": {
|
||||||
"__id__": 47
|
"__id__": 38
|
||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
@@ -1257,11 +1128,11 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 56
|
"__id__": 47
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 58
|
"__id__": 49
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -1298,11 +1169,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 55
|
"__id__": 46
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 57
|
"__id__": 48
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -1345,14 +1216,14 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 60
|
"__id__": 51
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 62
|
"__id__": 53
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 64
|
"__id__": 55
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -1389,11 +1260,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 59
|
"__id__": 50
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 61
|
"__id__": 52
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -1417,11 +1288,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 59
|
"__id__": 50
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 63
|
"__id__": 54
|
||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
@@ -1454,14 +1325,14 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 66
|
"__id__": 57
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 68
|
"__id__": 59
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 70
|
"__id__": 61
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -1498,11 +1369,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 65
|
"__id__": 56
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 67
|
"__id__": 58
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -1526,11 +1397,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 65
|
"__id__": 56
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 69
|
"__id__": 60
|
||||||
},
|
},
|
||||||
"light": {
|
"light": {
|
||||||
"__uuid__": "683fa094-5032-4f8d-a8c6-63a962c9bdd5",
|
"__uuid__": "683fa094-5032-4f8d-a8c6-63a962c9bdd5",
|
||||||
@@ -1565,7 +1436,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 72
|
"__id__": 63
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -1606,7 +1477,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 75
|
"__id__": 66
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -1634,7 +1505,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 77
|
"__id__": 68
|
||||||
},
|
},
|
||||||
"camera": {
|
"camera": {
|
||||||
"__id__": 3
|
"__id__": 3
|
||||||
@@ -1643,13 +1514,13 @@
|
|||||||
"__id__": 7
|
"__id__": 7
|
||||||
},
|
},
|
||||||
"mapLayer": {
|
"mapLayer": {
|
||||||
"__id__": 52
|
"__id__": 43
|
||||||
},
|
},
|
||||||
"floorLayer": {
|
"floorLayer": {
|
||||||
"__id__": 55
|
"__id__": 46
|
||||||
},
|
},
|
||||||
"entityLayer": {
|
"entityLayer": {
|
||||||
"__id__": 62
|
"__id__": 53
|
||||||
},
|
},
|
||||||
"isFollowPlayer": true,
|
"isFollowPlayer": true,
|
||||||
"_id": ""
|
"_id": ""
|
||||||
@@ -1668,7 +1539,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 79
|
"__id__": 70
|
||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
@@ -1699,7 +1570,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 82
|
"__id__": 73
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -1727,7 +1598,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 84
|
"__id__": 75
|
||||||
},
|
},
|
||||||
"_cameraComponent": {
|
"_cameraComponent": {
|
||||||
"__id__": 3
|
"__id__": 3
|
||||||
@@ -1749,7 +1620,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 86
|
"__id__": 77
|
||||||
},
|
},
|
||||||
"_alignFlags": 45,
|
"_alignFlags": 45,
|
||||||
"_target": null,
|
"_target": null,
|
||||||
@@ -1785,11 +1656,6 @@
|
|||||||
},
|
},
|
||||||
"fileId": "32qENLKwZHV5S2IyZfpNx2",
|
"fileId": "32qENLKwZHV5S2IyZfpNx2",
|
||||||
"instance": null,
|
"instance": null,
|
||||||
"targetOverrides": null,
|
"targetOverrides": null
|
||||||
"nestedPrefabInstanceRoots": [
|
|
||||||
{
|
|
||||||
"__id__": 11
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -3518,7 +3518,7 @@
|
|||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": -355,
|
"x": -355,
|
||||||
"y": -500,
|
"y": -390,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
"_lrot": {
|
"_lrot": {
|
||||||
@@ -3725,7 +3725,7 @@
|
|||||||
"_left": 5,
|
"_left": 5,
|
||||||
"_right": 0,
|
"_right": 0,
|
||||||
"_top": 0,
|
"_top": 0,
|
||||||
"_bottom": 140,
|
"_bottom": 250,
|
||||||
"_horizontalCenter": 0,
|
"_horizontalCenter": 0,
|
||||||
"_verticalCenter": 0,
|
"_verticalCenter": 0,
|
||||||
"_isAbsLeft": true,
|
"_isAbsLeft": true,
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "e323e368-94a2-4088-974a-f225ef5451fd",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
|
||||||
CCEffect %{
|
|
||||||
techniques:
|
|
||||||
- passes:
|
|
||||||
- vert: sprite-vs:vert
|
|
||||||
frag: sprite-fs:frag
|
|
||||||
depthStencilState:
|
|
||||||
depthTest: false
|
|
||||||
depthWrite: false
|
|
||||||
blendState:
|
|
||||||
targets:
|
|
||||||
- blend: true
|
|
||||||
blendSrc: src_alpha
|
|
||||||
blendDst: one_minus_src_alpha
|
|
||||||
blendDstAlpha: one_minus_src_alpha
|
|
||||||
rasterizerState:
|
|
||||||
cullMode: none
|
|
||||||
properties:
|
|
||||||
alphaThreshold: { value: 0.5 }
|
|
||||||
texture1: { value: white}
|
|
||||||
texture2: { value: white}
|
|
||||||
texture3: { value: white}
|
|
||||||
texture4: { value: white}
|
|
||||||
texture5: { value: white}
|
|
||||||
texture6: { value: white}
|
|
||||||
texture7: { value: white}
|
|
||||||
}%
|
|
||||||
|
|
||||||
CCProgram sprite-vs %{
|
|
||||||
precision highp float;
|
|
||||||
#include <builtin/uniforms/cc-global>
|
|
||||||
#if USE_LOCAL
|
|
||||||
#include <builtin/uniforms/cc-local>
|
|
||||||
#endif
|
|
||||||
#if SAMPLE_FROM_RT
|
|
||||||
#include <common/common-define>
|
|
||||||
#endif
|
|
||||||
in vec3 a_position;
|
|
||||||
in vec2 a_texCoord;
|
|
||||||
in vec4 a_color;
|
|
||||||
|
|
||||||
out vec4 color;
|
|
||||||
out vec3 uv0;
|
|
||||||
|
|
||||||
vec4 vert () {
|
|
||||||
vec4 pos = vec4(a_position, 1);
|
|
||||||
|
|
||||||
#if USE_LOCAL
|
|
||||||
pos = cc_matWorld * pos;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_PIXEL_ALIGNMENT
|
|
||||||
pos = cc_matView * pos;
|
|
||||||
pos.xyz = floor(pos.xyz);
|
|
||||||
pos = cc_matProj * pos;
|
|
||||||
#else
|
|
||||||
pos = cc_matViewProj * pos;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// uv0 = a_texCoord;
|
|
||||||
float id = mod(a_texCoord.x,10.0);
|
|
||||||
uv0.x = (a_texCoord.x - id)*0.000001;
|
|
||||||
uv0.y = a_texCoord.y;
|
|
||||||
uv0.z = id;
|
|
||||||
|
|
||||||
#if SAMPLE_FROM_RT
|
|
||||||
CC_HANDLE_RT_SAMPLE_FLIP(uv0.xy);
|
|
||||||
#endif
|
|
||||||
color = a_color;
|
|
||||||
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
}%
|
|
||||||
|
|
||||||
CCProgram sprite-fs %{
|
|
||||||
precision highp float;
|
|
||||||
#include <builtin/internal/embedded-alpha>
|
|
||||||
#include <builtin/internal/alpha-test>
|
|
||||||
|
|
||||||
in vec4 color;
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
in vec3 uv0;
|
|
||||||
#pragma builtin(local)
|
|
||||||
layout(set = 2, binding = 12) uniform sampler2D cc_spriteTexture;
|
|
||||||
uniform sampler2D texture1;
|
|
||||||
uniform sampler2D texture2;
|
|
||||||
uniform sampler2D texture3;
|
|
||||||
uniform sampler2D texture4;
|
|
||||||
uniform sampler2D texture5;
|
|
||||||
uniform sampler2D texture6;
|
|
||||||
uniform sampler2D texture7;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vec4 frag () {
|
|
||||||
vec4 o = vec4(1, 1, 1, 1);
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
if(uv0.z<0.5)
|
|
||||||
o *= CCSampleWithAlphaSeparated(cc_spriteTexture, uv0.xy);
|
|
||||||
else if(uv0.z<1.5)
|
|
||||||
o *= CCSampleWithAlphaSeparated(texture1, uv0.xy);
|
|
||||||
else if(uv0.z<2.5)
|
|
||||||
o *= CCSampleWithAlphaSeparated(texture2, uv0.xy);
|
|
||||||
else if(uv0.z<3.5)
|
|
||||||
o *= CCSampleWithAlphaSeparated(texture3, uv0.xy);
|
|
||||||
else if(uv0.z<4.5)
|
|
||||||
o *= CCSampleWithAlphaSeparated(texture4, uv0.xy);
|
|
||||||
else if(uv0.z<5.5)
|
|
||||||
o *= CCSampleWithAlphaSeparated(texture5, uv0.xy);
|
|
||||||
else if(uv0.z<6.5)
|
|
||||||
o *= CCSampleWithAlphaSeparated(texture6, uv0.xy);
|
|
||||||
else
|
|
||||||
o *= CCSampleWithAlphaSeparated(texture7, uv0.xy);
|
|
||||||
|
|
||||||
#if IS_GRAY
|
|
||||||
float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;
|
|
||||||
o.r = o.g = o.b = gray;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
o *= color;
|
|
||||||
ALPHA_TEST(o);
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
}%
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.7.1",
|
|
||||||
"importer": "effect",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "add9fcaa-8475-4521-917b-7de307b81c4d",
|
|
||||||
"files": [
|
|
||||||
".json"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
{
|
|
||||||
"__type__": "cc.Material",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"__editorExtras__": {},
|
|
||||||
"_native": "",
|
|
||||||
"_effectAsset": {
|
|
||||||
"__uuid__": "add9fcaa-8475-4521-917b-7de307b81c4d",
|
|
||||||
"__expectedType__": "cc.EffectAsset"
|
|
||||||
},
|
|
||||||
"_techIdx": 0,
|
|
||||||
"_defines": [
|
|
||||||
{
|
|
||||||
"USE_TEXTURE": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_states": [
|
|
||||||
{
|
|
||||||
"rasterizerState": {},
|
|
||||||
"depthStencilState": {},
|
|
||||||
"blendState": {
|
|
||||||
"targets": [
|
|
||||||
{}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_props": [
|
|
||||||
{}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.21",
|
|
||||||
"importer": "material",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "490db6c2-4dd4-4050-98ec-c1c62ccaae16",
|
|
||||||
"files": [
|
|
||||||
".json"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -1,306 +0,0 @@
|
|||||||
//*//
|
|
||||||
import { BaseRenderData, Director, Game, Material, Node, ParticleSystem2D, Sprite, SpriteFrame, StencilManager, UIRenderer, __private, _decorator, assert, cclegacy, director, game, renderer, resources } from 'cc';
|
|
||||||
import { DEBUG, EDITOR, JSB } from 'cc/env';
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
|
|
||||||
export const MultBatch2D: any = {
|
|
||||||
enable: false,
|
|
||||||
parent: null,
|
|
||||||
textures: [],
|
|
||||||
hash: 0,
|
|
||||||
reset: function () {
|
|
||||||
this.textures.length = 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let _cacheUseCount: number = 0;
|
|
||||||
let _cacheMaterials: Array<Material> = [];
|
|
||||||
|
|
||||||
const getMultMaterial = function () {
|
|
||||||
|
|
||||||
if (!MultBatch2D.enable) return null;
|
|
||||||
|
|
||||||
let material: any = _cacheMaterials[_cacheUseCount++];
|
|
||||||
if (!material) {
|
|
||||||
const mat = { parent: MultBatch2D.parent };
|
|
||||||
material = new renderer.MaterialInstance(mat);
|
|
||||||
material['isMultTextures'] = true;
|
|
||||||
_cacheMaterials.push(material);
|
|
||||||
}
|
|
||||||
|
|
||||||
return material;
|
|
||||||
}
|
|
||||||
|
|
||||||
let MAX_TEX = 8;
|
|
||||||
const _texture = {
|
|
||||||
texture: new cclegacy.SimpleTexture(),
|
|
||||||
defalut: new cclegacy.SimpleTexture(),
|
|
||||||
setFrame(frame: any) {
|
|
||||||
this.texture['_gfxSampler'] = frame.getGFXSampler();
|
|
||||||
this.texture['_gfxTextureView'] = frame.getGFXTexture();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
game.once(Game.EVENT_GAME_INITED, () => {
|
|
||||||
if (EDITOR || JSB) return;
|
|
||||||
|
|
||||||
resources.load("multTextures/Mult-material", Material, (err, material) => {
|
|
||||||
if (!err) {
|
|
||||||
let mat = cclegacy.builtinResMgr.get('ui-sprite-material');
|
|
||||||
MultBatch2D.hash = Material.getHash(mat);
|
|
||||||
MultBatch2D.parent = material;
|
|
||||||
MultBatch2D.enable = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
const UIR: any = UIRenderer.prototype;
|
|
||||||
const updateMaterial: any = UIR.updateMaterial;
|
|
||||||
UIR.updateMaterial = function () {
|
|
||||||
updateMaterial.call(this);
|
|
||||||
//this.getSharedMaterial(0);
|
|
||||||
let material = this.customMaterial || this.material;
|
|
||||||
if (material) {
|
|
||||||
material['isMultTextures'] = false;
|
|
||||||
if (MultBatch2D.hash == material.hash) {
|
|
||||||
material['isMultTextures'] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const PS2D: any = ParticleSystem2D.prototype;
|
|
||||||
const _updateMaterial = PS2D._updateMaterial;
|
|
||||||
PS2D._updateMaterial = function () {
|
|
||||||
_updateMaterial.call(this);
|
|
||||||
let material = this.customMaterial || this.material;
|
|
||||||
if (material) {
|
|
||||||
material['isMultTextures'] = false;
|
|
||||||
if (MultBatch2D.hash == material.hash) {
|
|
||||||
material['isMultTextures'] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
game.once(Game.EVENT_ENGINE_INITED, () => {
|
|
||||||
if (EDITOR || JSB) return;
|
|
||||||
|
|
||||||
|
|
||||||
cclegacy.UI.RenderData.prototype.texID = -1;
|
|
||||||
cclegacy.UI.RenderData.prototype.texDirty = true;
|
|
||||||
cclegacy.UI.RenderData.prototype.dataDirty = true;
|
|
||||||
|
|
||||||
Object.defineProperty(cclegacy.UI.RenderData.prototype, "vertDirty", {
|
|
||||||
get: function () {
|
|
||||||
return this._vertDirty;
|
|
||||||
},
|
|
||||||
set: function (val: boolean) {
|
|
||||||
this._vertDirty = val;
|
|
||||||
if (val === true) {
|
|
||||||
this.dataDirty = true;
|
|
||||||
}
|
|
||||||
if (this._renderDrawInfo && val) {
|
|
||||||
this._renderDrawInfo.setVertDirty(val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Object.defineProperty(cclegacy.UI.RenderData.prototype, "textureDirty", {
|
|
||||||
get: function () {
|
|
||||||
return this.texDirty;
|
|
||||||
},
|
|
||||||
set: function (val: boolean) {
|
|
||||||
this.texDirty = val;
|
|
||||||
if (val === true) {
|
|
||||||
this.texID = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const Spr: any = Sprite.prototype;
|
|
||||||
Spr.flagChangedVersion = -1;
|
|
||||||
Object.defineProperty(Spr, "_flagChangedVersion", {
|
|
||||||
get: function () {
|
|
||||||
return this.flagChangedVersion;
|
|
||||||
},
|
|
||||||
set: function (val: number) {
|
|
||||||
if (this.flagChangedVersion != val) {
|
|
||||||
this.flagChangedVersion = val;
|
|
||||||
let rd = this.renderData;
|
|
||||||
let type = this.type;
|
|
||||||
if (rd && type == Sprite.Type.TILED
|
|
||||||
|| (type == Sprite.Type.FILLED && Sprite.FillType.RADIAL)) {
|
|
||||||
rd.dataDirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
director.on(Director.EVENT_AFTER_DRAW, (dt) => {
|
|
||||||
cclegacy.internal.Batcher2D._rdHash = -1;
|
|
||||||
MultBatch2D.reset();
|
|
||||||
_cacheUseCount = 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
cclegacy.internal.Batcher2D.prototype.currMaterial = null;
|
|
||||||
Object.defineProperty(cclegacy.internal.Batcher2D.prototype, "_currMaterial", {
|
|
||||||
get: function () {
|
|
||||||
return this.currMaterial;
|
|
||||||
},
|
|
||||||
set: function (metrial: any) {
|
|
||||||
if (this.currMaterial === metrial) return;
|
|
||||||
this.currMaterial = metrial;
|
|
||||||
MultBatch2D.reset();
|
|
||||||
if (metrial && metrial.isMultTextures) {
|
|
||||||
let mat = getMultMaterial();
|
|
||||||
if (mat) {
|
|
||||||
this.currMaterial = mat;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
const Stage_ENTER_LEVEL = 2;
|
|
||||||
const Stage_ENTER_LEVEL_INVERTED = 6;
|
|
||||||
type TextureBase = __private._cocos_asset_assets_texture_base__TextureBase;
|
|
||||||
|
|
||||||
cclegacy.internal.Batcher2D.prototype._rdHash = -1;
|
|
||||||
cclegacy.internal.Batcher2D.prototype.commitComp = function (comp: UIRenderer, renderData: BaseRenderData | null, frame: TextureBase | SpriteFrame | null, assembler: any, transform: Node | null) {
|
|
||||||
|
|
||||||
let rdHash = -1;
|
|
||||||
let dataHash = 0;
|
|
||||||
let mat: any;
|
|
||||||
let bufferID = -1;
|
|
||||||
if (renderData && renderData.chunk) {
|
|
||||||
if (!renderData.isValid()) return;
|
|
||||||
dataHash = renderData.dataHash;
|
|
||||||
mat = renderData.material;
|
|
||||||
bufferID = renderData.chunk.bufferId;
|
|
||||||
// as RenderData;
|
|
||||||
let rd: any = renderData;
|
|
||||||
rdHash = bufferID << 16 | rd.layer;
|
|
||||||
|
|
||||||
}
|
|
||||||
// Notice: A little hack, if it is for mask, not need update here, while control by stencilManger
|
|
||||||
if (comp.stencilStage === Stage_ENTER_LEVEL || comp.stencilStage === Stage_ENTER_LEVEL_INVERTED) {
|
|
||||||
this._insertMaskBatch(comp);
|
|
||||||
} else {
|
|
||||||
comp.stencilStage = StencilManager.sharedManager!.stage;
|
|
||||||
}
|
|
||||||
const depthStencilStateStage = comp.stencilStage;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let texID = -1;
|
|
||||||
let texture = null;
|
|
||||||
let flushBatch = false;
|
|
||||||
let isMultTextures = false;
|
|
||||||
if (MultBatch2D.enable && mat && mat.isMultTextures) {
|
|
||||||
texture = frame && frame.getGFXTexture();
|
|
||||||
texID = MultBatch2D.textures.indexOf(texture);
|
|
||||||
isMultTextures = true;
|
|
||||||
if (texID < 0) {
|
|
||||||
if (MultBatch2D.textures.length == MAX_TEX) {
|
|
||||||
// MultBatch2D.textures.length = 0;
|
|
||||||
flushBatch = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this._currMaterial && this._currMaterial.isMultTextures) {
|
|
||||||
mat = this._currMaterial;
|
|
||||||
dataHash = this._currHash;
|
|
||||||
if (this._rdHash != rdHash) {
|
|
||||||
flushBatch = true;
|
|
||||||
texID = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (flushBatch
|
|
||||||
|| this._currHash !== dataHash || dataHash === 0 || this._currMaterial !== mat
|
|
||||||
|| this._currDepthStencilStateStage !== depthStencilStateStage) {
|
|
||||||
// Merge all previous data to a render batch, and update buffer for next render data
|
|
||||||
this.autoMergeBatches(this._currComponent!);
|
|
||||||
if (renderData && !renderData._isMeshBuffer) {
|
|
||||||
this.updateBuffer(renderData.vertexFormat, bufferID);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._rdHash = rdHash;
|
|
||||||
this._currRenderData = renderData;
|
|
||||||
this._currHash = renderData ? renderData.dataHash : 0;
|
|
||||||
this._currComponent = comp;
|
|
||||||
this._currTransform = transform;
|
|
||||||
this._currMaterial = comp.getRenderMaterial(0)!;
|
|
||||||
this._currDepthStencilStateStage = depthStencilStateStage;
|
|
||||||
this._currLayer = comp.node.layer;
|
|
||||||
if (frame) {
|
|
||||||
if (DEBUG) {
|
|
||||||
assert(frame.isValid, 'frame should not be invalid, it may have been released');
|
|
||||||
}
|
|
||||||
this._currTexture = frame.getGFXTexture();
|
|
||||||
this._currSampler = frame.getGFXSampler();
|
|
||||||
this._currTextureHash = frame.getHash();
|
|
||||||
this._currSamplerHash = this._currSampler.hash;
|
|
||||||
} else {
|
|
||||||
this._currTexture = null;
|
|
||||||
this._currSampler = null;
|
|
||||||
this._currTextureHash = 0;
|
|
||||||
this._currSamplerHash = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assembler.fillBuffers(comp, this);
|
|
||||||
|
|
||||||
if (isMultTextures) {
|
|
||||||
if (texID < 0) {
|
|
||||||
texID = MultBatch2D.textures.length;
|
|
||||||
MultBatch2D.textures.push(texture);
|
|
||||||
if (texID > 0) {
|
|
||||||
_texture.setFrame(frame);
|
|
||||||
const name = "texture" + texID;
|
|
||||||
this._currMaterial.setProperty(name, _texture.texture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this._fillDatas(renderData, texID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
cclegacy.internal.Batcher2D.prototype["_fillDatas"] = function (renderData: any, texID: number) {
|
|
||||||
|
|
||||||
if (!renderData) return;
|
|
||||||
|
|
||||||
let uvX = 0;
|
|
||||||
let vbuf = renderData.chunk.vb;
|
|
||||||
if (renderData.dataDirty) {
|
|
||||||
renderData.dataDirty = false;
|
|
||||||
for (let i = 0, length = vbuf.length; i < length; i += 9) {
|
|
||||||
uvX = ~~(vbuf[i + 3] * 100000);
|
|
||||||
vbuf[i + 3] = uvX * 10 + texID;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (renderData.texID != texID) {
|
|
||||||
for (let i = 0, length = vbuf.length; i < length; i += 9) {
|
|
||||||
uvX = ~~(vbuf[i + 3] * 0.1);
|
|
||||||
vbuf[i + 3] = uvX * 10 + texID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
renderData.texID = texID;
|
|
||||||
};
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
//*/
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "bd7e7bed-a237-4c50-9383-95bb886ff622",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -48,12 +48,13 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
gold: {
|
gold: {
|
||||||
min: 3,
|
min: 3,
|
||||||
max: 3,
|
max: 3,
|
||||||
|
max_limit:10,
|
||||||
time:0,
|
time:0,
|
||||||
cd:30,
|
cd:15,
|
||||||
},
|
},
|
||||||
shuaxin: {
|
shuaxin: {
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 10,
|
max: 15,
|
||||||
speed:1,
|
speed:1,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,11 @@ export class MapViewComp extends CCComp {
|
|||||||
current_map: any;
|
current_map: any;
|
||||||
/** 转场碰撞点对象集合 */
|
/** 转场碰撞点对象集合 */
|
||||||
|
|
||||||
private timer: Timer = new Timer(3);
|
private monster_refresh_rtimer: Timer = new Timer(3);
|
||||||
|
|
||||||
|
private mapLoaded() {
|
||||||
|
|
||||||
|
}
|
||||||
onLoad(){
|
onLoad(){
|
||||||
// 监听全局事件
|
// 监听全局事件
|
||||||
oops.message.on("do_add_monster", this.on_do_add_monster, this);
|
oops.message.on("do_add_monster", this.on_do_add_monster, this);
|
||||||
@@ -34,11 +38,10 @@ export class MapViewComp extends CCComp {
|
|||||||
private on_do_add_monster(event: string, args: any) {
|
private on_do_add_monster(event: string, args: any) {
|
||||||
this.addMonster()
|
this.addMonster()
|
||||||
}
|
}
|
||||||
|
/**监听do_add_hero 添加hero,通过uuid */
|
||||||
private on_do_add_hero(event: string, args: any) {
|
private on_do_add_hero(event: string, args: any) {
|
||||||
console.log("do_add_hero",args.HeroCardView)
|
console.log("do_add_hero",args.uuid)
|
||||||
this.addHero(args.HeroCardView.card_uid)
|
this.addHero(args.uuid)
|
||||||
this.addMonster()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
reset(): void {
|
reset(): void {
|
||||||
|
|
||||||
@@ -49,19 +52,22 @@ export class MapViewComp extends CCComp {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 转场 */
|
|
||||||
protected update(dt: number): void {
|
protected update(dt: number): void {
|
||||||
|
if (this.monster_refresh_rtimer.update(dt)) {
|
||||||
|
this.monster_refresh()
|
||||||
|
}
|
||||||
// this.shuaxin(dt)
|
// this.shuaxin(dt)
|
||||||
this.gold_add(dt)
|
this.gold_add(dt)
|
||||||
}
|
}
|
||||||
|
monster_refresh(){
|
||||||
private mapLoaded() {
|
this.addMonster(1001)
|
||||||
|
|
||||||
}
|
}
|
||||||
gold_add(dt: number) {
|
gold_add(dt: number) {
|
||||||
smc.vm_data.gold.time += dt;
|
smc.vm_data.gold.time += dt;
|
||||||
if (smc.vm_data.gold.time >= smc.vm_data.gold.cd) {
|
if (smc.vm_data.gold.time >= smc.vm_data.gold.cd) {
|
||||||
|
if (smc.vm_data.gold.max < smc.vm_data.gold.max_limit) {
|
||||||
|
smc.vm_data.gold.max += 1;
|
||||||
|
}
|
||||||
smc.vm_data.gold.min = smc.vm_data.gold.max;
|
smc.vm_data.gold.min = smc.vm_data.gold.max;
|
||||||
smc.vm_data.gold.time = 0;
|
smc.vm_data.gold.time = 0;
|
||||||
}
|
}
|
||||||
@@ -77,24 +83,15 @@ export class MapViewComp extends CCComp {
|
|||||||
this.scene.node.active = true
|
this.scene.node.active = true
|
||||||
let hero = ecs.getEntity<Hero>(Hero);
|
let hero = ecs.getEntity<Hero>(Hero);
|
||||||
let pos = v3(BoxSet.HERO_START,BoxSet.GAME_LINE)
|
let pos = v3(BoxSet.HERO_START,BoxSet.GAME_LINE)
|
||||||
let speed =CardSet[uuid].speed
|
|
||||||
let camp = 1
|
let camp = 1
|
||||||
let prefab_path = CardSet[uuid].prefab_path
|
hero.load(pos,camp,uuid);
|
||||||
let name = CardSet[uuid].name
|
|
||||||
hero.load(pos,speed,camp,prefab_path,name);
|
|
||||||
}
|
}
|
||||||
private addMonster() {
|
private addMonster(uuid:number=1001) {
|
||||||
this.scene.node.active = true
|
this.scene.node.active = true
|
||||||
if (smc.monsters.length>0){
|
|
||||||
let monster = ecs.getEntity<Monster>(Monster);
|
let monster = ecs.getEntity<Monster>(Monster);
|
||||||
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
|
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
|
||||||
let speed =smc.monsters[0].speed
|
|
||||||
let camp = -1
|
let camp = -1
|
||||||
let prefab_path = smc.monsters[0].prefab_path
|
monster.load(pos,camp,uuid);
|
||||||
let name = smc.monsters[0].name
|
|
||||||
monster.load(pos,speed,camp,prefab_path,name);
|
|
||||||
smc.monsters.splice(0,1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* @LastEditors: dgflash
|
* @LastEditors: dgflash
|
||||||
* @LastEditTime: 2022-08-04 15:43:04
|
* @LastEditTime: 2022-08-04 15:43:04
|
||||||
*/
|
*/
|
||||||
import { instantiate, Node, Prefab, Vec3 ,tween, v3,Collider2D,Contact2DType,PhysicsSystem2D,IPhysics2DContact, animation,Label,resources,SpriteFrame,Sprite} from "cc";
|
import { instantiate, Node, Prefab, Vec3,v3,resources,SpriteFrame,Sprite} from "cc";
|
||||||
import { UICallbacks } from "../../../../extensions/oops-plugin-framework/assets/core/gui/layer/Defines";
|
import { UICallbacks } from "../../../../extensions/oops-plugin-framework/assets/core/gui/layer/Defines";
|
||||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||||
@@ -14,6 +14,7 @@ import { smc } from "../common/SingletonModuleComp";
|
|||||||
import { MonsterModelComp } from "./MonsterModelComp";
|
import { MonsterModelComp } from "./MonsterModelComp";
|
||||||
import { MonsterSpine } from "./MonsterSpine";
|
import { MonsterSpine } from "./MonsterSpine";
|
||||||
import { MonsterViewComp } from "./MonsterViewComp";
|
import { MonsterViewComp } from "./MonsterViewComp";
|
||||||
|
import { CardSet } from "../common/config/CardSet";
|
||||||
/** 角色实体 */
|
/** 角色实体 */
|
||||||
@ecs.register(`Hero`)
|
@ecs.register(`Hero`)
|
||||||
export class Hero extends ecs.Entity {
|
export class Hero extends ecs.Entity {
|
||||||
@@ -34,7 +35,7 @@ export class Hero extends ecs.Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 加载角色 */
|
/** 加载角色 */
|
||||||
load(pos: Vec3 = Vec3.ZERO,speed:number = 100,camp:number = 1,prefab_path:string = "monster",name:string="hero") {
|
load(pos: Vec3 = Vec3.ZERO,camp:number = 1,uuid:number=1001) {
|
||||||
// var path = "game/monster/"+prefab_path;
|
// var path = "game/monster/"+prefab_path;
|
||||||
var path = "game/heros/hero";
|
var path = "game/heros/hero";
|
||||||
|
|
||||||
@@ -47,25 +48,29 @@ export class Hero extends ecs.Entity {
|
|||||||
node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*camp, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
|
node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*camp, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
|
||||||
node.setPosition(pos)
|
node.setPosition(pos)
|
||||||
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
|
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
|
||||||
const url = 'game/heros/hero/'+prefab_path+'/spriteFrame';
|
const url = 'game/heros/hero/'+CardSet[uuid].prefab_path+'/spriteFrame';
|
||||||
resources.load(url, SpriteFrame, (err: any, spriteFrame) => {
|
resources.load(url, SpriteFrame, (err: any, spriteFrame) => {
|
||||||
const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||||
|
|
||||||
sprite.spriteFrame = spriteFrame;
|
sprite.spriteFrame = spriteFrame;
|
||||||
});
|
});
|
||||||
|
this.hero_init(uuid,node)
|
||||||
var mv = node.getComponent(MonsterViewComp)!;
|
|
||||||
mv.speed =mv.ospeed = speed;
|
|
||||||
mv.hero_name= name;
|
|
||||||
mv.camp = camp;
|
|
||||||
mv.Tpos = v3(0,0,0);
|
|
||||||
mv.change_name(name,camp)
|
|
||||||
this.add(mv);
|
|
||||||
smc.heros_in.push({name:mv.ent.name,eid:mv.ent.eid,pos_x:0})
|
|
||||||
oops.message.dispatchEvent("hero_load",this)
|
oops.message.dispatchEvent("hero_load",this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
|
||||||
|
var mv = node.getComponent(MonsterViewComp)!;
|
||||||
|
mv.speed =mv.ospeed = CardSet[uuid].speed;
|
||||||
|
mv.hero_name= CardSet[uuid].name;
|
||||||
|
mv.Tpos = v3(0,0,0);
|
||||||
|
mv.camp = 1;
|
||||||
|
mv.change_name(CardSet[uuid].name,1)
|
||||||
|
this.add(mv);
|
||||||
|
this.push_monsters_in(uuid,mv.ent.eid)
|
||||||
|
}
|
||||||
|
push_monsters_in(uuid:number=1001,eid:number=0){
|
||||||
|
smc.monsters_in.push({name:CardSet[uuid].name,eid:eid})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -45,13 +45,11 @@ export class HeroCardViewComp extends CCComp {
|
|||||||
let active = parent.getChildByName("active");
|
let active = parent.getChildByName("active");
|
||||||
active.setPosition(this.node.position.x,this.node.position.y)
|
active.setPosition(this.node.position.x,this.node.position.y)
|
||||||
active.active = true;
|
active.active = true;
|
||||||
console.log(parent);
|
|
||||||
// if(this.ent.eid == smc.vm_data.cards.eid){
|
// if(this.ent.eid == smc.vm_data.cards.eid){
|
||||||
// this.node.getChildByName("active").active = true;
|
// this.node.getChildByName("active").active = true;
|
||||||
// }else{
|
// }else{
|
||||||
// this.node.getChildByName("active").active = false;
|
// this.node.getChildByName("active").active = false;
|
||||||
// }
|
// }
|
||||||
console.log("onTouchMove");
|
|
||||||
let delta = event.getDelta();
|
let delta = event.getDelta();
|
||||||
this.node.setPosition(this.node.position.x+delta.x,this.node.position.y+delta.y);
|
this.node.setPosition(this.node.position.x+delta.x,this.node.position.y+delta.y);
|
||||||
}
|
}
|
||||||
@@ -68,7 +66,7 @@ export class HeroCardViewComp extends CCComp {
|
|||||||
}
|
}
|
||||||
use_card(){
|
use_card(){
|
||||||
if(smc.vm_data.gold.min >= CardSet[this.card_uid].level){
|
if(smc.vm_data.gold.min >= CardSet[this.card_uid].level){
|
||||||
oops.message.dispatchEvent("do_add_hero",this.ent)
|
oops.message.dispatchEvent("do_add_hero",{uuid:this.card_uid})
|
||||||
this.ent.destroy();
|
this.ent.destroy();
|
||||||
smc.vm_data.gold.min -= CardSet[this.card_uid].level;
|
smc.vm_data.gold.min -= CardSet[this.card_uid].level;
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* @LastEditors: dgflash
|
* @LastEditors: dgflash
|
||||||
* @LastEditTime: 2022-08-04 15:43:04
|
* @LastEditTime: 2022-08-04 15:43:04
|
||||||
*/
|
*/
|
||||||
import { instantiate, Node, Prefab, Vec3 ,tween, v3,Collider2D,Contact2DType,PhysicsSystem2D,IPhysics2DContact, animation,Label,resources,SpriteFrame,Sprite} from "cc";
|
import { instantiate, Node, Prefab, Vec3 ,v3,resources,SpriteFrame,Sprite,} from "cc";
|
||||||
import { UICallbacks } from "../../../../extensions/oops-plugin-framework/assets/core/gui/layer/Defines";
|
import { UICallbacks } from "../../../../extensions/oops-plugin-framework/assets/core/gui/layer/Defines";
|
||||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||||
@@ -14,6 +14,7 @@ import { smc } from "../common/SingletonModuleComp";
|
|||||||
import { MonsterModelComp } from "./MonsterModelComp";
|
import { MonsterModelComp } from "./MonsterModelComp";
|
||||||
import { MonsterSpine } from "./MonsterSpine";
|
import { MonsterSpine } from "./MonsterSpine";
|
||||||
import { MonsterViewComp } from "./MonsterViewComp";
|
import { MonsterViewComp } from "./MonsterViewComp";
|
||||||
|
import { CardSet } from "../common/config/CardSet";
|
||||||
/** 角色实体 */
|
/** 角色实体 */
|
||||||
@ecs.register(`Monster`)
|
@ecs.register(`Monster`)
|
||||||
export class Monster extends ecs.Entity {
|
export class Monster extends ecs.Entity {
|
||||||
@@ -34,7 +35,7 @@ export class Monster extends ecs.Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 加载角色 */
|
/** 加载角色 */
|
||||||
load(pos: Vec3 = Vec3.ZERO,speed:number = 100,camp:number = 1,prefab_path:string = "monster",name:string="hero") {
|
load(pos: Vec3 = Vec3.ZERO,camp:number = -1,uuid:number=1001) {
|
||||||
// var path = "game/monster/"+prefab_path;
|
// var path = "game/monster/"+prefab_path;
|
||||||
var path = "game/heros/hero";
|
var path = "game/heros/hero";
|
||||||
|
|
||||||
@@ -47,31 +48,27 @@ export class Monster extends ecs.Entity {
|
|||||||
node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*camp, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
|
node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*camp, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
|
||||||
node.setPosition(pos)
|
node.setPosition(pos)
|
||||||
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
|
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
|
||||||
const url = 'game/heros/hero/'+prefab_path+'/spriteFrame';
|
const url = 'game/heros/hero/'+CardSet[uuid].prefab_path+'/spriteFrame';
|
||||||
resources.load(url, SpriteFrame, (err: any, spriteFrame) => {
|
resources.load(url, SpriteFrame, (err: any, spriteFrame) => {
|
||||||
const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||||
|
|
||||||
sprite.spriteFrame = spriteFrame;
|
sprite.spriteFrame = spriteFrame;
|
||||||
});
|
});
|
||||||
|
this.hero_init(uuid,node)
|
||||||
|
oops.message.dispatchEvent("monster_load",this)
|
||||||
|
}
|
||||||
|
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
|
||||||
var mv = node.getComponent(MonsterViewComp)!;
|
var mv = node.getComponent(MonsterViewComp)!;
|
||||||
mv.speed =mv.ospeed = speed;
|
mv.speed =mv.ospeed = CardSet[uuid].speed;
|
||||||
mv.hero_name= name;
|
mv.hero_name= CardSet[uuid].name;
|
||||||
mv.camp = camp;
|
mv.camp = -1;
|
||||||
mv.Tpos = v3(0,0,0);
|
mv.Tpos = v3(0,0,0);
|
||||||
mv.change_name(name,camp)
|
mv.change_name(CardSet[uuid].name,-1)
|
||||||
this.add(mv);
|
this.add(mv);
|
||||||
if(camp == 1){
|
this.push_monsters_in(uuid,mv.ent.eid)
|
||||||
smc.heros_in.push({name:mv.ent.name,eid:mv.ent.eid,pos_x:0})
|
}
|
||||||
oops.message.dispatchEvent("hero_load",this)
|
push_monsters_in(uuid:number=1001,eid:number=0){
|
||||||
}else{
|
smc.monsters_in.push({name:CardSet[uuid].name,eid:eid})
|
||||||
smc.monsters_in.push({name:mv.ent.name,eid:mv.ent.eid,pos_x:0})
|
|
||||||
oops.message.dispatchEvent("monster_load",this)
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.log(smc.heros_in,smc.monsters_in)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user