public void init() { ServerData.mapSize = 4; makeGround(); list = new ArrayList<MapItemController>(); MapItemController item = null; item = MapItemFactory.makeMapItem(MapItemFactory.CHERRY_PINK); list.add(item); addChild(item.getImage()); item.isoMoveTo(0, 0); int i; for (i = 1002; i <= 1002; i++) { item = MapItemFactory.makeMapItem(i); list.add(item); addChild(item.getImage()); item.isoMoveTo(0, 0); item.getImage().setVisible(false); } // item = MapItemFactory.makeMapItem(MapItemFactory.CHERRY_PINK); // list.add(item); // addChild(item.getImage()); // item.isoMoveTo(6, 6); GameStatus.isMapEditMode = true; this.setIsTouchEnabled(true); }
private void touched(CGPoint pt) { MapItemController item = null; int len = list.size(); for (int i = 0; i < len; i++) { item = list.get(i); if (item.checkDown(pt)) { currentItem = item; break; } } if (currentItem != null) { if (GameStatus.isMapEditMode) { CGPoint worldConvert = CGPoint.zero(); CGPoint itempt = currentItem.getImage().getPositionRef(); this.convertToWorldSpace(itempt.x, itempt.y, worldConvert); Log.i("maplayer_touched", "check"); SceneManager.getInstance().interfaceLayer.showRoundMenu(worldConvert); } else { // if deco -> show tooltip // else if crop -> harvest. } } }