// Connect to DF, fetch initial data, start things running void ConnectAndInit() { blockRequest = new RemoteFortressReader.BlockRequest(); blockRequest.blocks_needed = BlocksToFetch; pendingBlocks = new Util.UniqueQueue <DFCoord, RemoteFortressReader.MapBlock>(); networkClient = new DFHack.RemoteClient(dfNetworkOut); bool success = networkClient.connect(); if (!success) { networkClient.disconnect(); networkClient = null; throw new UnityException("DF Connection Failure"); } BindMethods(); FetchUnchangingInfo(); networkClient.suspend_game(); viewInfoCall.execute(null, out _netViewInfo); unitListCall.execute(null, out _netUnitList); worldMapCall.execute(null, out _netWorldMap); regionMapCall.execute(null, out _netRegionMaps); networkClient.resume_game(); mapResetCall.execute(); InitStatics(); foreach (System.Action callback in connectionCallbacks) { callback.Invoke(); } connectionCallbacks.Clear(); connectionMode = ConnectionMode.GetConnectionMode(this, RunOnAlternateThread); }
public ConnectionState() { network_client = new DFHack.RemoteClient(df_network_out); is_connected = network_client.connect(); if (!is_connected) { return; } net_block_request = new RemoteFortressReader.BlockRequest(); MaterialListCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.MaterialList>(); MaterialListCall.bind(network_client, "GetMaterialList", "RemoteFortressReader"); TiletypeListCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.TiletypeList>(); TiletypeListCall.bind(network_client, "GetTiletypeList", "RemoteFortressReader"); BlockListCall = new RemoteFunction <RemoteFortressReader.BlockRequest, RemoteFortressReader.BlockList>(); BlockListCall.bind(network_client, "GetBlockList", "RemoteFortressReader"); HashCheckCall = new RemoteFunction <dfproto.EmptyMessage>(); HashCheckCall.bind(network_client, "CheckHashes", "RemoteFortressReader"); UnitListCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.UnitList>(); UnitListCall.bind(network_client, "GetUnitList", "RemoteFortressReader"); ViewInfoCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.ViewInfo>(); ViewInfoCall.bind(network_client, "GetViewInfo", "RemoteFortressReader"); MapInfoCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.MapInfo>(); MapInfoCall.bind(network_client, "GetMapInfo", "RemoteFortressReader"); MapResetCall = new RemoteFunction <dfproto.EmptyMessage>(); MapResetCall.bind(network_client, "ResetMapHashes", "RemoteFortressReader"); }
public ConnectionState() { network_client = new DFHack.RemoteClient(df_network_out); is_connected = network_client.connect(); if (!is_connected) return; net_block_request = new RemoteFortressReader.BlockRequest(); MaterialListCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.MaterialList>(); MaterialListCall.bind(network_client, "GetMaterialList", "RemoteFortressReader"); TiletypeListCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.TiletypeList>(); TiletypeListCall.bind(network_client, "GetTiletypeList", "RemoteFortressReader"); BlockListCall = new RemoteFunction<RemoteFortressReader.BlockRequest, RemoteFortressReader.BlockList>(); BlockListCall.bind(network_client, "GetBlockList", "RemoteFortressReader"); HashCheckCall = new RemoteFunction<dfproto.EmptyMessage>(); HashCheckCall.bind(network_client, "CheckHashes", "RemoteFortressReader"); UnitListCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.UnitList>(); UnitListCall.bind(network_client, "GetUnitList", "RemoteFortressReader"); ViewInfoCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.ViewInfo>(); ViewInfoCall.bind(network_client, "GetViewInfo", "RemoteFortressReader"); MapInfoCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.MapInfo>(); MapInfoCall.bind(network_client, "GetMapInfo", "RemoteFortressReader"); MapResetCall = new RemoteFunction<dfproto.EmptyMessage>(); MapResetCall.bind(network_client, "ResetMapHashes", "RemoteFortressReader"); }
// Connect to DF, fetch initial data, start things running void ConnectAndInit() { blockRequest = new RemoteFortressReader.BlockRequest(); blockRequest.blocks_needed = BlocksToFetch; pendingBlocks = new Util.UniqueQueue<DFCoord, RemoteFortressReader.MapBlock>(); networkClient = new DFHack.RemoteClient(dfNetworkOut); bool success = networkClient.connect(); if (!success) { networkClient.disconnect(); networkClient = null; throw new UnityException("DF Connection Failure"); } BindMethods(); FetchUnchangingInfo(); networkClient.suspend_game(); viewInfoCall.execute(null, out _netViewInfo); unitListCall.execute(null, out _netUnitList); worldMapCall.execute(null, out _netWorldMap); regionMapCall.execute(null, out _netRegionMaps); networkClient.resume_game(); mapResetCall.execute(); InitStatics(); foreach (System.Action callback in connectionCallbacks) { callback.Invoke(); } connectionCallbacks.Clear(); connectionMode = ConnectionMode.GetConnectionMode(this, RunOnAlternateThread); }