亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? networkclient.java

?? 用java開發(fā)的一個實施策略游戲源碼 值得學(xué)習(xí)一下
?? JAVA
字號:
/*
	Netwar
	Copyright (C) 2002  Daniel Grund, Kyle Kakligian, Jason Komutrattananon, & Brian Hibler.

	This file is part of Netwar.

	Netwar is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	Netwar is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with Netwar; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

package netwar.network;
import netwar.Netwar;
import netwar.game.*;
import netwar.settings.*;
import java.rmi.*;
import java.rmi.server.*;

/**
 * The Client network adapter that sends and recieves commands to and from the Netwar Server.
 * @author Group N2-Project Netwar
 * @author Jason Komutrattananon
 */
public class NetworkClient extends UnicastRemoteObject implements NetworkClientInterface{
	/**
	 * This players number.
	 */
	public int playerNumber;
	private NetworkServerInterface server;
	private boolean gameStarted = false;

	/**
	 * Creates a new instance of NetworkClient
	 * @param ipAddress is the ipAddress of the Server
	 */
	public NetworkClient(String ipAddress) throws RemoteException{
		try {
			server = (NetworkServerInterface) Naming.lookup ("//" + ipAddress + "/NetwarServer");
			playerNumber = server.callerID(this);
		} catch (Exception e) {
			System.out.println("NetworkClient Exception: " + e);
		}
	}

	/**
	 * Sends the pending local command to the server
	 * RMI type: Client
	 */
	public void send(){
		try {            
			// change index of array in following line when player info is made
			server.setCommand(playerNumber, (Command) Command.pendingCommands.dequeue());
		} catch(Exception e) {
			System.out.println ("Network Client Exception: " + e + "Couldn't send pendingCommand");
		}
	}

	/**
	 * The Netwar server will send the complete set of commands once it recieves them from every single player using this method
	 * RMI type: Server
	 * @param completeSetOfCommands the server sends this Command array which should be the complete set of commands for 1 cycle
	 */
	public void setCompleteSetOfCommands(Command[] completeSetOfCommands) throws RemoteException {
		Command.currentCommands=completeSetOfCommands;
		Command.commandsUpToDate=true;
	}

	/**
	 * Signals the local machine that the server wants to start the game.
	 * RMI type: Server
	 */
	public void startGame() throws RemoteException {
		gameStarted=true;
		Netwar.netwar.startGame();
	}

	/**
	 * Local method used to broadcast settings to all other players through the netwar server
	 * RMI type: Client
	 * @param callingPlayer is the playernumber that is calling this method
	 * @param playerSettings is the player's settings
	 * @param globalSettings is the settings made by player 1
	 */
	public void clientBroadcastSettings(int callingPlayer, PlayerSettings playerSettings, GlobalSettings globalSettings){
		try {
			server.broadcastSettings(callingPlayer, playerSettings, globalSettings);
		} catch (Exception e) {
			System.out.println("Remote Exception while trying to Broadcast settings from client to server: " + e);
		}
	}

	/**
	 * Remote method used to recieve settings and set them locally
	 * RMI type: Server
	 * @param gameSettings is the game settings that need to be propogated to all the players
	 */
	public void clientRecieveSettings(GameSettings gameSettings) throws RemoteException{
		GameSettings.currentSettings = gameSettings;
		Netwar.netwar.getDataViewer().repaint();
	}
	/**
	 * Invokes method on server to send the chat message to its intended recipient(s).
	 * RMI type: Client
	 * @param chatMessage The message to be sent out
	 * @param toWhom to which players the message gets sent to. if bool[1] and bool[5] are true then the message would get sent to players 1 and 5. bool[0]=true would broadcast to all players.
	 */
	public void sendChat(String chatMessage, boolean[] toWhom){
//		The following line is crashing the program		
//		netwar.Netwar.soundPlayer.play("sound/ChatSend.wav");
		try{
			server.sendChat(chatMessage, toWhom, playerNumber);
		}catch (Exception e) {
			System.out.println ("Exception while trying to send chat message: " + e );
		}
	}
	
	/**
	 * Invokes the method that displays the chat message to the player's screen
	 * RMI type: Server
	 * @param chatMessage The message to be displayed to the players screen.
	 */
	public void displayChat(String chatMessage) throws RemoteException{
//		The follwing line is crashing the program		
//		netwar.Netwar.soundPlayer.play("sound/ChatRecieve.wav");
            netwar.gui.Chatable view = (netwar.gui.Chatable)netwar.Netwar.netwar.getDataViewer();
            view.displayChat(chatMessage);
	}
	
	public boolean dropMeFromGame(){
	    try{
	    return server.dropMeFromGame(playerNumber);
	    } catch (Exception e) {
		System.out.println("Exception while trying to drop from game client side");
	    }
	    return false;
	}
	
	/**
	 * Sets the player's number. This method is primarily used for when a player is dropping out of the game before the game is started.
	 * RMI type: Server
	 * @param newPlayerNumber the new number that will be assigned to this player.
	 */
	public void setPlayerNumber(int newPlayerNumber) throws RemoteException{
		playerNumber=newPlayerNumber;
	}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
另类小说视频一区二区| 欧美午夜精品一区二区蜜桃| 91老司机福利 在线| 91麻豆精品国产| 久久久电影一区二区三区| 亚洲午夜成aⅴ人片| 国产在线精品视频| 欧美日韩精品一区二区三区蜜桃 | 日本高清免费不卡视频| 777a∨成人精品桃花网| 国产精品全国免费观看高清| 无吗不卡中文字幕| 成+人+亚洲+综合天堂| 日韩精品专区在线影院重磅| 一区二区国产视频| 丰满白嫩尤物一区二区| 欧美精品久久99久久在免费线| 成人欧美一区二区三区黑人麻豆 | 亚洲私人黄色宅男| 国产专区欧美精品| 91精选在线观看| 一区二区三区精品在线观看| 成人高清视频在线观看| 久久亚洲欧美国产精品乐播| 日韩在线一区二区| 欧美色综合网站| 怡红院av一区二区三区| 99久久99久久免费精品蜜臀| 国产日韩精品视频一区| 免费在线观看一区| 51精品国自产在线| 天堂在线一区二区| 欧美日韩精品三区| 亚洲国产日韩综合久久精品| 99精品在线观看视频| 欧美国产精品一区| 成人激情视频网站| 国产精品卡一卡二卡三| 福利一区二区在线| 中文av一区特黄| 成人一区二区三区| 国产精品天美传媒| 成人av电影在线播放| 中文字幕一区二区日韩精品绯色| 成人一区二区三区中文字幕| 欧美激情一区二区| 成人高清在线视频| 亚洲精品国久久99热| 色噜噜狠狠色综合中国| 亚洲成a人v欧美综合天堂| 91麻豆精品国产91久久久更新时间 | 欧美精品第一页| 视频一区视频二区在线观看| 日韩欧美中文字幕公布| 激情综合网激情| 日本一二三不卡| 色噜噜久久综合| 日韩一区精品字幕| 精品久久久久久久人人人人传媒| 韩国在线一区二区| 日韩一区中文字幕| 欧美日韩黄色影视| 国内精品视频666| 自拍av一区二区三区| 欧美三级电影在线观看| 久久国产精品72免费观看| 国产欧美精品区一区二区三区 | 欧美精品久久久久久久多人混战 | 日韩一区二区三区视频在线| 久久er99热精品一区二区| 国产精品视频免费看| 欧美午夜一区二区三区| 精品一区二区久久久| 亚洲乱码中文字幕综合| 日韩欧美色电影| 99在线热播精品免费| 日韩国产欧美在线视频| 欧美国产国产综合| 91精品国产综合久久精品app| 国产最新精品免费| 亚洲国产精品尤物yw在线观看| 精品奇米国产一区二区三区| 91免费看视频| 国产最新精品精品你懂的| 一区二区在线观看视频| 久久综合九色综合欧美98| 一本一本大道香蕉久在线精品 | 精品国产凹凸成av人网站| 94-欧美-setu| 国产一区二区伦理片| 一区二区国产盗摄色噜噜| 国产日韩av一区二区| 欧美二区三区91| 色综合久久综合中文综合网| 国产成人亚洲综合a∨婷婷 | 91黄色免费版| 国产成人免费在线视频| 青青草国产精品97视觉盛宴| 一区av在线播放| 国产精品久久久久久久久快鸭 | 日韩vs国产vs欧美| 丝袜美腿亚洲一区二区图片| 亚洲免费资源在线播放| 亚洲国产精品精华液2区45| 欧美r级在线观看| 欧美精品自拍偷拍动漫精品| 91美女蜜桃在线| 成人av电影在线观看| 国产成人免费视频| 国产在线不卡一区| 精品一区二区三区在线播放 | 日韩一本二本av| 欧美日韩一区在线| 在线观看中文字幕不卡| 91在线高清观看| 成人av集中营| 波多野结衣亚洲| jlzzjlzz欧美大全| 国产精品亚洲第一| 国产老妇另类xxxxx| 国产在线视视频有精品| 狠狠狠色丁香婷婷综合激情 | 日本一不卡视频| 日韩黄色小视频| 蜜臀精品久久久久久蜜臀| 蜜臀久久99精品久久久久久9| 日韩激情在线观看| 蜜臀久久久99精品久久久久久| 日本成人在线视频网站| 美女在线观看视频一区二区| 日本不卡一二三区黄网| 青青草97国产精品免费观看| 美国三级日本三级久久99| 老司机免费视频一区二区| 国产一区在线精品| 国产盗摄一区二区| 成人黄色在线看| 在线视频观看一区| 欧美人伦禁忌dvd放荡欲情| 欧美一区二区在线不卡| 久久综合九色综合97婷婷| 国产色产综合产在线视频 | 日韩欧美资源站| 26uuu久久天堂性欧美| 欧美国产亚洲另类动漫| 亚洲男人的天堂一区二区| 日韩精品1区2区3区| 国产精品99久久久久久久女警| 成人午夜看片网址| 在线观看一区不卡| 精品久久久久久久久久久久久久久| 久久色成人在线| 日韩毛片精品高清免费| 天天综合色天天综合| 国产乱子轮精品视频| 91色九色蝌蚪| 日韩欧美国产综合一区| 国产欧美精品一区二区色综合朱莉| 亚洲精品免费电影| 久久国产日韩欧美精品| 不卡电影一区二区三区| 欧美一二区视频| 亚洲欧美日韩一区二区| 久久国产精品99精品国产| 99国产精品国产精品久久| 在线综合+亚洲+欧美中文字幕| 国产日韩欧美精品一区| 五月天中文字幕一区二区| 国产福利91精品一区| 欧美日本在线视频| 国产精品美女久久久久久久久| 亚洲影视资源网| 国产成a人亚洲| 欧美日韩久久一区| 国产精品色哟哟| 久久av老司机精品网站导航| 在线视频综合导航| 欧美激情综合在线| 久久精品国产99国产精品| 色丁香久综合在线久综合在线观看| 欧美不卡在线视频| 亚洲电影第三页| 91免费国产在线| 久久久国产一区二区三区四区小说| 午夜久久久久久| 色先锋久久av资源部| 欧美激情综合在线| 国产真实精品久久二三区| 777奇米四色成人影色区| 亚洲一区二区精品久久av| av网站免费线看精品| 国产欧美1区2区3区| 理论电影国产精品| 日韩午夜激情av| 日韩激情av在线| 欧美精品乱人伦久久久久久| 亚洲成人av资源| 欧美在线不卡一区| 亚洲精品国产一区二区精华液 | 欧美一区三区四区|