[skycastle-commits] SF.net SVN: skycastle: [445] trunk/skycastle/modules

  • From: zzorn@xxxxxxxxxxxxxxxxxxxxx
  • To: skycastle-commits@xxxxxxxxxxxxx
  • Date: Sat, 05 Apr 2008 15:21:20 -0700

Revision: 445
          http://skycastle.svn.sourceforge.net/skycastle/?rev=445&view=rev
Author:   zzorn
Date:     2008-04-05 15:21:20 -0700 (Sat, 05 Apr 2008)

Log Message:
-----------
The server now sends the ID of the users account object to the user when 
logging on.  Still need to implement sending actual available properties and 
actions.

Modified Paths:
--------------
    
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectAddedMessage.java
    
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectRemovedMessage.java
    
trunk/skycastle/modules/core/src/main/java/org/skycastle/protocol/ProtocolCommunicator.java
    
trunk/skycastle/modules/server/src/main/java/org/skycastle/server/SkycastleClientSessionHandler.java

Modified: 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectAddedMessage.java
===================================================================
--- 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectAddedMessage.java
       2008-04-05 22:09:23 UTC (rev 444)
+++ 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectAddedMessage.java
       2008-04-05 22:21:20 UTC (rev 445)
@@ -14,15 +14,12 @@
  * Indicates that the GameObject with the specified ID is now available to the 
client.
  * <p/>
  * Any available properties, actions, etc. will be indicated with further 
update messages.
+ * <p/>
+ * Note that this message is used only for the handle objects that the user 
can use to access other {@link
+ * GameObject}s on the server (typically the users account). These objects can 
contain refereces to other
+ * {@link GameObject}s in their properties and such.
  *
  * @author Hans Haggstrom
- * @deprecated This is not really needed.  The client only needs the root 
account object, after that all game
- *             objects can be accessed through it.
- *             <p/>
- *             TODO: We do need messages to notify collection properties about 
added and removed entries
- *             though, without having to resend the whole collection.
- *             <p/>
- *             Maybe change these messages to work on collection properties of 
GameObjects instead?
  */
 public final class GameObjectAddedMessage
         extends AbstractMessage
@@ -80,6 +77,6 @@
     public void applyStateChangeToModel( final GameObjectContext 
gameObjectContext )
     {
         throw new UnsupportedOperationException( "This method has not yet been 
implemented." ); // IMPLEMENT
-
     }
+
 }

Modified: 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectRemovedMessage.java
===================================================================
--- 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectRemovedMessage.java
     2008-04-05 22:09:23 UTC (rev 444)
+++ 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectRemovedMessage.java
     2008-04-05 22:21:20 UTC (rev 445)
@@ -1,5 +1,6 @@
 package org.skycastle.messaging.updates.object;
 
+import org.skycastle.core.GameObject;
 import org.skycastle.core.GameObjectContext;
 import org.skycastle.core.GameObjectId;
 import org.skycastle.messaging.AbstractMessage;
@@ -13,7 +14,6 @@
  * A message to indicate that the specified GameObject is no longer available 
for the client.
  *
  * @author Hans Haggstrom
- * @deprecated This is not really needed.
  */
 public final class GameObjectRemovedMessage
         extends AbstractMessage
@@ -37,9 +37,8 @@
     // Constructors
 
     /**
-     * @param senderId        id of the {@link org.skycastle.core.GameObject} 
that sent this {@link
-     *                        AbstractMessage}.
-     * @param removedObjectId the id of the {@link 
org.skycastle.core.GameObject} that should be removed.
+     * @param senderId        id of the {@link GameObject} that sent this 
{@link AbstractMessage}.
+     * @param removedObjectId the id of the {@link GameObject} that should be 
removed.
      */
     public GameObjectRemovedMessage( final GameObjectId senderId, final 
GameObjectId removedObjectId )
     {

Modified: 
trunk/skycastle/modules/core/src/main/java/org/skycastle/protocol/ProtocolCommunicator.java
===================================================================
--- 
trunk/skycastle/modules/core/src/main/java/org/skycastle/protocol/ProtocolCommunicator.java
 2008-04-05 22:09:23 UTC (rev 444)
+++ 
trunk/skycastle/modules/core/src/main/java/org/skycastle/protocol/ProtocolCommunicator.java
 2008-04-05 22:21:20 UTC (rev 445)
@@ -16,6 +16,7 @@
  *
  * @author Hans Häggström
  */
+// IDEA: Move logging / some error handling to this class, and avoid throwing 
out exceptions?
 public abstract class ProtocolCommunicator
         implements Serializable
 {

Modified: 
trunk/skycastle/modules/server/src/main/java/org/skycastle/server/SkycastleClientSessionHandler.java
===================================================================
--- 
trunk/skycastle/modules/server/src/main/java/org/skycastle/server/SkycastleClientSessionHandler.java
        2008-04-05 22:09:23 UTC (rev 444)
+++ 
trunk/skycastle/modules/server/src/main/java/org/skycastle/server/SkycastleClientSessionHandler.java
        2008-04-05 22:21:20 UTC (rev 445)
@@ -5,6 +5,7 @@
 import org.skycastle.messaging.Message;
 import org.skycastle.messaging.modifications.ModificationMessage;
 import org.skycastle.messaging.updates.UpdateMessage;
+import org.skycastle.messaging.updates.object.GameObjectAddedMessage;
 import org.skycastle.protocol.ProtocolCommunicator;
 import org.skycastle.protocol.ProtocolException;
 import org.skycastle.protocol.negotiation.NegotiationStatus;
@@ -171,6 +172,18 @@
         // TODO: Notify the account object that the user logged in.
 
         myClientAccountReference = new GameObjectReference( account );
+
+        try
+        {
+            // Send a reference to the account game object to the client side
+            sendMessage( new GameObjectAddedMessage( account.getId(), 
account.getId() ) );
+        }
+        catch ( ProtocolException e )
+        {
+            LOGGER.log( Level.INFO,
+                        "Problem sending account GameObject to user '" + 
myClientSession.getName() + "': " + e.getMessage(),
+                        e );
+        }
     }
 
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

Other related posts:

  • » [skycastle-commits] SF.net SVN: skycastle: [445] trunk/skycastle/modules