當前位置: 首頁>>代碼示例>>Java>>正文


Java Client.start方法代碼示例

本文整理匯總了Java中com.esotericsoftware.kryonet.Client.start方法的典型用法代碼示例。如果您正苦於以下問題:Java Client.start方法的具體用法?Java Client.start怎麽用?Java Client.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.esotericsoftware.kryonet.Client的用法示例。


在下文中一共展示了Client.start方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: EV3Brick

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
/**
 * Creates a Brick Class.
 *
 * @param ev3Brick_IP
 * @param ev3Brick_PORT
    */
public EV3Brick (final String ev3Brick_IP, int ev3Brick_PORT) {
       this.EV3Brick_IP = ev3Brick_IP;
       this.EV3Brick_PORT = ev3Brick_PORT;
       
       motorManager 	= new EV3MotorManager(this); //TODO
       sensorManager 	= new EV3SensorManager(this);

	System.out.println("Local-EV3Brick: Starte client.. ");
	client = new Client();
	client.start();
	new Thread(client).start(); //Neccessary to keep connection alive!

	/** Add Listeners to Client **/
	client.addListener(this);
	client.addListener(sensorManager);
	client.addListener(motorManager);

	//Set Client to Motor-/Sensormanager
	sensorManager.setBrickClient(client);
	motorManager.setBrickClient(client);

	MessageRegistrar.register(client);


   }
 
開發者ID:Echtzeitsysteme,項目名稱:mindroid,代碼行數:32,代碼來源:EV3Brick.java

示例2: ClientNetworkController

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
public ClientNetworkController() {
	while (true) {
		promptIPPort();
		client = new Client();
		client.start();
		try {
			client.connect(5000, Variables.serverIP, Variables.port);
		}
		catch (IOException e) {
			Utilities.popupMessage("BuildStation", "Invalid Input\nThe server refused the connection or an unknown error occurred.");
			e.printStackTrace();
			promptIPPort();
			continue;
		}
		client.getKryo().setRegistrationRequired(false);
		ListenerList.addListeners(client);
		break;
	}
}
 
開發者ID:Ameliorate,項目名稱:Buildstation-3,代碼行數:20,代碼來源:ClientNetworkController.java

示例3: show

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
@Override
public void show() {
    client = new Client();
    client.start();
    font = game.getFont(120);
    batch = new SpriteBatch();
    camera = new OrthographicCamera();
    viewport = new FitViewport(1280, 720, camera);
    camera.setToOrtho(false, 1280, 720);
    buttons = new ArrayList<MyButton>();
    ipAddresses = new ArrayList<MyButton>();
    markForDispose = false;
    addAllButtons();
    addIpButtons();
    pressedButton = false;
}
 
開發者ID:ganeshkamathp,項目名稱:killingspree,代碼行數:17,代碼來源:ClientDiscoveryScreen.java

示例4: loadLevel

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
public boolean loadLevel(String level, String host, String name) {
    if (isServer) {
        world = new WorldManager(server);
        if (server == null)
            world.loader.platformServices = game.platformServices;
    } else {
        client = new Client();
        NetworkRegisterer.register(client);
        client.start();
        try {
            client.connect(Constants.TIMEOUT, host,
                    Constants.GAME_TCP_PORT,
                    Constants.GAME_UDP_PORT);
        } catch (IOException e) {
            game.platformServices.toast("Server not found");
            e.printStackTrace();
            game.setScreen(new ClientDiscoveryScreen(game));
            return false;
        }
    }
    
    renderer = new WorldRenderer(world, client, game);
    renderer.loadLevel(level, isServer, name);
    return true;
}
 
開發者ID:ganeshkamathp,項目名稱:killingspree,代碼行數:26,代碼來源:GameScreen.java

示例5: launchClient

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
@Override
public synchronized boolean launchClient()
{	boolean result = true;

	client = new Client(60000, 60000);
	client.start();

	firstRound = true;

	ClassRegisterer.register(client);

	client.addListener(this);

	int timeout = 5000;
	try
	{	client.connect(timeout, ip, port, port + 1);
	}
	catch (IOException e)
	{	result = false;
		e.printStackTrace();
	}

	return result;
}
 
開發者ID:CeriAvignon,項目名稱:Projet2015,代碼行數:25,代碼來源:ClientCommunicationKryonetImpl.java

示例6: PeaceNetworkClient

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
public PeaceNetworkClient()
{
	client = new Client();
	
	events = (Queue<PacketMessage>) new LinkedList<PacketMessage>();
	
	// Must register every class that will be sent/received
	client.getKryo().register(PacketMessage.class);
	client.getKryo().register(EventType.class);
	client.getKryo().register(LocationID.class);
	
	// Client must start before connecting can take place
	client.start();
	
	client.addListener(this);
	
	out.println("Client is now waiting..."); // TODO: remove
}
 
開發者ID:SheldonSandbekkhaug,項目名稱:Peace,代碼行數:19,代碼來源:PeaceNetworkClient.java

示例7: NetClient

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
public NetClient(InvadersGame game, GameSetupConfig gameSetupConfig, PlayerConfig player) {
    this.game = game;
    gameConfig = gameSetupConfig;
    this.playerConfig = player;
    listeners = new Array<NetListener>();

    client = new Client();
    client.start();

    KryoCommon.register(client);

    currentListener = new ConnectListener(this);
    client.addListener(currentListener);

    connect();
}
 
開發者ID:fbcouch,項目名稱:ahs-invaders,代碼行數:17,代碼來源:NetClient.java

示例8: FSUIPCKryonetInterface

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
public FSUIPCKryonetInterface(String server, int port) {
    this.server = server;
    this.port = port;
    // ~
    client = new Client();
    client.start();
    client.addListener(new Listener() {
        public void received (Connection connection, Object object) {
            if(object instanceof String) {
                String message = (String)object;
                if(message.startsWith("CHANGED")) {
                    Collection<OffsetItem> offsetItems = toOffsetItems(message);
                    for(OffsetItem offsetItem : offsetItems) {
                        offsetEventListeners.fire().valueChanged(offsetItem);
                    }
                    offsetCollectionEventListeners.fire().valuesChanged(offsetItems);
                }
            }
        }
    });
    // ~
    offsetEventListeners = EventListenerSupport.create(OffsetEventListener.class);
    offsetCollectionEventListeners = EventListenerSupport.create(OffsetCollectionEventListener.class);
}
 
開發者ID:RBernhardt,項目名稱:homecockpit-fsuipc,代碼行數:25,代碼來源:FSUIPCKryonetInterface.java

示例9: PlayerClient

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
public PlayerClient() {
	super();
	_players = new HashMap<Integer, Player>();
	_cars = new HashMap<Byte, Byte>();
	_player = new Player();
	_listenerList = new PlayerClientListenerList();
	_connected = false;
	
	_client = new Client();
	_client.start();
	PlayerServerClient serverClient = new PlayerServerClient(_client);
	PlayerNetwork.register(_client);
	_client.addListener(serverClient);
	_client.addListener(this);
	setPlayerServer(serverClient);
}
 
開發者ID:lumannnn,項目名稱:AudioRacer,代碼行數:17,代碼來源:PlayerClient.java

示例10: ClientEndpointImpl

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
public ClientEndpointImpl(String ip,int tcpPort, int brickTimeout) {
	this.ip =ip;
	this.tcpPort = tcpPort;
	this.brickTimeout = brickTimeout;

	client = new Client();
	client.start();
	new Thread(client).start();
}
 
開發者ID:Echtzeitsysteme,項目名稱:mindroid,代碼行數:10,代碼來源:ClientEndpointImpl.java

示例11: ConnectionState

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
public ConnectionState(Client client, StateManager states, ConnectionInfo connectionInfo)
{
	this.client = client;
	this.states = states;
	client.start();
	connectThread = new Thread(() -> tryConnecting(client, connectionInfo));
	connectThread.start();
}
 
開發者ID:MMORPG-Prototype,項目名稱:MMORPG_Prototype,代碼行數:9,代碼來源:ConnectionState.java

示例12: get

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
@Override
public Client get() {
    Client client = new Client();
    clientKryoListener.setClient(client);
    client.start();
    ChatUtil.registerClasses(client);
    client.addListener(clientKryoListener);
    return client;
}
 
開發者ID:aalmiray,項目名稱:javatrove,代碼行數:10,代碼來源:ClientProvider.java

示例13: initialize

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
public void initialize() {
	username = JOptionPane.showInputDialog("Please enter a username.");
	client = new Client(25566, 25567);
	register();
	ClientListener listener = new ClientListener(this);
	client.addListener(listener);
	client.start();
}
 
開發者ID:CameronPersonett,項目名稱:NetworkChatApplication,代碼行數:9,代碼來源:ChatClient.java

示例14: HeadlessClientNetworkController

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
/**
 * @throws IOException If the server refused the connection.
 */
public HeadlessClientNetworkController() throws IOException {
	client = new Client();
	client.start();
	client.connect(5000, Variables.serverIP, Variables.port);
	client.getKryo().setRegistrationRequired(false);
	ListenerList.addListeners(client);
	isHeadless = true;	// I wish I could avoid this, but for some reason, I can't override promptIPPort.
}
 
開發者ID:Ameliorate,項目名稱:Buildstation-3,代碼行數:12,代碼來源:HeadlessClientNetworkController.java

示例15: setServer

import com.esotericsoftware.kryonet.Client; //導入方法依賴的package包/類
public void setServer(boolean isServer) {
        this.isServer = isServer;
        try {
            if (isServer) {
                server = new Server();
                NetworkRegisterer.register(server);
                serverListener = new LobbyServerListener();
                server.addListener(serverListener);
                server.start();
                server.bind(Constants.DISCOVERY_TCP_PORT,
                            Constants.DISCOVERY_UDP_PORT);
//                Thread.currentThread().sleep(200);
            }
            
            client = new Client();
            NetworkRegisterer.register(client);
            client.start();
            clientListener = new LobbyClientListener();
            client.addListener(clientListener);
            client.connect(5000, host, 
                    Constants.DISCOVERY_TCP_PORT,
                    Constants.DISCOVERY_UDP_PORT);
        } catch (Exception e) {
            currentButton = backButton;
            markForDispose = true;
            e.printStackTrace();
        }
        addAllButtons();
    }
 
開發者ID:ganeshkamathp,項目名稱:killingspree,代碼行數:30,代碼來源:LobbyScreen.java


注:本文中的com.esotericsoftware.kryonet.Client.start方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。