[add] Engine
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import ScreenResize from "../ScreenResize";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass("SwitchActive")
|
||||
export class SwitchActive {
|
||||
@property({ type: cc.Node })
|
||||
public UI: cc.Node = null;
|
||||
@property({ type: cc.Boolean/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||||
public show: boolean[] = [];
|
||||
|
||||
public SetObjActive(obj: cc.Node, show: boolean): void {
|
||||
obj.active = show;
|
||||
}
|
||||
}
|
||||
@ccclass
|
||||
export default class SwitchActiveGroup extends cc.Component {
|
||||
@property({ displayName: "縮放scale群組", type: SwitchActive })
|
||||
public ScaleGroups: SwitchActive[] = [];
|
||||
public Run(): void {
|
||||
if (this.ScaleGroups != null && this.ScaleGroups.length) {
|
||||
for (let group of this.ScaleGroups) {
|
||||
group.SetObjActive(group.UI, group.show[ScreenResize.IsPortrait]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "a96cf057-9e35-4146-89df-5f0f4819fb6c",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
import ScreenResize from "../ScreenResize";
|
||||
import { UIManager } from "../UIManager";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass("SwitchActiveObj")
|
||||
export class SwitchActiveObj {
|
||||
@property({ type: cc.Node })
|
||||
public UI: cc.Node = null;
|
||||
@property({ type: cc.Boolean/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||||
public show: boolean[] = [];
|
||||
|
||||
public SetObjActive(obj: cc.Node, show: boolean): void {
|
||||
obj.active = show;
|
||||
}
|
||||
}
|
||||
@ccclass
|
||||
export default class SwitchActiveGroupExtra extends cc.Component {
|
||||
@property({ displayName: "縮放scale群組", type: SwitchActiveObj })
|
||||
public ScaleGroups: SwitchActiveObj[] = [];
|
||||
public Run(): void {
|
||||
if (this.ScaleGroups != null && this.ScaleGroups.length) {
|
||||
for (let group of this.ScaleGroups) {
|
||||
group.SetObjActive(group.UI, group.show[ScreenResize.IsPortrait]);
|
||||
}
|
||||
}
|
||||
}
|
||||
onLoad() {
|
||||
UIManager.DireEvent.AddCallback(this.Run, this);
|
||||
this.Run();
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "9d9e9007-973c-4926-b5cf-aacceae74665",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
import ScreenResize from "../ScreenResize";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
@ccclass("SwitchImgSourceGroup")
|
||||
export class SwitchImgSourceGroup {
|
||||
@property({ type: cc.Node })
|
||||
public Sprite: cc.Sprite = null;
|
||||
@property({ type: cc.SpriteFrame/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||||
public SourceImg: cc.SpriteFrame[] = [];
|
||||
|
||||
public SetImg(obj: cc.Sprite, switchObj: cc.SpriteFrame): void {
|
||||
if (obj == null || switchObj == null) {
|
||||
return;
|
||||
}
|
||||
obj.getComponent(cc.Sprite).spriteFrame = switchObj;
|
||||
}
|
||||
}
|
||||
|
||||
@ccclass
|
||||
export default class SwitchImgGroup extends cc.Component {
|
||||
@property({ displayName: "換UI群組", type: SwitchImgSourceGroup })
|
||||
public ImgGroups: SwitchImgSourceGroup[] = [];
|
||||
public Run(): void {
|
||||
if (this.ImgGroups != null && this.ImgGroups.length) {
|
||||
for (let group of this.ImgGroups) {
|
||||
group.SetImg(group.Sprite, group.SourceImg[ScreenResize.IsPortrait]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "56151188-edd5-4384-8a84-50a84456a6c3",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
import ScreenResize from "../ScreenResize";
|
||||
import { UIManager } from "../UIManager";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
@ccclass("SwitchImgSource")
|
||||
export class SwitchImgSource {
|
||||
@property({ type: cc.Node })
|
||||
public Sprite: cc.Sprite = null;
|
||||
@property({ type: cc.SpriteFrame/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||||
public SourceImg: cc.SpriteFrame[] = [];
|
||||
|
||||
public SetImg(obj: cc.Sprite, switchObj: cc.SpriteFrame): void {
|
||||
if (obj == null || switchObj == null) {
|
||||
return;
|
||||
}
|
||||
obj.getComponent(cc.Sprite).spriteFrame = switchObj;
|
||||
}
|
||||
}
|
||||
|
||||
@ccclass
|
||||
export default class SwitchImgGroupExtra extends cc.Component {
|
||||
@property({ displayName: "換UI群組", type: SwitchImgSource })
|
||||
public ImgGroups: SwitchImgSource[] = [];
|
||||
public Run(): void {
|
||||
if (this.ImgGroups != null && this.ImgGroups.length) {
|
||||
for (let group of this.ImgGroups) {
|
||||
group.SetImg(group.Sprite, group.SourceImg[ScreenResize.IsPortrait]);
|
||||
}
|
||||
}
|
||||
}
|
||||
onLoad() {
|
||||
UIManager.DireEvent.AddCallback(this.Run, this);
|
||||
this.Run();
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "208b15b7-a199-4b86-a538-3d1d18695552",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
import ScreenResize from "../ScreenResize";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
@ccclass("SwitchPosition")
|
||||
export class SwitchPosition {
|
||||
@property({ type: cc.Node })
|
||||
public UI: cc.Node = null;
|
||||
@property({ type: cc.Vec2/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||||
public Pos: cc.Vec2[] = [];
|
||||
|
||||
public SetPos(obj: cc.Node, posNum: cc.Vec2): void {
|
||||
obj.setPosition(posNum);
|
||||
}
|
||||
}
|
||||
@ccclass
|
||||
export default class SwitchPositionGroup extends cc.Component {
|
||||
@property({ displayName: "改變座標群組", type: SwitchPosition })
|
||||
public PosGroups: SwitchPosition[] = [];
|
||||
public Run(): void {
|
||||
if (this.PosGroups != null && this.PosGroups.length) {
|
||||
for (let group of this.PosGroups) {
|
||||
if (!group.UI || !group.Pos[ScreenResize.IsPortrait]) {
|
||||
cc.error("沒有設定節點或座標.name=" + this.node.name);
|
||||
continue;
|
||||
}
|
||||
group.SetPos(group.UI, group.Pos[ScreenResize.IsPortrait]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "2083e1d2-be99-4173-b425-cdc9da21cbb3",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
import ScreenResize from "../ScreenResize";
|
||||
import { UIManager } from "../UIManager";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
@ccclass("SwitchPositionObj")
|
||||
export class SwitchPositionObj {
|
||||
@property({ type: cc.Node })
|
||||
public UI: cc.Node = null;
|
||||
@property({ type: cc.Vec2/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||||
public Pos: cc.Vec2[] = [];
|
||||
|
||||
public SetPos(obj: cc.Node, posNum: cc.Vec2): void {
|
||||
obj.setPosition(posNum);
|
||||
}
|
||||
}
|
||||
@ccclass
|
||||
export default class SwitchPositionGroupExtra extends cc.Component {
|
||||
@property({ displayName: "改變座標群組", type: SwitchPositionObj })
|
||||
public PosGroups: SwitchPositionObj[] = [];
|
||||
public Run(param: any[] = null): void {
|
||||
if (this.PosGroups != null && this.PosGroups.length) {
|
||||
for (let group of this.PosGroups) {
|
||||
cc.log("橫直轉換:" + group.UI.name + ":" + group.Pos[ScreenResize.IsPortrait]);
|
||||
group.SetPos(group.UI, group.Pos[ScreenResize.IsPortrait]);
|
||||
}
|
||||
}
|
||||
}
|
||||
onLoad() {
|
||||
UIManager.DireEvent.AddCallback(this.Run, this);
|
||||
this.Run();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "512c7a23-3a86-4d84-abc6-9553be08da10",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
import ScreenResize from "../ScreenResize";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass("SwitchRotation")
|
||||
export class SwitchRotation {
|
||||
@property({ type: cc.Node })
|
||||
public UI: cc.Node = null;
|
||||
@property({ type: cc.Float/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||||
public rotaitonNum: number[] = [];
|
||||
|
||||
public SetObjRotation(obj: cc.Node, r: number): void {
|
||||
obj.angle = -r;
|
||||
}
|
||||
}
|
||||
@ccclass
|
||||
export default class SwitchRotationGroup extends cc.Component {
|
||||
@property({ displayName: "設定rotation群組", type: SwitchRotation })
|
||||
public ScaleGroups: SwitchRotation[] = [];
|
||||
public Run(): void {
|
||||
if (this.ScaleGroups != null && this.ScaleGroups.length) {
|
||||
for (let group of this.ScaleGroups) {
|
||||
group.SetObjRotation(group.UI, group.rotaitonNum[ScreenResize.IsPortrait]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "e53fa0f6-ddad-41e1-b0d2-df151a2f3ff0",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
import ScreenResize from "../ScreenResize";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass("SwitchSize")
|
||||
export class SwitchScale {
|
||||
@property({ type: cc.Node })
|
||||
public UI: cc.Node = null;
|
||||
@property({ type: cc.Float/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||||
public ScaleNum: number[] = [];
|
||||
|
||||
public SetObjScale(obj: cc.Node, scaleNum: number): void {
|
||||
obj.setScale(scaleNum);
|
||||
}
|
||||
}
|
||||
@ccclass
|
||||
export default class SwitchScaleGroup extends cc.Component {
|
||||
@property({ displayName: "縮放scale群組", type: SwitchScale })
|
||||
public ScaleGroups: SwitchScale[] = [];
|
||||
public Run(): void {
|
||||
if (this.ScaleGroups != null && this.ScaleGroups.length) {
|
||||
for (let group of this.ScaleGroups) {
|
||||
group.SetObjScale(group.UI, group.ScaleNum[ScreenResize.IsPortrait]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "4e2f6235-b5a6-4c44-9ea5-4779b97f1630",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
import ScreenResize from "../ScreenResize";
|
||||
import { UIManager } from "../UIManager";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass("SwitchSizeObj")
|
||||
export class SwitchScaleObj {
|
||||
@property({ type: cc.Node })
|
||||
public UI: cc.Node = null;
|
||||
@property({ type: cc.Float/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||||
public ScaleNum: number[] = [];
|
||||
|
||||
public SetObjScale(obj: cc.Node, scaleNum: number): void {
|
||||
obj.setScale(scaleNum);
|
||||
}
|
||||
}
|
||||
@ccclass
|
||||
export default class SwitchScaleGroupExtra extends cc.Component {
|
||||
@property({ displayName: "縮放scale群組", type: SwitchScaleObj })
|
||||
public ScaleGroups: SwitchScaleObj[] = [];
|
||||
public Run(): void {
|
||||
if (this.ScaleGroups != null && this.ScaleGroups.length) {
|
||||
for (let group of this.ScaleGroups) {
|
||||
group.SetObjScale(group.UI, group.ScaleNum[ScreenResize.IsPortrait]);
|
||||
}
|
||||
}
|
||||
}
|
||||
onLoad() {
|
||||
UIManager.DireEvent.AddCallback(this.Run, this);
|
||||
this.Run();
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "065d43a0-b2c1-4a41-8e84-8a0f3d3817f2",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
import ScreenResize from "../ScreenResize";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
@ccclass("SwitchUIGroup")
|
||||
export class SwitchUIGroup {
|
||||
@property({ type: cc.Node })
|
||||
public UI: cc.Node = null;
|
||||
@property({ type: cc.Integer/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||||
public SourceID: number[] = [];
|
||||
|
||||
public Set(obj: cc.Node, switchObj: cc.Node): void {
|
||||
if (obj == null || switchObj == null) {
|
||||
return;
|
||||
}
|
||||
obj.removeAllChildren();
|
||||
obj.ExAddChild(switchObj);
|
||||
}
|
||||
}
|
||||
|
||||
@ccclass
|
||||
export default class SwitchSoueceGroup extends cc.Component {
|
||||
@property({ displayName: "換UI群組", type: SwitchUIGroup })
|
||||
public UIGroups: SwitchUIGroup[] = [];
|
||||
public Run(switchObg: cc.Node): void {
|
||||
if (this.UIGroups != null && this.UIGroups.length) {
|
||||
for (let group of this.UIGroups) {
|
||||
let child: cc.Node[] = switchObg.getChildByName(group.SourceID[ScreenResize.IsPortrait].toString()).children;
|
||||
for (let i: number = 0; i < child.length; i++) {
|
||||
group.Set(group.UI, child[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "45ea513f-8665-4d40-8b51-3a67ab35f327",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
import ScreenResize from "../ScreenResize";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
@ccclass("SwitchWH")
|
||||
export class SwitchWH {
|
||||
@property({ type: cc.Node })
|
||||
public UI: cc.Node = null;
|
||||
@property({ type: cc.Vec2/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||||
public WH: cc.Vec2[] = [];
|
||||
|
||||
public SetWH(obj: cc.Node, WHNum: cc.Vec2): void {
|
||||
obj.SetSizeDelta(WHNum);
|
||||
}
|
||||
}
|
||||
@ccclass
|
||||
export default class SwitchWHGroup extends cc.Component {
|
||||
@property({ displayName: "改變寬高群組", type: SwitchWH })
|
||||
public WHGroups: SwitchWH[] = [];
|
||||
public Run(): void {
|
||||
if (this.WHGroups != null && this.WHGroups.length) {
|
||||
for (let group of this.WHGroups) {
|
||||
group.SetWH(group.UI, group.WH[ScreenResize.IsPortrait]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "5cfb2592-7ada-4b09-81dc-0dc14dc94aa5",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
import ScreenResize from "../ScreenResize";
|
||||
import { UIManager } from "../UIManager";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
@ccclass("SwitchWHObj")
|
||||
export class SwitchWHObj {
|
||||
@property({ type: cc.Node })
|
||||
public UI: cc.Node = null;
|
||||
@property({ type: cc.Vec2/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||||
public WH: cc.Vec2[] = [];
|
||||
|
||||
public SetWH(obj: cc.Node, WHNum: cc.Vec2): void {
|
||||
obj.SetSizeDelta(WHNum);
|
||||
}
|
||||
}
|
||||
@ccclass
|
||||
export default class SwitchWHGroupExtra extends cc.Component {
|
||||
@property({ displayName: "改變寬高群組", type: SwitchWHObj })
|
||||
public WHGroups: SwitchWHObj[] = [];
|
||||
public Run(): void {
|
||||
if (this.WHGroups != null && this.WHGroups.length) {
|
||||
for (let group of this.WHGroups) {
|
||||
group.SetWH(group.UI, group.WH[ScreenResize.IsPortrait]);
|
||||
}
|
||||
}
|
||||
}
|
||||
onLoad() {
|
||||
UIManager.DireEvent.AddCallback(this.Run, this);
|
||||
this.Run();
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "b9806317-d4bd-4aac-be3e-a16b0a3159f9",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
Reference in New Issue
Block a user