/** 连接游戏服成功 */ public void connectGameSuccess() { if (!_running) { return; } _connectGaming.unlock(); Ctrl.debugLog("连接game成功"); if (_isSwitching) { _isSwitching = false; PlayerSwitchGameRequest.create(_gameInfo.token).send(); } else { //可以停了 _httpLoginAffair.stop(); VersionSaveData versionSaveData = ResourceInfoControl.getVersion(); int resourceVersion = versionSaveData != null ? versionSaveData.resourceVersion : 100000; LoginGameRequest.create(_gameInfo.token, CodeCheckRecord.msgDataVersion, BaseC.config.getMsgDataVersion(), resourceVersion).send(); } }
public virtual void makeClientLoginData(ClientLoginData data) { //游客 if (platform == PlatformType.Visitor) { uid = getVisitorUID(); } data.uid = uid; data.countryID = countryID; data.platform = platform; data.clientPlatformType = SystemControl.clientPlatform; data.deviceType = SystemInfo.deviceType.ToString(); data.deviceUniqueIdentifier = SystemInfo.deviceUniqueIdentifier; data.visitorUID = ""; VersionSaveData localVersionData = ResourceInfoControl.getVersion(); data.appVersion = localVersionData.appVersion; data.resourceVersion = localVersionData.resourceVersion; ClientLoginCacheData loginCacheData = GameC.save.loadLoginCache(); //游客平台,为自动绑定 if (loginCacheData != null && loginCacheData.platform == PlatformType.Visitor && data.platform != PlatformType.Visitor) { data.visitorUID = loginCacheData.uid; } }
protected virtual void doSendGetVersion() { //本地版本数据 VersionSaveData localVersionData = ResourceInfoControl.getVersion(); //发送当前的本地版本 ClientGetVersionHttpRequest.create(SystemControl.clientPlatform, localVersionData.resourceVersion).send(); }
private void hotfixNext(ClientVersionData vData) { //读取cdn版本 ResourceInfoControl.loadCDNVersion(vData.currentResourceVersion, sData => { //计算更新量 ResourceInfoControl.countNewVersionSize(sData, _versionRe); //只有配置 if (_versionRe.isOnlyConfig) { ResourceInfoControl.mergeVersion(sData); doVersionNext(false, () => { if (GameC.main != null) { //热更配置 GameC.main.reloadConfig(); GameC.main.hotfixOver(); } }); } //返回登录界面开始热更 else { VersionSaveData localVersionData = ResourceInfoControl.getVersion(); _downloadSize = StringUtils.toMBString(_versionRe.size); //需要强制更新 if (localVersionData.resourceVersion < vData.leastResourceVersion) { //更新资源选择,这里是在游戏内,必须弹窗确认 showAlert(Alert_GetNewResourceMust, () => { doHotFix(sData); }, exitGame); } else { //更新资源选择,这里是在游戏内,必须弹窗确认 showAlert(Alert_GetNewResource, () => { doHotFix(sData); }, () => { if (GameC.main != null) { GameC.main.hotfixOver(); } }); } } }); }
/** 客户端版本更新(true:为不需要更新) */ public bool clientHotfix(ClientVersionData vData) { if (ShineSetting.debugJumpResourceVersion || ShineSetting.localLoadWithOutBundle) { return(true); } //已处理过 if (_versionData != null && vData != null && _versionData.currentResourceVersion >= vData.currentResourceVersion) { return(true); } VersionSaveData localVersionData = ResourceInfoControl.getVersion(); if (vData == null) { Ctrl.log("离线游戏 或 服务器无此版本2"); vData = new ClientVersionData(); vData.version = localVersionData.version; vData.currentAppVersion = localVersionData.appVersion; // _versionData.leastAppVersion=localVersionData.currentAppVersion; vData.currentResourceVersion = localVersionData.resourceVersion; } _versionData = vData; if (!ShineSetting.isRelease) { return(true); } else { //最低app版本不足 if (localVersionData.appVersion < _versionData.leastAppVersion) { showAlert(Alert_GetNewAppMust, toGetNewApp, exitGame); return(false); } //有新的app if (localVersionData.appVersion < _versionData.currentAppVersion) { showAlert(Alert_GetNewApp, toGetNewApp, () => { hotfixNext(vData); }); return(false); } hotfixNext(vData); return(false); } }
protected virtual void stepLoadResource() { if (ShineSetting.debugJumpResourceVersion || ShineSetting.localLoadWithOutBundle) { versionUpdateOver(); return; } //本地版本数据 VersionSaveData localVersionData = ResourceInfoControl.getVersion(); //离线游戏 或 服务器无此版本 if (_versionData == null) { Ctrl.log("离线游戏 或 服务器无此版本"); _versionData = new ClientVersionData(); _versionData.version = localVersionData.version; _versionData.currentAppVersion = localVersionData.appVersion; // _versionData.leastAppVersion=localVersionData.currentAppVersion; _versionData.currentResourceVersion = localVersionData.resourceVersion; // _versionData.leastResourceVersion=localVersionData.leastResourceVersion; doVersionNext(true); return; } //最低app版本不足 if (localVersionData.appVersion < _versionData.leastAppVersion && ShineSetting.isRelease) { showAlert(Alert_GetNewAppMust, toGetNewApp, exitGame); return; } //有新的app if (localVersionData.appVersion < _versionData.currentAppVersion && ShineSetting.isRelease) { showAlert(Alert_GetNewApp, toGetNewApp, () => { continueCurrentApp(localVersionData); }); return; } continueCurrentApp(localVersionData); }