More bits and hackery (and a hand-generated TimeBaseMarshaller, so that I
can get fully logged in). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3904 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -94,11 +94,14 @@ public class Client extends EventDispatcher
|
||||
|
||||
public function getService (clazz :Class) :InvocationService
|
||||
{
|
||||
if (_bstrap == null) {
|
||||
return null;
|
||||
if (_bstrap != null) {
|
||||
for each (var service :InvocationService in _bstrap.services) {
|
||||
if (service is clazz) {
|
||||
return service;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.threerings.presents.client {
|
||||
|
||||
public interface GotTimeBaseListener extends InvocationListener
|
||||
{
|
||||
function gotTimeOid (timeOid :int) :void;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.threerings.presents.client {
|
||||
|
||||
import com.threerings.util.Name;
|
||||
import com.threerings.presents.data.TimeBaseMarshaller;
|
||||
import com.threerings.presents.net.UsernamePasswordCreds;
|
||||
|
||||
public class TestClient extends Client
|
||||
@@ -11,5 +12,13 @@ public class TestClient extends Client
|
||||
setServer("tasman.sea.earth.threerings.net", DEFAULT_SERVER_PORT);
|
||||
logon();
|
||||
}
|
||||
|
||||
|
||||
// If a class isn't used anywhere, it won't get added to the .swf.
|
||||
// Here, I hack.
|
||||
public function fuckingCompiler () :void
|
||||
{
|
||||
var i :int = TimeBaseMarshaller.GET_TIME_OID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// $Id: TimeBaseService.java 3099 2004-08-27 02:21:06Z mdb $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library 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
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.presents.client {
|
||||
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
|
||||
/**
|
||||
* Provides a means by which to obtain access to a time base object which
|
||||
* can be used to convert delta times into absolute times.
|
||||
*/
|
||||
public interface TimeBaseService extends InvocationService
|
||||
{
|
||||
/**
|
||||
* Requests the oid of the specified time base object be fetched.
|
||||
*/
|
||||
function getTimeOid (
|
||||
client :Client, timeBase :String, listener :GotTimeBaseListener) :void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.threerings.presents.data {
|
||||
|
||||
import com.threerings.presents.client.GotTimeBaseListener;
|
||||
|
||||
import com.threerings.presents.dobj.InvocationResponseEvent;
|
||||
|
||||
// TODO: this will be autogenerated
|
||||
public class GotTimeBaseMarshaller extends ListenerMarshaller
|
||||
implements GotTimeBaseListener
|
||||
{
|
||||
public static const GOT_TIME_OID :int = 1;
|
||||
|
||||
public function gotTimeOid (arg1 :int) :void
|
||||
{
|
||||
omgr.postEvent(new InvocationResponseEvent(
|
||||
callerOid, requestId, GOT_TIME_OID, [ arg1 ]));
|
||||
}
|
||||
|
||||
public override function dispatchResponse (methodId :int, args :Array) :void
|
||||
{
|
||||
switch (methodId) {
|
||||
case GOT_TIME_OID:
|
||||
(listener as GotTimeBaseListener).gotTimeOid(args[0] as int);
|
||||
return;
|
||||
|
||||
default:
|
||||
super.dispatchResponse(methodId, args);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,8 @@ package com.threerings.presents.data {
|
||||
|
||||
import com.threerings.util.ClassUtil;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.Streamable;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ListenerMarshaller
|
||||
implements Streamable, InvocationListener
|
||||
{
|
||||
/** The method id used to dispatch a requestFailed response. */
|
||||
public const REQUEST_FAILED_RSPID :int = 0;
|
||||
public static const REQUEST_FAILED_RSPID :int = 0;
|
||||
|
||||
/** The oid of the invocation service requester. */
|
||||
public var callerOid :int;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.threerings.presents.data {
|
||||
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.client.GotTimeBaseListener;
|
||||
import com.threerings.presents.client.TimeBaseService;
|
||||
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
import com.threerings.presents.dobj.InvocationResponseEvent;
|
||||
|
||||
// TODO
|
||||
// This will be auto-generated soon from the service definition
|
||||
public class TimeBaseMarshaller extends InvocationMarshaller
|
||||
implements TimeBaseService
|
||||
{
|
||||
public static const GET_TIME_OID :int = 1;
|
||||
|
||||
public function getTimeOid (
|
||||
arg1 :Client, arg2 :String, arg3 :GotTimeBaseListener) :void
|
||||
{
|
||||
var listener3 :GotTimeBaseMarshaller = new GotTimeBaseMarshaller();
|
||||
listener3.listener = arg3;
|
||||
sendRequest(arg1, GET_TIME_OID, [arg2, listener3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user