public BaseConfig getSplitConfigSync(int type, string configName, int key) { int configResourceID = LoadControl.getResourceIDByNameAbs(getSplitConfigPath(configName, key)); byte[] bytes = (byte[])LoadControl.getResource(configResourceID); if (bytes == null) { return(null); } BytesReadStream stream = _tempStream; stream.setBuf(bytes); if (CommonSetting.configNeedCompress) { stream.unCompress(); } if (!stream.checkVersion(ShineGlobal.configVersion)) { Ctrl.errorLog("config结构版本不对"); return(null); } if (!checkSplitStream(stream)) { return(null); } BaseConfig bConfig = _useData.readBytesOneSplit(type, stream); return(bConfig); }
/** 卸载 */ public void unloadSplit(string configName, int key) { string path = ShineGlobal.configDirPath + "/" + configName + "/" + key + ".bin"; int configResourceID = LoadControl.getResourceIDByNameAbs(path); LoadControl.unloadOne(configResourceID); }
public void loadSplit(int type, string configName, int key, Action <BaseConfig> overFunc) { int configResourceID = LoadControl.getResourceIDByNameAbs(getSplitConfigPath(configName, key)); LoadControl.loadOne(configResourceID, () => { byte[] bytes = (byte[])LoadControl.getResource(configResourceID); BytesReadStream stream = _tempStream; stream.setBuf(bytes); if (CommonSetting.configNeedCompress) { stream.unCompress(); } if (!stream.checkVersion(ShineGlobal.configVersion)) { Ctrl.errorLog("config结构版本不对"); return; } if (!checkSplitStream(stream)) { return; } BaseConfig bConfig = _useData.readBytesOneSplit(type, stream); overFunc(bConfig); }); }