//-----------------------------------------------------------------------OnRoomJoin private void OnRoomJoin(BaseEvent evt) { // Remove SFS2X listeners and re-enable interface before moving to the main game scene MMORoom room = (MMORoom)evt.Params["room"]; if (room.Name == "city") { int AdminIndex = username.IndexOf("n"); string admin = username.Substring(0, AdminIndex + 1); NetworkManager.Instance.StartWorking(); if (admin.Equals("Admin")) { AdminView.gameObject.SetActive(true); } else { MemberView.gameObject.SetActive(true); } Login.gameObject.SetActive(false); Debug.Log("Joined city Room"); } }
void Start() { SERVER = new SmartFox(); //Event listener for the connection SERVER.AddEventListener(SFSEvent.CONNECTION, OnConnection); SERVER.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost); //Event listener for the login data SERVER.AddEventListener(SFSEvent.LOGIN, OnLogin); SERVER.AddEventListener(SFSEvent.LOGIN_ERROR, OnLoginError); // SERVER.AddEventListener(SFSEvent.USER_VARIABLES_UPDATE, Variable_Update); //Server details ConfigData config = new ConfigData(); config.Host = IP; config.Port = TCP; config.Zone = "BasicExamples"; config.Debug = true; //Attempt connection SERVER.Connect(config); rooms = SERVER.RoomManager.GetRoomList(); if (rooms.Count == 0) { MMORoom room = new MMORoom(0, "johnnny"); rooms.Add(room); print(room.Name); } }
public BulletController(ContentManager contents) : base(contents) { _bullets = new Dictionary <int, GameObject>(); _room = (MMORoom)_network.GetCurretRoom(); }