首页>代码>毕设 基于java swing的泡泡堂游戏>/H2003032025-泡泡堂网络游戏的设计与实现/Game/src/net/jeson/game/biz/MessageManager.java
package net.jeson.game.biz; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import net.jeson.game.util.Util; public class MessageManager { public Message message ; public Message getMessage() { return message; } public void setMessage(Message message) { this.message = message; } public static void sendMessage (Message message , ObjectOutputStream out){ //if(message.type == 3 )message.setType(5); try{ Util.printMessage("------All Send Msg ",message); if(message == null)System.out.println("Message is null "); out.writeObject(message); } catch(IOException e){ System.out.println("error"); } } public static Message receiveMessage(ObjectInputStream in){ Message msg = null; try{ msg = new Message(); msg=(Message)in.readObject(); } catch(Exception e){ System.out.println("Can receive meassge!"); return null; } Util.printMessage("------All Receive Msg ",msg); return msg; } public static void doMessage (Message message){ } }