sebako
01-17-2011, 04:24 AM
Hey,
i am trying to join a room, which is fine and working (at least in es admin the user is shown in the room). The Room is a persistant room called "main" in the zone "main".
But for some reason the callback method OnJoinRoomEvent isn't called and i cannot see a reason why. Some code ....
using UnityEngine;
using System.Collections;
using Electrotank.Electroserver5.Api;
using Electrotank.Electroserver5.Core;
public class gameIndex : MonoBehaviour {
// server reference
private ElectroServer _es;
// main room
Room mainR;
void Start()
{
// this es object is stored inside a unity empty game object
_es = GameObject.Find("connection").GetComponent<connection>().es;
_es.Engine.PluginMessageEvent += OnPluginMessageEvent;
_es.Engine.JoinRoomEvent += OnJoinRoomEvent;
// load lobby
loadLobby();
// request game list from server
loadGameList();
}
// this is called
void loadLobby() {
// join lobby main room - room is persistant
JoinRoomRequest jrr = new JoinRoomRequest();
jrr.ZoneName = "main";
jrr.RoomName = "main";
_es.Engine.Send(jrr);
}
// this isn't called for some reason
void OnJoinRoomEvent(JoinRoomEvent e)
{
mainR = _es.ManagerHelper.ZoneManager.ZoneById(e.ZoneId).R oomById(e.RoomId);
Debug.Log("main room joined");
}
void loadGameList()
{
PluginRequest pr = new PluginRequest();
pr.Parameters = new EsObject();
pr.Parameters.setString("action", "gameList");
pr.PluginName = "GameIndex";
pr.RoomId = mainR.Id;
pr.ZoneId = mainR.ZoneId;
_es.Engine.Send(pr);
}
// this isn't called for some reason
void OnPluginMessageEvent(PluginMessageEvent e)
{
Debug.Log("plugin message received");
Debug.Log(e.Parameters.getString("response"));
}
i have no idea why the callback methods aren't called at any single time, i have no clue what might cause this.
I have stored the es connection instance in a empty unity game object and load it inside the start method, this should work, right?
i am trying to join a room, which is fine and working (at least in es admin the user is shown in the room). The Room is a persistant room called "main" in the zone "main".
But for some reason the callback method OnJoinRoomEvent isn't called and i cannot see a reason why. Some code ....
using UnityEngine;
using System.Collections;
using Electrotank.Electroserver5.Api;
using Electrotank.Electroserver5.Core;
public class gameIndex : MonoBehaviour {
// server reference
private ElectroServer _es;
// main room
Room mainR;
void Start()
{
// this es object is stored inside a unity empty game object
_es = GameObject.Find("connection").GetComponent<connection>().es;
_es.Engine.PluginMessageEvent += OnPluginMessageEvent;
_es.Engine.JoinRoomEvent += OnJoinRoomEvent;
// load lobby
loadLobby();
// request game list from server
loadGameList();
}
// this is called
void loadLobby() {
// join lobby main room - room is persistant
JoinRoomRequest jrr = new JoinRoomRequest();
jrr.ZoneName = "main";
jrr.RoomName = "main";
_es.Engine.Send(jrr);
}
// this isn't called for some reason
void OnJoinRoomEvent(JoinRoomEvent e)
{
mainR = _es.ManagerHelper.ZoneManager.ZoneById(e.ZoneId).R oomById(e.RoomId);
Debug.Log("main room joined");
}
void loadGameList()
{
PluginRequest pr = new PluginRequest();
pr.Parameters = new EsObject();
pr.Parameters.setString("action", "gameList");
pr.PluginName = "GameIndex";
pr.RoomId = mainR.Id;
pr.ZoneId = mainR.ZoneId;
_es.Engine.Send(pr);
}
// this isn't called for some reason
void OnPluginMessageEvent(PluginMessageEvent e)
{
Debug.Log("plugin message received");
Debug.Log(e.Parameters.getString("response"));
}
i have no idea why the callback methods aren't called at any single time, i have no clue what might cause this.
I have stored the es connection instance in a empty unity game object and load it inside the start method, this should work, right?