private void BlockReceived(IBlockEvent obj) { if (obj.BlockEventId == BlockEventId.ClientInfo)//when we receive this we must send the player database with the current player in it and the info for the map to be loaded { var createPlayerEvent = new CreatePlayerEvent(); createPlayerEvent.PlayerId = 1; createPlayerEvent.PlayerIndex = 0; createPlayerEvent.PlayerName = "LifeCoder"; createPlayerEvent.IsAI = false; createPlayerEvent.PlayerTeam = 2; createPlayerEvent.SpawnGroup = 0; SendEvent(createPlayerEvent); new MapInfoEvent(true).Transmit(this); Send(); //now we wait until the client finished loading the map //top id is 6, which is NetworkEvent, bottom id is 2 which is loadLevelComplete in NetworkEvent RemoteEventManager.AddEventHandler(6, 2, OnClientLoadComplete); } else if (obj.BlockEventId == BlockEventId.ServerInfo) { Config.ServerInfo = obj; } else if (obj.BlockEventId == BlockEventId.MapList) { } else { } }
public void QueueBlockEvent(IBlockEvent blockEvent) { lock (SendBlockQueue) SendBlockQueue.Enqueue(blockEvent); }