pokerogue/test/testUtils/mocks/mocksContainer/mockGraphics.ts
Sirz Benjie d5789105f3
[Refactor][UI/UX] Cleanup battle-info ui code (#5696)
* Create battle-info directory and move battle-info.ts to it

* Move player and enemy battle info to their own files

* Move subclass specific parts of constructor to subclass constructor

* Fixup mock gameobject methods to match phaser gameobject returns

* Make statOrder specific to subclass

* Create getShinyDescriptor function in utils

* Move icon construction to its own function

* Cleanup enemybattleinfo constructor to use chaining

* Make flyout exclusive to EnemyBattleInfo

* Move EnemyPokemon specific init Logic to its class

* Break up initInfo into different methods

* Remove hp bar segment dividers from base battle info

* Move setMini to pokemoninfo

* Breakup updateInfo into smaller parts

* Remove hp info handling from base updateInfo

* Use phaser object chaining methods

* Add some docs

* Add missing chain usage

* Use getShinyDescriptor in pokemon-info-container

* Minor cleanup of updatePokemonExp

* Fixup setSizeToFrame mock

* Ensure pokemon hp numbers are not visible during stat display

* Update src/utils/common.ts

Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>

* Make summary-ui-handler use new shinyDescriptor method

* Remove `undefined` parameter pass

Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com>

* Address kev's review comments

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Ensure hp number display fades in/out

* Ensure ribbon and caught indicator fade with stat display

* Update src/ui/battle-info/battle-info.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Move construction of stats and type icons to their own methods

* Make setPositionRelative return this

* Improve doc comment on paddingX param

* Fix mock sprite's setPositionRelative

---------

Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>
Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-05-28 17:29:03 +00:00

117 lines
2.2 KiB
TypeScript

import type { MockGameObject } from "../mockGameObject";
export default class MockGraphics implements MockGameObject {
private scene;
public list: MockGameObject[] = [];
public name: string;
constructor(textureManager, _config) {
this.scene = textureManager.scene;
}
fillStyle(_color): this {
// Sets the fill style to be used by the fill methods.
return this;
}
beginPath(): this {
// Starts a new path by emptying the list of sub-paths. Call this method when you want to create a new path.
return this;
}
fillRect(_x, _y, _width, _height): this {
// Adds a rectangle shape to the path which is filled when you call fill().
return this;
}
createGeometryMask(): this {
// Creates a geometry mask.
return this;
}
setOrigin(_x, _y): this {
return this;
}
setAlpha(_alpha): this {
return this;
}
setVisible(_visible): this {
return this;
}
setName(_name) {
return this;
}
once(_event, _callback, _source) {
return this;
}
removeFromDisplayList(): this {
// same as remove or destroy
return this;
}
addedToScene() {
// This callback is invoked when this Game Object is added to a Scene.
}
setPositionRelative(_source, _x, _y): this {
/// Sets the position of this Game Object to be a relative position from the source Game Object.
return this;
}
destroy() {
this.list = [];
}
setScale(_scale): this {
return this;
}
off(_event, _callback, _source): this {
return this;
}
add(obj): this {
// Adds a child to this Game Object.
this.list.push(obj);
return this;
}
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;
}
copyPosition(_source): this {
return this;
}
}