public void Edit(OuyaMod ouyaMod) { using (OuyaMod.Editor editor = ouyaMod.edit()) { //Debug.Log("Access to Editor"); // Required fields: editor.setTitle("edit title"); editor.setCategory("edit category"); editor.setDescription("edit description"); // replace file editor.deleteFile("level.dat"); using (OutputStream os = editor.newFile("level.dat")) { os.write(System.Text.UTF8Encoding.UTF8.GetBytes("edit file")); os.close(); } // remove old screenshot List <OuyaModScreenshot> screenshots = ouyaMod.getScreenshots(); for (int index = 0; index < screenshots.Count; ++index) { using (OuyaModScreenshot ouyaModScreenshot = screenshots[index]) { editor.removeScreenshot(ouyaModScreenshot); } } // add new screenshot if (m_bitmapScreenshots.Length > 1) { Debug.Log("Adding screenshot"); editor.addScreenshot(m_bitmapScreenshots[1]); } else { Debug.LogError("Missing screenshot"); } // remove old tags foreach (string tag in ouyaMod.getTags()) { editor.removeTag(tag); } // Add optional tags: editor.addTag("edit tag"); // Add optional metadata for your own display: editor.setMetadata("edit meta data"); OuyaUnityPlugin.saveOuyaMod(ouyaMod, editor); } }
public void Create() { using (OuyaContent ouyaContent = OuyaUnityPlugin.getOuyaContent()) { if (null == ouyaContent) { Debug.LogError("OuyaContent is null"); return; } if (ouyaContent.isInitialized()) { //Debug.Log("OuyaContent is initialized"); using (OuyaMod ouyaMod = ouyaContent.create()) { //Debug.Log("Created OuyaMod"); using (OuyaMod.Editor editor = ouyaMod.edit()) { //Debug.Log("Access to Editor"); // Required fields: editor.setTitle("Custom Level"); editor.setCategory("level"); editor.setDescription("This is my custom level"); using (OutputStream os = editor.newFile("level.dat")) { os.write(System.Text.UTF8Encoding.UTF8.GetBytes("Hello World")); os.close(); } if (m_bitmapScreenshots.Length > 0) { editor.addScreenshot(m_bitmapScreenshots[0]); } // Add optional tags: editor.addTag("space"); editor.addTag("king of the hill"); // Add optional metadata for your own display: editor.setMetadata("difficulty=4;theme=space;mode=koth"); OuyaUnityPlugin.saveOuyaMod(ouyaMod, editor); } } } else { Debug.LogError("OuyaContent is not initialized"); } } }