// set load and save callbacks in the LE_ExtensionInterface (these callbacks can be overwritten by MRLE extensions bought in the Asset Store) public static void Init() { LE_ExtensionInterface.Load.SetDelegate(1, (object p_sender, System.Action <byte[][]> p_onLoadedCallback, bool p_isReload) => { // show a loading message if (uMyGUI_PopupManager.Instance != null) { uMyGUI_PopupManager.Instance.ShowPopup(uMyGUI_PopupManager.POPUP_LOADING); } // try load level ((MonoBehaviour)p_sender).StartCoroutine(ExampleGame_LoadSave.LoadRoutineByFileName(LEVEL_FILE_NAME, p_onLoadedCallback)); }); LE_ExtensionInterface.Save.SetDelegate(1, (object p_sender, byte[] p_levelData, byte[] p_levelMeta, int p_removedDuplicatesCount) => { // save to file string popupText = ExampleGame_LoadSave.SaveByFileName(LEVEL_FILE_NAME, p_levelData, p_levelMeta); if (uMyGUI_PopupManager.Instance != null) { if (p_removedDuplicatesCount > 0) { popupText += "\n'" + p_removedDuplicatesCount + "' duplicate object(s) removed before saving\n(duplicate = same: object, position, rotation, scale)."; } ((uMyGUI_PopupText)uMyGUI_PopupManager.Instance.ShowPopup(uMyGUI_PopupManager.POPUP_TEXT)).SetText("Level Saved", popupText).ShowButton("ok"); } }); }
// save the level and show the info dialog public void Save(LE_SaveEvent p_args) { // save to file string popupText = ExampleGame_LoadSave.SaveByFileName(LEVEL_FILE_NAME, p_args.SavedLevelData, p_args.SavedLevelMeta); if (p_args.RemovedDuplicatesCount > 0) { popupText += "\n'" + p_args.RemovedDuplicatesCount + "' duplicate object(s) removed before saving\n(duplicate = same: object, position, rotation, scale)."; } ((uMyGUI_PopupText)uMyGUI_PopupManager.Instance.ShowPopup(uMyGUI_PopupManager.POPUP_TEXT)).SetText("Level Saved", popupText).ShowButton("ok"); }