|
From: <tre...@us...> - 2007-09-18 16:03:52
|
Revision: 418
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=418&view=rev
Author: trevorolio
Date: 2007-09-18 09:03:36 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
Added the ability to choose a male or female avatar.
Both avatar models still need work.
Consolidated the two UIConstants classes into one.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/xml/server/DocumentFactory.java
maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java 2007-09-18 16:03:23 UTC (rev 417)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java 2007-09-18 16:03:36 UTC (rev 418)
@@ -67,10 +67,22 @@
dirty = true;
record.setFaceIndex(bodyDoc.getFaceIndex());
}
+ if (bodyDoc.isMale() != record.isMale()) {
+ dirty = true;
+ record.setMale(bodyDoc.isMale());
+ }
+ if(bodyDoc.getHeight() != record.getHeight()){
+ dirty = true;
+ record.setHeight(bodyDoc.getHeight());
+ }
+ if(bodyDoc.getGirth() != record.getGirth()){
+ dirty = true;
+ record.setGirth(bodyDoc.getGirth());
+ }
if (dirty) {
session.update(record);
}
- return new BodyDocument(record.getBodyID(), record.getOwnerUsername(), record.getDisplayName(), record.getHairIndex(), record.getEyesIndex(), record.getNoseIndex(), record.getMouthIndex(), record.getFaceIndex());
+ return new BodyDocument(record.getBodyID(), record.getOwnerUsername(), record.getDisplayName(), record.getHairIndex(), record.getEyesIndex(), record.getNoseIndex(), record.getMouthIndex(), record.getFaceIndex(), record.isMale(), record.getHeight(), record.getGirth());
}
};
task.setSessionFactory(sessionFactory);
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-09-18 16:03:23 UTC (rev 417)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-09-18 16:03:36 UTC (rev 418)
@@ -40,10 +40,11 @@
import com.ogoglio.sim.script.SpaceScriptEngine;
import com.ogoglio.util.ArgumentUtils;
import com.ogoglio.util.BlockingQueue;
+import com.ogoglio.util.BodyConstants;
import com.ogoglio.util.Log;
+import com.ogoglio.util.UIConstants;
import com.ogoglio.util.BlockingQueue.QueueClosedException;
import com.ogoglio.viewer.j3d.J3DRenderer;
-import com.ogoglio.viewer.render.UIConstants;
import com.ogoglio.xml.BodyDocument;
import com.ogoglio.xml.DoorDocument;
import com.ogoglio.xml.PageDocument;
@@ -164,11 +165,19 @@
}
public InputStream getUserAnimationStream(String username, long animationID) throws IOException {
- return UIConstants.getUserAnimation((int) animationID);
+ return BodyConstants.getUserAnimation((int) animationID);
}
public InputStream getUserSkinMapStream(String username) throws IOException {
- return UIConstants.getResource("avatar/avatar.smap");
+ User user = space.getUser(username);
+ if(user == null){
+ return null;
+ }
+ if(user.getBody().isMale()){
+ return UIConstants.getResource(BodyConstants.MALE_SMAP_PATH);
+ } else {
+ return UIConstants.getResource(BodyConstants.FEMALE_SMAP_PATH);
+ }
}
public String getThingScript(long thingID) throws IOException {
@@ -180,7 +189,15 @@
}
public InputStream getUserGeometryStream(String username, String name) throws IOException {
- return UIConstants.getResource("avatar/avatar.obj");
+ User user = space.getUser(username);
+ if(user == null){
+ return null;
+ }
+ if(user.getBody().isMale()){
+ return UIConstants.getResource(BodyConstants.MALE_AVATAR_PATH);
+ } else {
+ return UIConstants.getResource(BodyConstants.FEMALE_AVATAR_PATH);
+ }
}
public InputStream getPageContentStream(long thingID, long pageID) {
@@ -188,7 +205,7 @@
}
public BodyDocument getBodyDocument(String username, long bodyID) throws IOException {
- return new BodyDocument(bodyID, username, "Body", 0, 0, 0, 0, 0);
+ return new BodyDocument(bodyID, username, "Body", 0, 0, 0, 0, 0, false, 2, 1);
}
}
@@ -369,8 +386,8 @@
if(chatMessage.startsWith("/") && chatMessage.length() > 1){
String command = chatMessage.substring(1);
boolean sentAnimation = false;
- for (int i = 0; i < UIConstants.USER_ANIMATION_COMMANDS.length; i++) {
- if(UIConstants.USER_ANIMATION_COMMANDS[i].equals(command)){
+ for (int i = 0; i < BodyConstants.USER_ANIMATION_COMMANDS.length; i++) {
+ if(BodyConstants.USER_ANIMATION_COMMANDS[i].equals(command)){
SpaceEvent playAnimationEvent = new SpaceEvent(SpaceEvent.PLAY_ANIMATION_EVENT);
playAnimationEvent.setProperty(SpaceEvent.USERNAME, user.getUsername());
playAnimationEvent.setProperty(SpaceEvent.ANIMATION_ID, new Long(i));
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/xml/server/DocumentFactory.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/xml/server/DocumentFactory.java 2007-09-18 16:03:23 UTC (rev 417)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/xml/server/DocumentFactory.java 2007-09-18 16:03:36 UTC (rev 418)
@@ -23,7 +23,7 @@
public class DocumentFactory {
public static BodyDocument documentFromRecord(BodyRecord record) {
- return new BodyDocument(record.getBodyID(), record.getOwnerUsername(), record.getDisplayName(), record.getHairIndex(), record.getEyesIndex(), record.getNoseIndex(), record.getMouthIndex(), record.getFaceIndex());
+ return new BodyDocument(record.getBodyID(), record.getOwnerUsername(), record.getDisplayName(), record.getHairIndex(), record.getEyesIndex(), record.getNoseIndex(), record.getMouthIndex(), record.getFaceIndex(), record.isMale(), record.getHeight(), record.getGirth());
}
Modified: maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java
===================================================================
--- maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java 2007-09-18 16:03:23 UTC (rev 417)
+++ maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java 2007-09-18 16:03:36 UTC (rev 418)
@@ -9,7 +9,7 @@
import junit.framework.TestCase;
import com.ogoglio.sim.SpaceSimulator;
-import com.ogoglio.viewer.render.UIConstants;
+import com.ogoglio.util.UIConstants;
import com.ogoglio.xml.SpaceDocument;
import com.ogoglio.xml.SpaceEvent;
import com.ogoglio.xml.TemplateDocument;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|