public static void sendAllMessage(int event, Sprite sprite) { if (mainController.getAgent() != null) { DInfo dinfo = getSimpleMessage(event, sprite); try { String tempFile = new SpriteDialog().makeFilePath(""); List costumeList = JsonUtil.processCostumes(sprite, tempFile); String jsonString = JsonUtil.convertObjectToJsonString(costumeList); dinfo.set(K_COSTUME_LIST, jsonString); } catch (IOException ex) { Logger.getLogger(SpriteDialog.class.getName()).log(Level.SEVERE, null, ex); } mainController.getAgent().sendNotify(dinfo); } }
private void mSpriteCreate(DInfo dinfo) { Sprite sprite = new Sprite(); sprite.setMainController(mainController); sprite.setName(dinfo.get(K_SPRITE_NAME)); sprite.setLayoutX(dinfo.getInt(K_X1)); sprite.setLayoutY(dinfo.getInt(K_Y1)); String jsonString = dinfo.get(K_COSTUME_LIST); List<Map> list = JsonUtil.convertJsonStringToList(jsonString); try { JsonUtil.parseJSONStringToCostumes(sprite, list, new File("")); } catch (MalformedURLException ex) { Logger.getLogger(SpriteDialog.class.getName()).log(Level.SEVERE, null, ex); } sprite.setSpriteCostume(dinfo.getInt(K_COSTUME_CURRENT)); mainController.getFrontStageController().addSprite(sprite, false); }
private void mCostumeSync(Sprite sprite, DInfo dinfo) { // コスチュームを一旦全削除 sprite.clearCostume(); String jsonString = dinfo.get(K_COSTUME_LIST); List<Map> list = JsonUtil.convertJsonStringToList(jsonString); try { JsonUtil.parseJSONStringToCostumes(sprite, list, new File("")); } catch (MalformedURLException ex) { Logger.getLogger(SpriteDialog.class.getName()).log(Level.SEVERE, null, ex); } sprite.setSpriteCostume(dinfo.getInt(K_COSTUME_CURRENT)); // 同一のスプライト編集中は即時更新 String name = mainController.getFrontStageController().getCurrentSprite().getName(); if (sprite.getName().equals(name)) { mainController.getBackStageController().showCostumes(sprite); } }