||unity-dev|| Unity 3

Discussion list for Unity developers. unity-dev at moock.org
Thu Jun 28 21:18:17 CDT 2007


we're working on it every day now. about a week ago I had an 
ActionScript 3 library that was working with the server at that time (in 
a "2.5" state.) but both Derek and I have now undertaken a substantial 
API overhaul. things are already drastically streamlined and full of new 
toys, but at this stage neither of us can compile :)

we are hoping to be able to compile in a couple of weeks, and then we'll 
get into all the runtime testing. we would love to release a solid beta 
this summer, and we're making great progress, so it might just happen.

to get you started thinking about the new api, here's a theoretical 
sample app i used to sketch out some basics...notice that UClient is 
gone! :)

======
package {
   import flash.display.Sprite;
   import flash.events.*;

   public class UChat extends Sprite {
     var connection:UConnection;
     var chatRoom:URoom;
     var chatRoomView:ChatRoomView

     public function UChat () {
       connection = new UConnection();
       connection.addEventListener(UConnectionEvent.READY,
                                   readyListener);
       connection.open("localhost", 9100);
     }

     public function readyListener (e:UConnectionEvent) {
       // Make the chat room on the server (if necessary)
       chatRoom = connection.getRoomManager().createRoom(
                                               "simplechat.chat",
                                               true,
                                               true,
                                               50);

       // Register for room events
       chatRoom.addEventListener(URoom.READY,
                                 chatRoomView.readyListener);
       chatRoom.addEventListener(URoom.JOIN,
                                 chatRoomView.joinListener);
       chatRoom.addEventListener(URoom.LEAVE,
                                 chatRoomView.leaveListener);
       chatRoom.addEventListener(URoom.ADD_CLIENT,
                                 chatRoomView.addClientListener);
       chatRoom.addEventListener(URoom.REMOVE_CLIENT,
                                 chatRoomView.removeClientListener);
       chatRoom.addEventListener(URoom.CLIENT_ATTR_CHANGE,
                                 chatRoomView.clientAttrChangeListener);
       chatRoom.addEventListener(URoom.ROOM_ERROR,
                                 chatRoomView.roomErrorListener);

       // Register for remote "displayMessage" invocations
       connection.getMessageManager().addMessageListener(Messages.CHAT,
                                        chatRoomView.displayChatMessage);

       // Register for connection events
       connection.addEventListener(UConnectionEvent.FAILED,
                                   chatRoomView.connectFailedListener);
       connection.addEventListener(UConnectionEvent.CLOSE,
                                   chatRoomView.connectCloseListener);

       // Put the room UI on screen
       addChild(chatRoomView);
     }
   }
}



package {
   import flash.display.Sprite;
   import flash.events.*;
   import org.moock.unity.*;

   public class ChatRoomView extends Sprite {
     var room:URoom;

     var status:Text;
     var userlist:List;
     var outField:TextArea;
     var inField:TextInput;
     var sendButton:Button

     public function ChatRoomView (room:URoom) {
       buildUI();
     }

     public function buildUI ():void {
       status = new Text();
       userlist = new List();
       outField = new TextArea();
       inField  = new TextInput();
       sendButton = new Button();

       addChild(status);
       addChild(userlist);
       addChild(outField);
       addChild(inField);
       addChild(sendButton);
       // etc...

       sendButton.addEventListener(Event.BUTTON_DOWN,
                                   buttonDownListener);

       status = "Initializing chat room...";
     }

     public function readyListener (e:URoomEvent):void {
       join();
       status = "Joining chat room...";
     }

     public function joinListener (e:URoomEvent):void {
       status.text = "Chat room joined.";
     }

     public function addClientListener (e:URoomEvent):void {
       // Insert into UI
       userlist.add(getUserName(e.getClient()),
                    e.getClient().getID());
     }

     public function buttonDownListener (e:Event):void {
       sendMessage(Messages.CHAT,
                   true,
                   outField.text);
     }

     public function displayMessage (client:Client, msg:String):void {
       inField.appendText(getUserName(client) + ": " + msg + "\n");
     }

     public function getUserName (client:Client):void {
       var username:String = client.getAttribute(null, "username");
       if (username == null) {
         username = "User" + client.getID();
       }
       return username;
     }

     public function connectFailedListener (e:UConnectionEvent):void {
       status.text = "Connection to Unity failed.";
       disableUI();
     }

     public function disableUI ():void {
       // Disable UI
     }
   }
}
======

note that the above code has never been compiled, but it represents 
conceptually how we see app development with Unity 3.

colin

Discussion list for Unity developers. wrote:
> I'm on the edge of my seat awaiting any sign of a Unity 3 alpha/beta :-)  Is
> there any news yet?  Will there be any kind of requirements to be met to get
> on the testing team?
> 
> Sorry to be a bother, but I'm ready for even untested alpha versions!
> 
> Chad
> --
> you're a unity-dev subscriber. to unsubscribe, visit www.moock.org/mailman/listinfo/unity-dev/
> 
> superb hosting for this list and moock.org is generously provided by Rackspace. See: http://www.rackspace.com/?supbid=moock


More information about the unity-dev mailing list