diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index a446cd7..fa959f1 100644 --- a/.idea/caches/build_file_checksums.ser +++ b/.idea/caches/build_file_checksums.ser Binary files differ diff --git a/app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/types/PlayerId.java b/app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/types/PlayerId.java new file mode 100644 index 0000000..3bc3da6 --- /dev/null +++ b/app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/types/PlayerId.java @@ -0,0 +1,16 @@ +package org.ntlab.radishforandroidstudio.cactusClient.types; + +import android.support.annotation.NonNull; + +import org.ntlab.radishforandroidstudio.framework.common.CommonId; + +/** + * Player IDの管理クラス + * + * @author s.iwatani + */ +public class PlayerId extends CommonId { + public PlayerId(@NonNull Integer id) { + super(id); + } +} diff --git a/app/src/main/java/org/ntlab/radishforandroidstudio/framework/common/CommonId.java b/app/src/main/java/org/ntlab/radishforandroidstudio/framework/common/CommonId.java new file mode 100644 index 0000000..4414b62 --- /dev/null +++ b/app/src/main/java/org/ntlab/radishforandroidstudio/framework/common/CommonId.java @@ -0,0 +1,25 @@ +package org.ntlab.radishforandroidstudio.framework.common; + +import android.support.annotation.NonNull; + +/** + * Id管理の基底クラス + * + * @author s.iwatani + * @param + */ +public abstract class CommonId { + private IdType id = null; + + public CommonId(@NonNull IdType id) { + setId(id); + } + + public IdType getId() { + return id; + } + + public void setId(IdType id) { + this.id = id; + } +} diff --git a/app/src/main/java/org/ntlab/radishforandroidstudio/framework/model3D/Universe.java b/app/src/main/java/org/ntlab/radishforandroidstudio/framework/model3D/Universe.java index 258e7dd..6a8fe31 100644 --- a/app/src/main/java/org/ntlab/radishforandroidstudio/framework/model3D/Universe.java +++ b/app/src/main/java/org/ntlab/radishforandroidstudio/framework/model3D/Universe.java @@ -1,5 +1,6 @@ package org.ntlab.radishforandroidstudio.framework.model3D; +import org.ntlab.radishforandroidstudio.framework.common.CommonId; import org.ntlab.radishforandroidstudio.framework.physics.Ground; import org.ntlab.radishforandroidstudio.java3d.BranchGroup; import org.ntlab.radishforandroidstudio.java3d.Group; @@ -11,6 +12,8 @@ import org.ntlab.radishforandroidstudio.java3d.TransformGroup; import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; public class Universe { private BranchGroup root = null; @@ -18,6 +21,7 @@ private BackgroundBox skyBox = null; private Ground ground = null; private ArrayList movableList = new ArrayList(); + private Map objMap = new HashMap<>(); public Universe() { root = new BranchGroup(); @@ -59,7 +63,16 @@ viewer.draw(node); } } - + + public void apply(HashMap> properties) { + for (Map.Entry> entry : properties.entrySet()) { + Object3D target = objMap.get(entry.getKey()); + for (Property3D prop : entry.getValue()) { + target.apply(prop, false); + } + } + } + public void update(long interval){ for(int i = 0; i < movableList.size(); i++){ Movable movable = movableList.get(i); @@ -87,6 +100,10 @@ root.addChild(node); } + public void place(Object3D obj, CommonId id) { + objMap.put(id, obj); + } + /** * 後で取り除けるようにオブジェクトを配置する * @@ -135,6 +152,8 @@ root.removeChild(node); } + public void displace(CommonId id) { objMap.remove(id); } + public ArrayList getLights() { return lights; }