Skip to content

Commit

Permalink
Export plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rexrainbow committed Sep 25, 2023
1 parent 228e2fa commit a9e02ce
Show file tree
Hide file tree
Showing 18 changed files with 8,530 additions and 8,907 deletions.
4,523 changes: 2,198 additions & 2,325 deletions dist/rexgameobjectshellplugin.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions dist/rexgameobjectshellplugin.min.js

Large diffs are not rendered by default.

7,889 changes: 3,881 additions & 4,008 deletions dist/rextweaker.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/rextweaker.min.js

Large diffs are not rendered by default.

4,885 changes: 2,379 additions & 2,506 deletions dist/rexuiplugin.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/rexuiplugin.min.js

Large diffs are not rendered by default.

60 changes: 32 additions & 28 deletions templates/ui/tweaker/Tweaker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,34 +121,6 @@ declare namespace Tweaker {
}
}

interface IInputHandlerConfig {
name?: string,

baseClass?: BaseSizer,

accept: (
config: IAddInputConfig,
value: unknown
) => boolean,

build: (
gameObject: BaseSizer,
style: IInputRowStyle
) => void,

setup?: (
gameObject: BaseSizer,
config: IAddInputConfig,
setDefaults: boolean,
) => void,

displayValue?: (
gameObject: BaseSizer,
value: unknown
) => void,

}

interface IAddInputConfig {
bindingTarget?: Object,
bindingKey?: string,
Expand Down Expand Up @@ -223,6 +195,38 @@ declare namespace Tweaker {

key?: string,
}

interface IAcceptConfig extends IAddInputConfig {
value: unknown
}

interface IInputHandlerConfig {
name?: string,

baseClass?: BaseSizer,

accept: (
config: IAcceptConfig,
) => boolean,

build: (
gameObject: BaseSizer,
style: IInputRowStyle
) => void,

setup?: (
gameObject: BaseSizer,
config: IAddInputConfig,
setDefaults: boolean,
) => void,

displayValue?: (
gameObject: BaseSizer,
value: unknown
) => void,

}

}

declare class Tweaker extends Sizer {
Expand Down
8 changes: 1 addition & 7 deletions templates/ui/tweaker/builders/CreateInputField.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import GenerateInputFieldClass from '../gameobjects/inputfield/GenerateInputFieldClass.js';

var CreateInputField = function (scene, config, style) {
var value = undefined;
var bindingTarget = config.bindingTarget;
if (bindingTarget && (typeof (bindingTarget) === 'object')) {
value = bindingTarget[config.bindingKey];
}

var inputField;
var inputHandlers = this.inputHandlers;
for (var i = 0, cnt = inputHandlers.length; i < cnt; i++) {
var handler = inputHandlers[i];
if (handler.accept(config, value)) {
if (handler.accept(config)) {
var InputFieldClass = GenerateInputFieldClass(handler.baseClass);
inputField = new InputFieldClass(scene);
scene.add.existing(inputField);
Expand Down
4 changes: 2 additions & 2 deletions templates/ui/tweaker/inputhandlers/ButtonsInputHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ var SetOptions = function (gameObject, options) {
export default {
name: 'ButtonsInput',

accept(config, value) {
accept(config) {
if (config.hasOwnProperty('view')) {
return (config.view === 'buttons')
}

return false;
},

// Callback inside `constructor()`
// Callback after `constructor()`
build(gameObject, style) {
var scene = gameObject.scene;

Expand Down
6 changes: 3 additions & 3 deletions templates/ui/tweaker/inputhandlers/CheckboxInputHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import CreateCheckbox from './utils/CreateCheckbox.js';
export default {
name: 'CheckboxInput',

accept(config, value) {
accept(config) {
if (config.hasOwnProperty('view')) {
return (config.view === 'boolean')
}

return typeof (value) === 'boolean';
return typeof (config.value) === 'boolean';
},

// Callback inside `constructor()`
// Callback after `constructor()`
build(gameObject, style) {
var scene = gameObject.scene;

Expand Down
4 changes: 2 additions & 2 deletions templates/ui/tweaker/inputhandlers/ColorInputHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import CreateColorInput from './utils/CreateColorInput.js';
export default {
name: 'ColorInput',

accept(config, value) {
accept(config) {
if (config.hasOwnProperty('view')) {
return (config.view === 'color')
}
return false;
},

// Callback inside `constructor()`
// Callback after `constructor()`
build(gameObject, style) {
var scene = gameObject.scene;

Expand Down
4 changes: 2 additions & 2 deletions templates/ui/tweaker/inputhandlers/ListInputHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ var SetOptions = function (gameObject, options) {
export default {
name: 'ListInput',

accept(config, value) {
accept(config) {
if (config.hasOwnProperty('view')) {
return (config.view === 'list')
}

return (config.hasOwnProperty('options'));
},

// Callback inside `constructor()`
// Callback after `constructor()`
build(gameObject, style) {
var scene = gameObject.scene;

Expand Down
6 changes: 3 additions & 3 deletions templates/ui/tweaker/inputhandlers/NumberInputHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ var SetInputTextReadOnly = function (gameObject, enable) {
export default {
name: 'NumberInput',

accept(config, value) {
accept(config) {
if (config.hasOwnProperty('view')) {
return (config.view === 'number')
}

return typeof (value) === 'number';
return typeof (config.value) === 'number';
},

// Callback inside `constructor()`
// Callback after `constructor()`
build(gameObject, style) {
var scene = gameObject.scene;

Expand Down
6 changes: 3 additions & 3 deletions templates/ui/tweaker/inputhandlers/RangeInputHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ var SetInputTextReadOnly = function (gameObject, enable) {
export default {
name: 'RangeInput',

accept(config, value) {
accept(config) {
if (config.hasOwnProperty('view')) {
return (config.view === 'range')
}

return (typeof (value) === 'number') &&
return (typeof (config.value) === 'number') &&
config.hasOwnProperty('min') &&
config.hasOwnProperty('max');

},

// Callback inside `constructor()`
// Callback after `constructor()`
build(gameObject, style) {
var scene = gameObject.scene;

Expand Down
4 changes: 2 additions & 2 deletions templates/ui/tweaker/inputhandlers/TextAreaInputHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ var SetInputTextReadOnly = function (gameObject, enable) {
export default {
name: 'TextAreaInput',

accept(config, value) {
accept(config) {
if (config.hasOwnProperty('view')) {
return (config.view === 'textarea')
}

return false;
},

// Callback inside `constructor()`
// Callback after `constructor()`
build(gameObject, style) {
var scene = gameObject.scene;

Expand Down
6 changes: 3 additions & 3 deletions templates/ui/tweaker/inputhandlers/TextInputHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ var SetInputTextReadOnly = function (gameObject, enable) {
export default {
name: 'TextInput',

accept(config, value) {
accept(config) {
if (config.hasOwnProperty('view')) {
return (config.view === 'string')
}

return typeof (value) === 'string';
return typeof (config.value) === 'string';
},

// Callback inside `constructor()`
// Callback after `constructor()`
build(gameObject, style) {
var scene = gameObject.scene;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import CreateToggleSwitch from './utils/CreateToggleSwitch.js';
export default {
name: 'ToggleSwitchInput',

accept(config, value) {
accept(config) {
if (config.hasOwnProperty('view')) {
return (config.view === 'toggleSwitch')
}

return false;
},

// Callback inside `constructor()`
// Callback after `constructor()`
build(gameObject, style) {
var scene = gameObject.scene;

Expand Down
6 changes: 6 additions & 0 deletions templates/ui/tweaker/methods/AddInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ var AddInput = function (object, key, config) {
config.title = key;
}

if (config.bindingTarget && config.bindingKey) {
config.value = config.bindingTarget[config.bindingKey];
} else {
config.value = undefined;
}

// Create InputRow
var inputRowStyle = this.styles.inputRow || {};
inputRowStyle.parentOrientation = this.styles.orientation;
Expand Down

0 comments on commit a9e02ce

Please sign in to comment.