using DownloadCode = UnityEngine.Gonbest.MagicCube.DownloadCode;
namespace Thousandto.Update.Flow
{
///
/// 更新各流程的具体实现
/// 1. 解析local xml
/// 2. 下载和解析RemoteVersion
/// 3. 下载执行端
/// 4. 下载base基础资源
/// 5. 资源校验
/// 6. 下载补丁资源
///
public class CodeDefine
{
///
/// 磁盘空间满
///
public const int RET_FAIL_FULL_DISK = -18;
///
/// 中断操作,中断下载
///
public const int RET_SKIP_BY_ABORT = -17;
///
/// 资源转移失败,不完全
///
public const int RET_FAIL_TRANS_FAIL = -16;
///
/// 下载失败
///
public const int RET_FAIL_EXCEPTION_DOWNLOAD = -15;
///
/// 解析remoteVersion.xml失败
///
public const int RET_FAIL_PARSE_RES_XML_FILE = -14;
///
/// 保存LocalVersion.xml失败
///
public const int RET_FAIL_SAVE_LOCAL_XML_FILE = -13;
///
/// 解析LocalVersion.xml失败
///
public const int RET_FAIL_PARSE_LOCAL_XML_FILE = -12;
///
/// 释放base基础资源
///
public const int RET_FAIL_UNZIP_RES_FILE = -11;
///
/// 解析map文件失败
///
public const int RET_FAIL_PARSE_MAP_FILE = -10;
///
/// 对比资源md5失败
///
public const int RET_FAIL_RES_FILE_MD5_ERROR = -9;
///
/// 资源不存在
///
public const int RET_FAIL_RES_FILE_NOT_EXIST = -8;
///
/// LocalVersion.xml文件不存在
///
public const int RET_FAIL_LOCAL_XML_NOT_EXIST = -7;
///
/// map文件的MD5值不正确
///
public const int RET_FAIL_MAP_MD5_ERROR = -6;
///
/// 下载map文件失败
///
public const int RET_FAIL_DOWNLOAD_MAP_FILE = -5;
///
/// RemoteVersion.xml文件名字不正确
///
public const int RET_FAIL_RES_XML_PATH_ERROR = -4;
///
/// 下载RemoteVersion.xml失败
///
public const int RET_FAIL_DOWNLOAD_RES_XML = -3;
///
/// 下载LocalVersion.xml失败
///
public const int RET_FAIL_DOWNLOAD_LOCAL_XML = -2;
///
/// 默认失败
///
public const int RET_FAIL = -1;
///
/// 初始化
///
public const int RET_INIT = 0;
///
/// 操作成功
///
public const int RET_SUCCESS = 1;
///
/// 因为取消操作,跳过正常流程,后续流程不执行,游戏内要判断这个值,不让进入游戏
///
public const int RET_SKIP_BY_CANCEL = 2;
///
/// 因为下载执行端,跳过后续更新流程
///
public const int RET_SKIP_BY_DOWNLOAD_APP = 3;
///
/// 因为下载执行端,跳过后续更新流程
///
public const int RET_SKIP_BY_FORCE_TRANS_RESOURCE = 4;
///
/// 因为后台下载分段资源,跳过资源释放
///
public const int RET_SKIP_BY_BACKDOWNLOAD = 5;
///
/// enableDownload字段true为支持下载,false不支持
///
public const int RET_SKIP_BY_DISABLEDOWNLOAD = 5;
///
/// 已经存在
///
public const int RET_BACKDOWNLOAD_ALREADYEXIST = 1;
///
/// 后台更新,当个文件下载成功
///
public const int RET_BACKDOWNLOAD_SUCCESS = 0;
///
/// http下载失败,包括MD5校验失败
///
public const int RET_BACKDOWNLOAD_HTTPFAIL = -1;
///
/// 因暂停跳过
///
public const int RET_BACKDOWNLOAD_SKIPBYPAUSE = -2;
///
/// 无效请求,map中不存在这个文件
///
public const int RET_BACKDOWNLOAD_INVALIDFILE = -3;
///
/// 通过下载码转换为CodeDefine的数据
///
///
///
public static int FormDownloadCode(DownloadCode code)
{
switch (code)
{
case DownloadCode.RET_FAIL_FULL_DISK:
return CodeDefine.RET_FAIL_FULL_DISK;
case DownloadCode.RET_FAIL_EXCEPTION_DOWNLOAD:
return CodeDefine.RET_FAIL_EXCEPTION_DOWNLOAD;
case DownloadCode.RET_FAIL:
return CodeDefine.RET_FAIL;
case DownloadCode.RET_SKIP_BY_ABORT:
return CodeDefine.RET_SKIP_BY_ABORT;
case DownloadCode.RET_INIT:
return CodeDefine.RET_INIT;
case DownloadCode.RET_SUCCESS:
return CodeDefine.RET_SUCCESS;
}
return CodeDefine.RET_INIT;
}
}
}