Skip to content

Commit

Permalink
Twist logic
Browse files Browse the repository at this point in the history
  • Loading branch information
rexrainbow committed Oct 11, 2023
1 parent daaa508 commit 00687fa
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 77 deletions.
9 changes: 6 additions & 3 deletions templates/gameobjectshell/shell/Shell.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import ComponentBase from '../../../plugins/utils/componentbase/ComponentBase.js';
import CreateBackground from './methods/CreateBackground.js';
import CreatePropertiesPanel from './methods/CreatePropertiesPanel.js';
import CreateControlPoints from './methods/CreateControlPoints.js';
import Methods from './methods/Methods.js';
import { OnSelectGameObject, OnUnSelectGameObject } from './methods/SelectGameObjectMethods.js';

Expand All @@ -20,11 +23,11 @@ class Shell extends ComponentBase {

this.addLayerManager(config);

this.addBackground(config);
CreateBackground.call(this, config);

this.addPropertiesPanel(config)
CreatePropertiesPanel.call(this, config);

this.addControlPoints(config);
CreateControlPoints.call(this, config);

/*
Expand Down
24 changes: 0 additions & 24 deletions templates/gameobjectshell/shell/methods/BackgroundMethods.js

This file was deleted.

16 changes: 0 additions & 16 deletions templates/gameobjectshell/shell/methods/ControlPointsMethods.js

This file was deleted.

20 changes: 20 additions & 0 deletions templates/gameobjectshell/shell/methods/CreateBackground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import FullWindowRectangle from '../../fullwindowrectangle/FullWindowRectangle.js';

var CreateBackground = function (config) {
var background = new FullWindowRectangle(this.scene);
this.scene.add.existing(background);
this.addToBackgroundLayer(background);

var shell = this;
var onUnSelectGameObject = function () {
shell.onUnSelectGameObjectCallback(shell);
}

background
.setInteractive()
.on('pointerdown', onUnSelectGameObject)

this.background = background;
}

export default CreateBackground;
13 changes: 13 additions & 0 deletions templates/gameobjectshell/shell/methods/CreateControlPoints.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import ControlPoints from '../../controlpoints/ControlPoints.js';

const GetValue = Phaser.Utils.Objects.GetValue;

var CreateControlPoints = function (config) {
var controlPoints = new ControlPoints(this.scene, GetValue(config, 'controlPoints'));
this.scene.add.existing(controlPoints);
this.addToUILayer(controlPoints);

this.controlPoints = controlPoints;
}

export default CreateControlPoints;
26 changes: 26 additions & 0 deletions templates/gameobjectshell/shell/methods/CreatePropertiesPanel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import PropertiesPanel from '../../propertiespanel/PropertiesPanel.js';

const GetValue = Phaser.Utils.Objects.GetValue;

var CreatePropertiesPanel = function (config) {
var panelConfig = GetValue(config, 'panel', {});
var unknowPositon = (panelConfig.x === undefined) && (panelConfig.y === undefined);

var extraProperties = GetValue(config, 'extraProperties', {});

var panel = new PropertiesPanel(this.scene, panelConfig, extraProperties);
panel.setScrollFactor(0);

this.scene.add.existing(panel);
panel.layout();
this.addToUILayer(panel);

if (unknowPositon) {
panel.left = 0;
panel.top = 0;
}

this.panel = panel;
}

export default CreatePropertiesPanel;
6 changes: 0 additions & 6 deletions templates/gameobjectshell/shell/methods/Methods.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import LayerManagerMethods from './LayerManagerMethods.js';
import BackgroundMethods from './BackgroundMethods.js';
import PropertiesPanelMethods from './PropertiesPanelMethods.js';
import ControlPointsMethods from './ControlPointsMethods.js';
import BindingTargetMethods from './BindingTargetMethods.js';

var Methods = {
Expand All @@ -11,9 +8,6 @@ var Methods = {
Object.assign(
Methods,
LayerManagerMethods,
BackgroundMethods,
PropertiesPanelMethods,
ControlPointsMethods,
BindingTargetMethods,
)

Expand Down
28 changes: 0 additions & 28 deletions templates/gameobjectshell/shell/methods/PropertiesPanelMethods.js

This file was deleted.

0 comments on commit 00687fa

Please sign in to comment.