PuppetModelComp.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
  2. import { VM } from "../../../../../extensions/oops-plugin-framework/assets/libs/model-view/ViewModel";
  3. @ecs.register('PuppetModel')
  4. export class PuppetModelComp extends ecs.Comp {
  5. private vm: any = {};
  6. private _color: string = null
  7. private _withColider: boolean = true
  8. /** 颜色 */
  9. get color(): string {
  10. return this._color;
  11. }
  12. set color(value: string) {
  13. this._color = value;
  14. }
  15. private _x: number
  16. private _y: number
  17. get x(): number {
  18. return this._x
  19. }
  20. set x(value: number) {
  21. this._x = value
  22. }
  23. get y(): number {
  24. return this._y
  25. }
  26. set y(value: number) {
  27. this._y = value
  28. }
  29. set withColider(value: boolean) {
  30. this._withColider = value
  31. }
  32. get withColider() {
  33. return this._withColider
  34. }
  35. // vmAdd() {
  36. // VM.add(this.vm, "Grid");
  37. // }
  38. // vmRemove() {
  39. // this.vm.reset();
  40. // VM.remove("Grid");
  41. // }
  42. reset() {
  43. this.color = null
  44. this.x = null
  45. this.y = null
  46. // this.vmRemove();
  47. }
  48. }