private void Handle_Completed(AssetOperationHandle obj) { if (obj.AssetObject == null) { return; } _uiRoot = obj.InstantiateObject; _manifest = _uiRoot.GetComponent <UIManifest>(); _slider = _manifest.GetUIComponent <Slider>("PatchWindow/UIWindow/Slider"); _tips = _manifest.GetUIComponent <Text>("PatchWindow/UIWindow/Slider/txt_tips"); _messageBoxObj = _manifest.GetUIElement("PatchWindow/UIWindow/MessgeBox").gameObject; _messageBoxObj.SetActive(false); _eventGroup.AddListener <PatchEventMessageDefine.PatchStatesChange>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.FoundForceInstallAPP>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.FoundUpdateFiles>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.DownloadFilesProgress>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.GameVersionRequestFailed>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.WebPatchManifestDownloadFailed>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.WebFileDownloadFailed>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.WebFileCheckFailed>(OnHandleEvent); SendOperationEvent(EPatchOperation.BeginingRequestGameVersion); }
/// <summary> /// 异步初始化 /// </summary> /// <returns></returns> public IEnumerator InitializeAsync() { // 下载面板 string location = "UIPanel/PatchWindow"; _handle = ResourceManager.Instance.LoadAssetAsync <GameObject>(location); yield return(_handle); if (_handle.AssetObject == null) { throw new Exception("PatchWindow load failed."); } _uiRoot = _handle.InstantiateObject; _manifest = _uiRoot.GetComponent <UIManifest>(); _slider = _manifest.GetUIComponent <Slider>("PatchWindow/UIWindow/Slider"); _tips = _manifest.GetUIComponent <Text>("PatchWindow/UIWindow/Slider/txt_tips"); _tips.text = "正在准备游戏世界......"; _messageBoxObj = _manifest.GetUIElement("PatchWindow/UIWindow/MessgeBox").gameObject; _messageBoxObj.SetActive(false); _eventGroup.AddListener <PatchEventMessageDefine.PatchStatesChange>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.FoundForceInstallAPP>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.FoundUpdateFiles>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.DownloadFilesProgress>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.GameVersionRequestFailed>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.WebPatchManifestDownloadFailed>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.WebFileDownloadFailed>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.WebFileCheckFailed>(OnHandleEvent); }
/// <summary> /// 获取窗口里缓存的组件对象 /// </summary> /// <typeparam name="T">组件类型</typeparam> /// <param name="path">组件路径</param> protected T GetUIComponent <T>(string path) where T : UnityEngine.Component { if (_manifest == null) { return(null); } return(_manifest.GetUIComponent <T>(path)); }
/// <summary> /// 初始化 /// </summary> public void Initialize() { var prefab = Resources.Load <GameObject>("PatchWindow"); _uiRoot = GameObject.Instantiate(prefab); _manifest = _uiRoot.GetComponent <UIManifest>(); _slider = _manifest.GetUIComponent <Slider>("PatchWindow/UIWindow/Slider"); _tips = _manifest.GetUIComponent <Text>("PatchWindow/UIWindow/Slider/txt_tips"); _tips.text = "正在准备游戏世界......"; _messageBoxYesObj = _manifest.GetUIElement("PatchWindow/UIWindow/MessgeBox").gameObject; _messageBoxYesObj.SetActive(false); _eventGroup.AddListener <PatchEventMessageDefine.PatchStatesChange>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.FoundNewApp>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.FoundUpdateFiles>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.DownloadProgressUpdate>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.GameVersionRequestFailed>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.GameVersionParseFailed>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.PatchManifestRequestFailed>(OnHandleEvent); _eventGroup.AddListener <PatchEventMessageDefine.WebFileDownloadFailed>(OnHandleEvent); }