refactor(hero): 统一角色状态初始化逻辑并调整UI布局
1. 将HeroSpine和HeroViewComp的默认状态从"idle"改为空字符串 2. 替换HeroViewComp中直接调用as.idle()为status_change方法 3. 调整role_controller预制体的UI元素位置和尺寸,适配240宽度布局
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1386,7 +1386,7 @@
|
|||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": -180,
|
"x": -240,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
@@ -1785,7 +1785,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 180,
|
"width": 240,
|
||||||
"height": 110
|
"height": 110
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -2387,7 +2387,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 180,
|
"width": 240,
|
||||||
"height": 110
|
"height": 110
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -2910,7 +2910,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 180,
|
"width": 240,
|
||||||
"height": 110
|
"height": 110
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -3509,7 +3509,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 180,
|
"width": 240,
|
||||||
"height": 110
|
"height": 110
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -4764,7 +4764,7 @@
|
|||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 180,
|
"x": 240,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
@@ -5163,7 +5163,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 180,
|
"width": 240,
|
||||||
"height": 110
|
"height": 110
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -5765,7 +5765,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 180,
|
"width": 240,
|
||||||
"height": 110
|
"height": 110
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -9317,7 +9317,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 540,
|
"width": 720,
|
||||||
"height": 200
|
"height": 200
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -9345,8 +9345,8 @@
|
|||||||
},
|
},
|
||||||
"_alignFlags": 44,
|
"_alignFlags": 44,
|
||||||
"_target": null,
|
"_target": null,
|
||||||
"_left": 90,
|
"_left": 0,
|
||||||
"_right": 90,
|
"_right": 0,
|
||||||
"_top": 0,
|
"_top": 0,
|
||||||
"_bottom": -2,
|
"_bottom": -2,
|
||||||
"_horizontalCenter": 0,
|
"_horizontalCenter": 0,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export class HeroSpine extends Component {
|
|||||||
@property(HeroAnmComp)
|
@property(HeroAnmComp)
|
||||||
anm: HeroAnmComp = null;
|
anm: HeroAnmComp = null;
|
||||||
|
|
||||||
status:string="idle";
|
status:string="";
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
// 角色控制组件
|
// 角色控制组件
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
|
|
||||||
// ==================== View 层属性(表现相关)====================
|
// ==================== View 层属性(表现相关)====================
|
||||||
as: HeroSpine = null!
|
as: HeroSpine = null!
|
||||||
status:String = "idle"
|
status:String = ""
|
||||||
scale: number = 1; // 显示方向
|
scale: number = 1; // 显示方向
|
||||||
box_group:number = BoxSet.HERO; // 碰撞组
|
box_group:number = BoxSet.HERO; // 碰撞组
|
||||||
realDeadTime:number=0.1
|
realDeadTime:number=0.1
|
||||||
@@ -104,10 +104,10 @@ export class HeroViewComp extends CCComp {
|
|||||||
|
|
||||||
/** 初始化/重置视图状态 */
|
/** 初始化/重置视图状态 */
|
||||||
init() {
|
init() {
|
||||||
this.status = "idle";
|
this.status = "";
|
||||||
this.deadCD = 0;
|
this.deadCD = 0;
|
||||||
this.lastBarUpdateTime = 0;
|
this.lastBarUpdateTime = 0;
|
||||||
this.as.idle()
|
this.status_change("idle");
|
||||||
|
|
||||||
// 初始化 UI 节点
|
// 初始化 UI 节点
|
||||||
this.initUINodes();
|
this.initUINodes();
|
||||||
|
|||||||
Reference in New Issue
Block a user