*** empty log message ***
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@639 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: CastUtil.java,v 1.2 2001/11/18 04:09:21 mdb Exp $
|
// $Id: CastUtil.java,v 1.3 2001/11/27 08:06:57 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.cast.util;
|
package com.threerings.cast.util;
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@ import com.threerings.media.util.RandomUtil;
|
|||||||
import com.threerings.cast.CharacterDescriptor;
|
import com.threerings.cast.CharacterDescriptor;
|
||||||
import com.threerings.cast.CharacterManager;
|
import com.threerings.cast.CharacterManager;
|
||||||
import com.threerings.cast.ComponentClass;
|
import com.threerings.cast.ComponentClass;
|
||||||
|
import com.threerings.cast.ComponentRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Miscellaneous cast utility routines.
|
* Miscellaneous cast utility routines.
|
||||||
@@ -23,11 +24,11 @@ public class CastUtil
|
|||||||
* components.
|
* components.
|
||||||
*/
|
*/
|
||||||
public static CharacterDescriptor getRandomDescriptor (
|
public static CharacterDescriptor getRandomDescriptor (
|
||||||
CharacterManager charmgr)
|
ComponentRepository crepo)
|
||||||
{
|
{
|
||||||
// get all available classes
|
// get all available classes
|
||||||
ArrayList classes = new ArrayList();
|
ArrayList classes = new ArrayList();
|
||||||
CollectionUtil.addAll(classes, charmgr.enumerateComponentClasses());
|
CollectionUtil.addAll(classes, crepo.enumerateComponentClasses());
|
||||||
|
|
||||||
// select the components
|
// select the components
|
||||||
int size = classes.size();
|
int size = classes.size();
|
||||||
@@ -37,12 +38,12 @@ public class CastUtil
|
|||||||
|
|
||||||
// get the components available for this class
|
// get the components available for this class
|
||||||
ArrayList choices = new ArrayList();
|
ArrayList choices = new ArrayList();
|
||||||
Iterator iter = charmgr.enumerateComponentsByClass(cclass.clid);
|
Iterator iter = crepo.enumerateComponentIds(cclass);
|
||||||
CollectionUtil.addAll(choices, iter);
|
CollectionUtil.addAll(choices, iter);
|
||||||
|
|
||||||
// choose a random component
|
// choose a random component
|
||||||
int idx = RandomUtil.getInt(choices.size());
|
int idx = RandomUtil.getInt(choices.size());
|
||||||
components[cclass.clid] = ((Integer)choices.get(idx)).intValue();
|
components[ii] = ((Integer)choices.get(idx)).intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CharacterDescriptor(components);
|
return new CharacterDescriptor(components);
|
||||||
|
|||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Invokes ant with the necessary class to build the component bundles.
|
||||||
|
|
||||||
|
BINDIR=`dirname $0`
|
||||||
|
|
||||||
|
# add all JAR files in /usr/share/ant/lib/ to CLASSPATH
|
||||||
|
SYSTEMCP=`echo /usr/share/java/*.jar | tr ' ' ':'`
|
||||||
|
# add all JAR files in /usr/share/ant/lib/ to CLASSPATH
|
||||||
|
PROJECTCP=`echo $BINDIR/../../lib/*.jar | tr ' ' ':'`
|
||||||
|
# also add narya.jar
|
||||||
|
export CLASSPATH=$BINDIR/../../dist/narya.jar:$PROJECTCP:$SYSTEMCP
|
||||||
|
# and invoke ant with the proper target
|
||||||
|
ant "$@" cbundles
|
||||||
+23
-1
@@ -11,6 +11,9 @@
|
|||||||
<property name="src.dir" value="src/java"/>
|
<property name="src.dir" value="src/java"/>
|
||||||
<property name="deploy.dir" value="dist"/>
|
<property name="deploy.dir" value="dist"/>
|
||||||
|
|
||||||
|
<property name="cbundle.dir" value="rsrc/bundles/components/pirate"/>
|
||||||
|
<property name="tbundle.dir" value="rsrc/bundles/tiles"/>
|
||||||
|
|
||||||
<!-- declare our classpath -->
|
<!-- declare our classpath -->
|
||||||
<path id="classpath">
|
<path id="classpath">
|
||||||
<pathelement location="../${deploy.dir}/classes"/>
|
<pathelement location="../${deploy.dir}/classes"/>
|
||||||
@@ -39,7 +42,8 @@
|
|||||||
<!-- build the java class files -->
|
<!-- build the java class files -->
|
||||||
<target name="compile" depends="prepare">
|
<target name="compile" depends="prepare">
|
||||||
<javac srcdir="${src.dir}" destdir="${deploy.dir}/classes"
|
<javac srcdir="${src.dir}" destdir="${deploy.dir}/classes"
|
||||||
debug="on" optimize="off" deprecation="off">
|
debug="on" optimize="off" deprecation="off"
|
||||||
|
excludes="com/threerings/cast/builder/**">
|
||||||
<classpath refid="classpath"/>
|
<classpath refid="classpath"/>
|
||||||
</javac>
|
</javac>
|
||||||
</target>
|
</target>
|
||||||
@@ -59,4 +63,22 @@
|
|||||||
</junit>
|
</junit>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<!-- test the component metadata bundling process -->
|
||||||
|
<target name="cbundles" description="Build component bundles.">
|
||||||
|
<!-- first build the metadata bundle -->
|
||||||
|
<taskdef name="metabundle"
|
||||||
|
classname="com.threerings.cast.tools.bundle.MetadataBundlerTask"/>
|
||||||
|
<metabundle actiondef="${cbundle.dir}/actions.xml"
|
||||||
|
classdef="${cbundle.dir}/classes.xml"
|
||||||
|
target="${cbundle.dir}/metadata.jar"/>
|
||||||
|
|
||||||
|
<!-- then a component bundle -->
|
||||||
|
<taskdef name="cbundle"
|
||||||
|
classname="com.threerings.cast.tools.bundle.ComponentBundlerTask"/>
|
||||||
|
<cbundle target="${cbundle.dir}/components.jar"
|
||||||
|
mapfile="${cbundle.dir}/components.map">
|
||||||
|
<fileset dir="${cbundle.dir}" includes="**/*.png"/>
|
||||||
|
</cbundle>
|
||||||
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" standalone="yes"?>
|
||||||
|
<!-- $Id: actions.xml,v 1.1 2001/11/27 08:06:57 mdb Exp $ -->
|
||||||
|
|
||||||
|
<!-- test component action definitions -->
|
||||||
|
<actions>
|
||||||
|
<action name="standing">
|
||||||
|
<framesPerSecond>5</framesPerSecond>
|
||||||
|
<origin>47,80</origin>
|
||||||
|
<tileset>
|
||||||
|
<heights>94, 94, 94, 94, 94, 94, 94, 94</heights>
|
||||||
|
<widths>94, 94, 94, 94, 94, 94, 94, 94</widths>
|
||||||
|
<tileCounts>1, 1, 1, 1, 1, 1, 1, 1</tileCounts>
|
||||||
|
<offsetPos>1, 1</offsetPos>
|
||||||
|
<gapDist>39, 18</gapDist>
|
||||||
|
</tileset>
|
||||||
|
</action>
|
||||||
|
|
||||||
|
<action name="walking">
|
||||||
|
<framesPerSecond>5</framesPerSecond>
|
||||||
|
<origin>47,80</origin>
|
||||||
|
<tileset>
|
||||||
|
<heights>94, 94, 94, 94, 94, 94, 94, 94</heights>
|
||||||
|
<widths>94, 94, 94, 94, 94, 94, 94, 94</widths>
|
||||||
|
<tileCounts>6, 6, 6, 6, 6, 6, 6, 6</tileCounts>
|
||||||
|
<offsetPos>1, 1</offsetPos>
|
||||||
|
<gapDist>39, 18</gapDist>
|
||||||
|
</tileset>
|
||||||
|
</action>
|
||||||
|
</actions>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" standalone="yes"?>
|
||||||
|
<!-- $Id: classes.xml,v 1.1 2001/11/27 08:06:57 mdb Exp $ -->
|
||||||
|
|
||||||
|
<!-- test component class definitions -->
|
||||||
|
<classes>
|
||||||
|
<class name="hat" renderPriority="1"/>
|
||||||
|
<class name="torso" renderPriority="0"/>
|
||||||
|
</classes>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
*.jar
|
||||||
|
*.map
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
@@ -1,7 +1,11 @@
|
|||||||
#
|
#
|
||||||
# $Id: manager.properties,v 1.1 2001/11/21 02:42:16 mdb Exp $
|
# $Id: manager.properties,v 1.2 2001/11/27 08:06:57 mdb Exp $
|
||||||
#
|
#
|
||||||
# Test resource manager configuration
|
# Test resource manager configuration
|
||||||
|
|
||||||
# used to test the BundledTileSetRepository
|
# used to test the BundledTileSetRepository
|
||||||
resource.set.bundle_test = rsrc/media/tools/tile/bundle.jar
|
resource.set.bundle_test = rsrc/media/tools/tile/bundle.jar
|
||||||
|
|
||||||
|
# used to test the BundledComponentRepository
|
||||||
|
resource.set.components = rsrc/bundles/components/pirate/metadata.jar:\
|
||||||
|
rsrc/bundles/components/pirate/components.jar
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
//
|
||||||
|
// $Id: BundledComponentRepositoryTest.java,v 1.1 2001/11/27 08:06:57 mdb Exp $
|
||||||
|
|
||||||
|
package com.threerings.cast.bundle;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import com.samskivert.util.StringUtil;
|
||||||
|
import com.threerings.resource.ResourceManager;
|
||||||
|
import com.threerings.cast.ComponentClass;
|
||||||
|
|
||||||
|
public class BundledComponentRepositoryTest
|
||||||
|
{
|
||||||
|
public static void main (String[] args)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
ResourceManager rmgr = new ResourceManager(null, "rsrc");
|
||||||
|
BundledComponentRepository repo =
|
||||||
|
new BundledComponentRepository(rmgr, "components");
|
||||||
|
|
||||||
|
System.out.println("Classes: " + StringUtil.toString(
|
||||||
|
repo.enumerateComponentClasses()));
|
||||||
|
|
||||||
|
System.out.println("Actions: " + StringUtil.toString(
|
||||||
|
repo.enumerateActionSequences()));
|
||||||
|
|
||||||
|
System.out.println("Action sets: " + StringUtil.toString(
|
||||||
|
repo._actionSets.values().iterator()));
|
||||||
|
|
||||||
|
Iterator iter = repo.enumerateComponentClasses();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
ComponentClass cclass = (ComponentClass)iter.next();
|
||||||
|
System.out.println("IDs [" + cclass + "]: " +
|
||||||
|
StringUtil.toString(
|
||||||
|
repo.enumerateComponentIds(cclass)));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ViewerSceneViewPanel.java,v 1.31 2001/11/18 04:09:21 mdb Exp $
|
// $Id: ViewerSceneViewPanel.java,v 1.32 2001/11/27 08:06:57 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.viewer;
|
package com.threerings.miso.viewer;
|
||||||
|
|
||||||
@@ -47,9 +47,9 @@ public class ViewerSceneViewPanel extends SceneViewPanel
|
|||||||
// configure the character manager from which we obtain sprites
|
// configure the character manager from which we obtain sprites
|
||||||
charmgr.setCharacterClass(MisoCharacterSprite.class);
|
charmgr.setCharacterClass(MisoCharacterSprite.class);
|
||||||
|
|
||||||
// create the character descriptors
|
// create the character descriptors FIXME
|
||||||
_descUser = CastUtil.getRandomDescriptor(charmgr);
|
_descUser = CastUtil.getRandomDescriptor(null);
|
||||||
_descDecoy = CastUtil.getRandomDescriptor(charmgr);
|
_descDecoy = CastUtil.getRandomDescriptor(null);
|
||||||
|
|
||||||
// create the manipulable sprite
|
// create the manipulable sprite
|
||||||
_sprite = createSprite(spritemgr, charmgr, _descUser);
|
_sprite = createSprite(spritemgr, charmgr, _descUser);
|
||||||
|
|||||||
Reference in New Issue
Block a user