public static UpdateTextInfo GetUpdateTextInfo() { UpdateTextInfo Info = new UpdateTextInfo(); Info[ErrorCode.Ok.ToString()] = "成功"; Info[ErrorCode.GetResVersionInfoFailed.ToString()] = "获取版本信息失败"; Info[ErrorCode.DownloadResInfoFailed.ToString()] = "下载版本信息失败"; Info[ErrorCode.GetResPatchInfoListFailed.ToString()] = "获取更新列表失败"; Info[ErrorCode.DownloadResFailed.ToString()] = "下载补丁包失败"; Info[ErrorCode.CopyResInfoToDocFailed.ToString()] = "解压缩补丁包失败"; Info[StageProgressID.Idle.ToString()] = "空闲"; Info[StageProgressID.Error.ToString()] = "错误"; Info[StageProgressID.GetResVersionBegin.ToString()] = "开始获取版本信息"; Info[StageProgressID.GetResVersionEnd.ToString()] = "获取版本信息结束"; Info[StageProgressID.DownloadResInfoBegin.ToString()] = "开始下载版本信息"; Info[StageProgressID.DownloadResInfoEnd.ToString()] = "下载版本信息结束"; Info[StageProgressID.CheckResVersionBegin.ToString()] = "开始检查版本号"; Info[StageProgressID.CheckResVersionEnd.ToString()] = "检查版本号结束"; Info[StageProgressID.DownloadResBegin.ToString()] = "开始下载补丁包"; Info[StageProgressID.DownloadResEnd.ToString()] = "下载补丁包结束"; Info[StageProgressID.CopyResInfoToDocBegin.ToString()] = "开始解压缩补丁包"; Info[StageProgressID.CopyResInfoToDocEnd.ToString()] = "解压缩补丁包结束"; Info[StageProgressID.Done.ToString()] = "更新完成"; return Info; }
public UpdateUI() { ProgressID_ = StageProgressID.Idle; TextInfo_ = UpdateTool.GetUpdateTextInfo(); UIRoot_ = UnityEngine.Object.Instantiate(Resources.Load <GameObject>("UpdateUI")); UIRoot_.transform.SetParent(GameObject.Find("Canvas-Normal").transform); RectTransform Rect = UIRoot_.GetComponent <RectTransform>(); Rect.localPosition = Vector3.zero; Rect.localRotation = Quaternion.identity; Rect.localScale = Vector3.one; Rect.sizeDelta = Vector2.zero; ProgressBar_ = UIHelper.GetComponent <Scrollbar>(UIRoot_.transform, "ProgressBar"); LabelProgress_ = UIHelper.GetComponent <Text>(UIRoot_.transform, "LabelProgress"); LabelContent_ = UIHelper.GetComponent <Text>(UIRoot_.transform, "LabelContent"); ProgressBar_.value = 0; LabelProgress_.text = string.Empty; LabelContent_.text = string.Empty; Updater_ = new Updater(); }