Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Có thể có lỗi nếu như hàm @Server sử dụng super.[@Server] khác #15

Open
khoakomlem opened this issue Jun 10, 2024 — with Linear · 1 comment
Open
Assignees
Labels
bug Something isn't working Public

Comments

Copy link
Member

khoakomlem commented Jun 10, 2024

solution: thêm id cho method (có thể xài current class name, example

class Mob extends Schema {
  @Server({skipSync: true})
  onCollisionEnter() {
    // bla bla
  }
}
// -> method id sẽ là "Mob"

class Spider extends Mob {
  @Server()
  onCollisionEnter() {
    // bla bla
  }
}

// -> method id sẽ là "Backpack"

method ID: để tìm method (phân biệt parent + child method)

schema ID: để tìm holder (context)

-> getMethodById giờ sẽ trả new Map thay vì Method như trước

problems arise:

  • Do bị phụ thuộc vào class name nên nếu class cha trùng tên class con thì sẽ bị override -> phải báo lỗi khi có 2 class extending nhau bị trùng tên

Note:

  • viết afterPatch: override broadcastPatch của Room colyseus:
class A extends Room {
  broadcastPatch(){
    super.broadcastPatch();
    this.
  }
}
@khoakomlem khoakomlem added bug Something isn't working Public labels Jun 10, 2024 — with Linear
@khoakomlem khoakomlem self-assigned this Jun 10, 2024
@khoakomlem khoakomlem changed the title Có thể có lỗi nếu như hàm @Server sử dụng super.[@Server] khác (copy) Có thể có lỗi nếu như hàm @Server sử dụng super.[@Server] khác Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Public
Projects
None yet
Development

No branches or pull requests

1 participant