/** 写回 */ public void write() { Ctrl.print("保存场景", config.id); if (_stream == null) { _stream = new BytesWriteStream(); } else { _stream.clear(); } _stream.writeLen(elements.size()); foreach (int k in elements.getSortedKeyList()) { ScenePlaceElementConfig scenePlaceElementConfig = elements.get(k).config; scenePlaceElementConfig.writeBytesSimple(_stream); } string path = SceneEditorWindow.getScenePlaceFilePath(config.id); FileUtils.writeFileForBytesWriteStream(path, _stream); }
/** 写出版本 */ private void writeVersion() { VersionSaveData versionSaveData = _newVersion.createOriginalData(); BytesWriteStream stream = new BytesWriteStream(); stream.writeVersion(ShineGlobal.versionInfoVersion); versionSaveData.writeBytes(stream); FileUtils.writeFileForBytesWriteStream(getTargetSourcePath() + "/" + ShineGlobal.versionInfoPath, stream); // XML vXml=new XML(); // vXml.name="info"; // vXml.setProperty("version",ShineToolSetting.bundlePackVersion); // FileUtils.writeFileForXML(ShineToolGlobal.clientBundleRecordPath,vXml); //发布包 if (_isReleasePack) { EditorPrefs.SetString("AssetBundleWindow_version", _newVersion.version); stream.clear(); stream.writeVersion(ShineGlobal.versionInfoVersion); _newVersion.writeBytes(stream); FileUtils.writeFileForBytesWriteStream(getTargetSavePath() + "/" + ShineGlobal.versionInfoPath, stream); VersionRecordData recordData = _newVersion.createRecordData(); XML xml = recordData.writeXML(); FileUtils.writeFileForXML(getTargetSavePath() + "/" + "versionRecord.xml", xml); Ctrl.print("已覆盖原记录,当前版本为:", _newVersion.version); } }
/** 保存一次 */ public void saveOnce() { if (!_playerLoaded) { return; } //初始化过的 if (GameC.player.system.inited()) { string path = _playerSavePath; PlayerListData data = GameC.player.createListData(); GameC.player.writeListData(data); BaseData exData = _offLineExData?.clone(); ThreadControl.addAssistFunc(() => { _stream.clear(); _stream.writeInt(BaseC.config.getDBDataVersion()); data.writeBytesFull(_stream); _offlineWorkListData.writeBytesFull(_stream); exData?.writeBytesFull(_stream); FileUtils.writeFileForBytesWriteStream(path, _stream); }); } }
private void doSave(KeepSaveData data) { _stream.clear(); _stream.writeVersion(ShineGlobal.localSaveVersion); data.writeBytesFull(_stream); FileUtils.writeFileForBytes(_localSavePath, _stream); }
private static void callNative(NavMeshConfig config, SceneRecastData data, int currentMapID) { BytesWriteStream stream = new BytesWriteStream(); stream.setUseBitBoolean(false); config.write(stream); string cStr = ShineToolGlobal.mapInfoPath + "/navConfig.bin"; string dStr = SceneEditorWindow.getMapFilePathFront(currentMapID) + "_navData.bin"; string objStr = SceneEditorWindow.getMapFilePathFront(currentMapID) + "_navData.obj"; FileUtils.writeFileForBytesWriteStream(cStr, stream); stream.clear(); data.write(stream); FileUtils.writeFileForBytesWriteStream(dStr, stream); if (_needObjFile) { StringBuilder sb = new StringBuilder(); foreach (Vector3 vec in data.vertices) { sb.Append('v'); sb.Append(' '); sb.Append(vec.x); sb.Append(' '); sb.Append(vec.y); sb.Append(' '); sb.Append(vec.z); sb.Append('\n'); } int[] navIndices = data.triangles.getValues(); int len = data.triangles.size() / 3; for (int i = 0; i < len; i++) { sb.Append('f'); sb.Append(' '); sb.Append(navIndices[i * 3] + 1); sb.Append(' '); sb.Append(navIndices[i * 3 + 1] + 1); sb.Append(' '); sb.Append(navIndices[i * 3 + 2] + 1); sb.Append('\n'); } FileUtils.writeFileForUTF(objStr, sb.ToString()); } Ctrl.print("callJar"); ToolFileUtils.executeServerTool("exportNav", currentMapID.ToString()); Ctrl.print("OK"); }
private void doWrite() { ClientPlayerLocalCacheData data = GameC.factory.createClientPlayerLocalCacheData(); data.copy(_data); //缓存一手 string path = _savePath; ThreadControl.addIOFunc(() => { _stream.clear(); _stream.writeVersion(ShineGlobal.playerSaveVersion); data.writeBytesFull(_stream); FileUtils.writeFileForBytes(path, _stream); }); }