private boolean placeObjectOnMountPoint( NormalObject conflictObject, int conflictObjectMountPointIndex, int moveObjectSlotType, int moveObjectSlotIndex, int moveObjectMountPointIndex) { SEVector3f desLocation = null; if (moveObjectSlotType != ObjectInfo.SLOT_TYPE_WALL_SHELF) { int emptyMountPointIndex = mWallShelf.getMountPointIndexExceptDest(conflictObject, conflictObjectMountPointIndex); if (emptyMountPointIndex == -1) { return false; } desLocation = mWallShelf.getSlotPosition(conflictObject.mName, emptyMountPointIndex); } else { if (moveObjectSlotIndex == mWallShelf.mIndex) { desLocation = mWallShelf.getSlotPosition(conflictObject.mName, moveObjectMountPointIndex); } else { SEObject parent = getScene().findObject(mWallShelf.mName, moveObjectSlotIndex); if ((parent instanceof WallShelf) == false) { Log.i(TAG, "## parent is not wallshelf ##"); } conflictObject.changeParent(parent); WallShelf parentShelf = (WallShelf) parent; desLocation = parentShelf.getSlotPosition(conflictObject.mName, moveObjectMountPointIndex); } } conflictObject.getObjectInfo().mObjectSlot.mSlotIndex = moveObjectSlotIndex; conflictObject.getObjectInfo().mObjectSlot.mMountPointIndex = moveObjectMountPointIndex; conflictObject.getUserTransParas().mTranslate = desLocation; conflictObject.getUserTransParas().mRotate.set(0, 0, 0, 1); conflictObject.setUserTransParas(); return true; }
@Override public boolean placeObjectToVessel(NormalObject normalObject, SEAnimFinishListener l) { SEDebug.myAssert( normalObject.getObjectInfo().mSlotType == ObjectInfo.SLOT_TYPE_WALL_SHELF, "must be WALL_SHELF"); boolean b = this.placeObjectOnMountPoint( normalObject, -1, normalObject.getObjectInfo().mSlotType, normalObject.getObjectSlot().mSlotIndex, normalObject.getObjectSlot().mMountPointIndex); return b; }
@Override public void onRelease() { super.onRelease(); File f = new File(mSaveImagePath); if (f.exists()) { f.delete(); } }
@Override public void initStatus() { super.initStatus(); setCanChangeBind(false); mRequestCode = (int) System.currentTimeMillis(); if (mRequestCode < 0) { mRequestCode = -mRequestCode; } mSaveImagePath = getContext().getFilesDir() + File.separator + getScene().getSceneName() + mName + mIndex + ".png"; File dir = new File(HomeUtils.SDCARD_PATH); if (!dir.exists()) { dir.mkdirs(); } mPhotoObject = findComponenetObjectByRegularName("picture"); mImageName = mPhotoObject.getImageName(); initImage(); setHasInit(true); }
public NormalObject CreateNormalObject(HomeScene scene) { NormalObject obj = null; if (mClassName == null) { if ("RootNode".equals(mType)) { obj = new NodeRoot(scene, mName, mIndex); } else if ("HouseLand".equals(mType) || "HousePort".equals(mType) || "House".equals(mType)) { obj = new House(scene, mName, mIndex); } else if ("DeskLand".equals(mType) || "DeskPort".equals(mType) || "Desk".equals(mType)) { obj = new Desk(scene, mName, mIndex); } else if ("Wall".equals(mType)) { obj = new Wall(scene, mName, mIndex); } else if ("Ground".equals(mType)) { obj = new Ground(scene, mName, mIndex); } else if ("Sky".equals(mType)) { obj = new Cloud(scene, mName, mIndex); } else if ("Airship".equals(mType)) { obj = new Flyer(scene, mName, mIndex); } else if ("Bookshelf".equals(mType)) { obj = new Bookshelf(scene, mName, mIndex); } else if ("Calendary".equals(mType)) { obj = new Calendary(scene, mName, mIndex); } else if ("TableFrame".equals(mType)) { obj = new TableFrame(scene, mName, mIndex); } else if ("PictureFrame".equals(mType)) { obj = new WallFrame(scene, mName, mIndex); } else if ("TV".equals(mType)) { obj = new Television(scene, mName, mIndex); } else if ("Clock".equals(mType)) { obj = new Clock(scene, mName, mIndex); } else if ("Laptop".equals(mType)) { obj = new Laptop(scene, mName, mIndex); } else if ("App".equals(mType)) { obj = new AppObject(scene, mName, mIndex); } else if ("Shortcut".equals(mType)) { obj = new ShortcutObject(scene, mName, mIndex); } else if ("Widget".equals(mType)) { obj = new WidgetObject(scene, mName, mIndex); } else if ("Folder".equals(mType)) { obj = new Folder(scene, mName, mIndex); } else if ("Email".equals(mType)) { obj = new EmailBox(scene, mName, mIndex); } else if ("AppWall".equals(mType)) { obj = new AppWall(scene, mName, mIndex); } else if ("WallGlobe".equals(mType)) { obj = new Navigation(scene, mName, mIndex); } else if ("PictureFrame2".equals(mType)) { obj = new WallFrame2(scene, mName, mIndex); } else if ("ChristmasTree".equals(mType)) { obj = new ChristmasTree(scene, mName, mIndex); } else if ("Bookshelf_L".equals(mType)) { obj = new BookshelfL(scene, mName, mIndex); } else { obj = new NormalObject(scene, mName, mIndex); } } else { try { Class<NormalObject> clazz = (Class<NormalObject>) Class.forName(mClassName); Class[] paratype = {HomeScene.class, String.class, int.class}; Constructor constructor = clazz.getConstructor(paratype); Object[] para = {scene, mName, mIndex}; obj = (NormalObject) constructor.newInstance(para); } catch (Exception e) { obj = new NormalObject(scene, mName, mIndex); } } obj.setObjectInfo(this); return obj; }