2025-02-22 22:52:07 -06:00
|
|
|
import type MockTextureManager from "#test/testUtils/mocks/mockTextureManager";
|
2025-01-12 15:33:05 -08:00
|
|
|
import type { MockGameObject } from "../mockGameObject";
|
2024-06-08 00:33:45 +02:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
export default class MockContainer implements MockGameObject {
|
2024-06-08 00:33:45 +02:00
|
|
|
protected x;
|
|
|
|
protected y;
|
|
|
|
protected scene;
|
|
|
|
protected width;
|
|
|
|
protected height;
|
|
|
|
protected visible;
|
|
|
|
private alpha;
|
|
|
|
private style;
|
|
|
|
public frame;
|
|
|
|
protected textureManager;
|
2024-08-07 09:23:12 -07:00
|
|
|
public list: MockGameObject[] = [];
|
2024-09-13 22:05:58 -04:00
|
|
|
public name: string;
|
2024-06-08 00:33:45 +02:00
|
|
|
|
|
|
|
constructor(textureManager: MockTextureManager, x, y) {
|
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
|
|
|
this.frame = {};
|
|
|
|
this.textureManager = textureManager;
|
|
|
|
}
|
|
|
|
setVisible(visible) {
|
|
|
|
this.visible = visible;
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
once(_event, _callback, _source) {}
|
2024-06-08 00:33:45 +02:00
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
off(_event, _callback, _source) {}
|
2024-06-08 00:33:45 +02:00
|
|
|
|
|
|
|
removeFromDisplayList() {
|
|
|
|
// same as remove or destroy
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
removeBetween(_startIndex, _endIndex, _destroyChild) {
|
2024-09-13 22:05:58 -04:00
|
|
|
// Removes multiple children across an index range
|
|
|
|
}
|
|
|
|
|
2024-06-08 00:33:45 +02:00
|
|
|
addedToScene() {
|
|
|
|
// This callback is invoked when this Game Object is added to a Scene.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setSize(_width, _height) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the size of this Game Object.
|
|
|
|
}
|
|
|
|
|
|
|
|
setMask() {
|
|
|
|
/// Sets the mask that this Game Object will use to render with.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setPositionRelative(_source, _x, _y) {
|
2024-06-08 00:33:45 +02:00
|
|
|
/// Sets the position of this Game Object to be a relative position from the source Game Object.
|
|
|
|
}
|
|
|
|
|
2024-09-11 13:54:42 -07:00
|
|
|
setInteractive = () => null;
|
2024-09-09 15:07:00 -04:00
|
|
|
|
2024-06-08 00:33:45 +02:00
|
|
|
setOrigin(x, y) {
|
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
setAlpha(alpha) {
|
|
|
|
this.alpha = alpha;
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setFrame(_frame, _updateSize?: boolean, _updateOrigin?: boolean) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the frame this Game Object will use to render with.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setScale(_scale) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the scale of this Game Object.
|
|
|
|
}
|
|
|
|
|
|
|
|
setPosition(x, y) {
|
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
setX(x) {
|
|
|
|
this.x = x;
|
|
|
|
}
|
|
|
|
|
|
|
|
setY(y) {
|
|
|
|
this.y = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
destroy() {
|
|
|
|
this.list = [];
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setShadow(_shadowXpos, _shadowYpos, _shadowColor) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the shadow settings for this Game Object.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setLineSpacing(_lineSpacing) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the line spacing value of this Game Object.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setText(_text) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the text this Game Object will display.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setAngle(_angle) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the angle of this Game Object.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setShadowOffset(_offsetX, _offsetY) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the shadow offset values.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setWordWrapWidth(_width) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the width (in pixels) to use for wrapping lines.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setFontSize(_fontSize) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the font size of this Game Object.
|
|
|
|
}
|
|
|
|
getBounds() {
|
|
|
|
return { width: this.width, height: this.height };
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setColor(_color) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the tint of this Game Object.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setShadowColor(_color) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the shadow color.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setTint(_color) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the tint of this Game Object.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setStrokeStyle(_thickness, _color) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the stroke style for the graphics.
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setDepth(_depth) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the depth of this Game Object.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
setTexture(_texture) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Sets the texture this Game Object will use to render with.
|
|
|
|
}
|
|
|
|
|
|
|
|
clearTint() {
|
|
|
|
// Clears any previously set tint.
|
|
|
|
}
|
|
|
|
|
|
|
|
sendToBack() {
|
|
|
|
// Sends this Game Object to the back of its parent's display list.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
moveTo(_obj) {
|
2024-09-13 22:05:58 -04:00
|
|
|
// Moves this Game Object to the given index in the list.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
moveAbove(_obj) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Moves this Game Object to be above the given Game Object in the display list.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
moveBelow(_obj) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Moves this Game Object to be below the given Game Object in the display list.
|
|
|
|
}
|
|
|
|
|
2024-09-13 22:05:58 -04:00
|
|
|
setName(name: string) {
|
2024-08-18 18:18:43 -07:00
|
|
|
this.name = name;
|
2024-09-13 22:05:58 -04:00
|
|
|
}
|
2024-06-08 00:33:45 +02:00
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
bringToTop(_obj) {
|
2024-06-08 00:33:45 +02:00
|
|
|
// Brings this Game Object to the top of its parents display list.
|
|
|
|
}
|
|
|
|
|
2025-03-09 16:13:25 -05:00
|
|
|
on(_event, _callback, _source) {}
|
2024-06-08 00:33:45 +02:00
|
|
|
|
|
|
|
add(obj) {
|
|
|
|
// Adds a child to this Game Object.
|
|
|
|
this.list.push(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
removeAll() {
|
|
|
|
// Removes all Game Objects from this Container.
|
|
|
|
this.list = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
addAt(obj, index) {
|
|
|
|
// Adds a Game Object to this Container at the given index.
|
|
|
|
this.list.splice(index, 0, obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
remove(obj) {
|
|
|
|
const index = this.list.indexOf(obj);
|
|
|
|
if (index !== -1) {
|
|
|
|
this.list.splice(index, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
getIndex(obj) {
|
|
|
|
const index = this.list.indexOf(obj);
|
|
|
|
return index || -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
getAt(index) {
|
|
|
|
return this.list[index];
|
|
|
|
}
|
|
|
|
|
|
|
|
getAll() {
|
|
|
|
return this.list;
|
|
|
|
}
|
|
|
|
|
2024-09-13 22:05:58 -04:00
|
|
|
getByName(key: string) {
|
|
|
|
return this.list.find(v => v.name === key) ?? new MockContainer(this.textureManager, 0, 0);
|
|
|
|
}
|
|
|
|
|
2024-09-11 13:54:42 -07:00
|
|
|
disableInteractive = () => null;
|
2024-06-08 00:33:45 +02:00
|
|
|
}
|