private void HandlePatch() { GameEvent.SendEvent(GameEventType.GameFlow, GameFlow.PatchFileLocalLoad); localPatchFiles = new PatchFiles(); string localPatchFilesPath = PathUtil.LocalPatchFilesPath(); if (File.Exists(localPatchFilesPath)) { GLog.Log("localPatchFilesPath " + localPatchFilesPath); HttpManager.Instance.LoadText(localPatchFilesPath, (res) => { localPatchFiles.Load(res); LoadRemotePatchFiles(); }); } else { string streamingPatchFilesPath = PathUtil.StreamingPatchFilesPath(); if (File.Exists(streamingPatchFilesPath)) { GLog.Log("localPatchFilesPath " + streamingPatchFilesPath); HttpManager.Instance.LoadText(streamingPatchFilesPath, (res) => { File.WriteAllText(localPatchFilesPath, res); localPatchFiles.Load(res); LoadRemotePatchFiles(); }); } else { GLog.Error(string.Format("{0} is not find", streamingPatchFilesPath), true); } } }
private void LoadRemotePatchFiles() { GameEvent.SendEvent(GameEventType.GameFlow, GameFlow.PatchFileRemoteLoad); remotePatchFiles = new PatchFiles(); string remotePatchFilesPath = PathUtil.RemotePatchFilesPath(); GLog.Log("remotePatchFilesPath " + remotePatchFilesPath); if (File.Exists(remotePatchFilesPath)) { HttpManager.Instance.LoadText(remotePatchFilesPath, (res) => { remotePatchFiles.Load(res); CompareLocalAndRemotePatchFiles(); }); } else { GLog.Error(string.Format("{0} is null", remotePatchFilesPath), true); } }