696ff5f2-c791-439d-a6ca-318205f4c37f.js
2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"use strict";
cc._RF.push(module, '696ffXyx5FDnabKMYIF9MN/', 'ItemFix');
// script/game/ui/ItemFix.ts
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const { ccclass, property } = cc._decorator;
let ItemFix = /** @class */ (() => {
let ItemFix = class ItemFix extends cc.Component {
constructor() {
super(...arguments);
this.fixHua = false;
this.fixQiang = false;
this.fixBiao = false;
this.fixBen = false;
}
start() {
}
onLoad() {
//卧室界面的设计尺寸是620 * 930
let parentNodewidth = cc.winSize.width;
let parentNodeHeight = cc.winSize.height;
let rW = parentNodewidth / 720;
let rH = parentNodeHeight / 1280;
let comp = this.getComponent(cc.Widget);
let itemHeight = this.node.getChildByName("itemSpr").height;
let itemWidth = this.node.getChildByName("itemSpr").width;
if (this.fixHua) {
comp.top = (parentNodeHeight / 2) - (280 * rH) - (itemHeight * rH / 2);
if (rH < 1) {
this.node.scale = 0.8;
comp.left = itemWidth * 0.8 / 2;
}
else {
comp.left = itemWidth / 2;
}
}
if (this.fixQiang) {
comp.top = (parentNodeHeight / 2) + 50;
comp.left = comp.left * rW;
}
if (this.fixBiao) {
comp.right = comp.right * rW;
comp.bottom = comp.bottom * rH;
}
if (this.fixBen) {
comp.right = comp.right * rW;
comp.bottom = comp.bottom * rH;
}
comp.updateAlignment();
}
};
__decorate([
property({ tooltip: "是否适配画" })
], ItemFix.prototype, "fixHua", void 0);
__decorate([
property({ tooltip: "是否适配手枪" })
], ItemFix.prototype, "fixQiang", void 0);
__decorate([
property({ tooltip: "是否适配手表" })
], ItemFix.prototype, "fixBiao", void 0);
__decorate([
property({ tooltip: "是否适配笔记本" })
], ItemFix.prototype, "fixBen", void 0);
ItemFix = __decorate([
ccclass
], ItemFix);
return ItemFix;
})();
exports.default = ItemFix;
cc._RF.pop();