My UserJoined function is not being called when a user joins the room. My only hint is that I'm getting an error in it's declaration when I write "override". It says there is no suitable method to override, so I take it that it is somehow not correlating my UserJoined function to the function that it calls when a user joins. I hope that makes sense. Here's my code:
- Code: Select all
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using PlayerIO.GameLibrary;
using System.Drawing;
namespace FridgeMagnets
{
public class Player : BasePlayer
{
public int x;
public int y;
}
public class Room
{
public int roomWidth;
public int roomHeight;
}
public class Utils
{
public static int getRandomNumberFrom(int maxValue)
{
Random random = new Random();
return random.Next(0, maxValue);
}
}
[RoomType("ConnectTest")]
public class GameCode :Game<BasePlayer>{
private Room room = new Room();
private Player[] playerArray = new Player[45];
private int numPlayers = 0;
public override void GameStarted()
{
Console.WriteLine("GAME STARTED");
}
public override void GotMessage(BasePlayer player, Message message)
{
Console.WriteLine("GOT MESSAGE");
}
//THE PROBLEM METHOD - IT ISN'T CALLED
public override void UserJoined(Player player)
{
sendInitInfo(player);
addNewPlayer(player);
Console.WriteLine("USER JOINED");
//set player location
}
To reiterate, my UserJoined is not being called when users join. Any ideas why?