Forum C# Common room code

Common room code

Postby azuanagames » May 23rd, 2020, 4:05 pm


I have a simple question... I would like to be able to have a common base class for my rooms, since there are many operations that are similar. However, if I attempt to add a class between my Game and my Room, PlayerIO complains.

Here is what I'm trying to do (Player is a BasePlayer):
Code: Select all
public class Room<P> : Game<P> where P : Player, new() {
    protected void Kick(Player player, string reason) {

        // Give the client a half second to disconnect, if they don't then force it
        ScheduleCallback(() => {
            if (player.CurrentState != Player.State.Left) {
        }, 500);

In my game room I would do:
Code: Select all
    public class GameRoom : Room<Player> {

As you can see the issue I have is that I need access to ScheduleCallback. I can write common routines in another class and use them that way but I would not have access to the Game functions, including things like BigDB.

Here is what PlayerIO says:
Code: Select all
Trying last loaded dll
- error: The Game class 'AzuanaGames.Room`1' does not have a [RoomType(...)] attribute, and is not an abstract base class.

Is there another solution I'm not considering?
Posts: 153
Joined: April 29th, 2010, 10:59 pm

Re: Common room code

Postby deetmo » May 25th, 2020, 1:45 pm

Actually... NO.

It was already asked for in my previous post:
Posts: 3
Joined: May 5th, 2019, 10:30 pm

Return to C#