Exemplo n.º 1
0
        private void LoadUIFormSuccessCallback(string uiFormAssetName, object uiFormAsset, float duration, object userData)
        {
            OpenUIFormInfo openUIFormInfo = (OpenUIFormInfo)userData;

            if (openUIFormInfo == null)
            {
                Debug.LogError("打开界面的信息为空");
                return;
            }

            m_UIFormsBeingLoaded.Remove(openUIFormInfo.SerialId);
            m_UIFormAssetNamesBeingLoaded.Remove(uiFormAssetName);

            if (m_UIFormsToReleaseOnLoad.Contains(openUIFormInfo.SerialId))
            {
                Debug.LogError(string.Format("需要释放的界面:{0} 加载成功", openUIFormInfo.SerialId.ToString()));
                m_UIFormsToReleaseOnLoad.Remove(openUIFormInfo.SerialId);
                m_UIFormHelper.ReleaseUIForm(uiFormAsset, null);
                return;
            }

            //实例化界面,并将界面实例对象放入对象池
            UIFormInstanceObject uiFormInstanceObject = new UIFormInstanceObject(uiFormAssetName, uiFormAsset, m_UIFormHelper.InstantiateUIForm(uiFormAsset), m_UIFormHelper);

            m_InstancePool.Register(uiFormInstanceObject, true);

            //打开界面
            OpenUIForm(openUIFormInfo.SerialId, uiFormAssetName, openUIFormInfo.UIGroup, uiFormInstanceObject.Target, openUIFormInfo.PauseCoveredUIForm, true, duration, openUIFormInfo.UserData);
        }
Exemplo n.º 2
0
        private void LoadUIFormDependencyAssetCallback(string uiFormAssetName, string dependencyAssetName, int loadedCount, int totalCount, object userData)
        {
            OpenUIFormInfo openUIFormInfo = (OpenUIFormInfo)userData;

            if (openUIFormInfo == null)
            {
                Debug.LogError("打开界面的信息为空");
                return;
            }

            //派发打开界面时加载依赖资源事件
            OpenUIFormDependencyAssetEventArgs e = ReferencePool.Acquire <OpenUIFormDependencyAssetEventArgs>();

            m_EventManager.Fire(this, e.Fill(openUIFormInfo.SerialId, uiFormAssetName, openUIFormInfo.UIGroup.Name, openUIFormInfo.PauseCoveredUIForm, userData, dependencyAssetName, loadedCount, totalCount));
        }
Exemplo n.º 3
0
        private void LoadUIFormUpdateCallback(string uiFormAssetName, float progress, object userData)
        {
            OpenUIFormInfo openUIFormInfo = (OpenUIFormInfo)userData;

            if (openUIFormInfo == null)
            {
                Debug.LogError("打开界面的信息为空");
                return;
            }

            //派发打开界面更新事件
            OpenUIFormUpdateEventArgs e = ReferencePool.Acquire <OpenUIFormUpdateEventArgs>();

            m_EventManager.Fire(this, e.Fill(openUIFormInfo.SerialId, uiFormAssetName, openUIFormInfo.UIGroup.Name, openUIFormInfo.PauseCoveredUIForm, userData, progress));
        }
Exemplo n.º 4
0
        private void LoadUIFormFailureCallback(string uiFormAssetName, LoadResourceStatus status, string errorMessage, object userData)
        {
            OpenUIFormInfo openUIFormInfo = (OpenUIFormInfo)userData;

            if (openUIFormInfo == null)
            {
                Debug.LogError("打开界面的信息为空");
                return;
            }

            m_UIFormsBeingLoaded.Remove(openUIFormInfo.SerialId);
            m_UIFormAssetNamesBeingLoaded.Remove(uiFormAssetName);
            m_UIFormsToReleaseOnLoad.Remove(openUIFormInfo.SerialId);

            string message = string.Format("打开界面:{0} 失败,错误信息:{1}", uiFormAssetName, errorMessage);

            //派发打开界面失败事件
            OpenUIFormFailureEventArgs e = ReferencePool.Acquire <OpenUIFormFailureEventArgs>();

            m_EventManager.Fire(this, e.Fill(openUIFormInfo.SerialId, uiFormAssetName, openUIFormInfo.UIGroup.Name, openUIFormInfo.PauseCoveredUIForm, userData, message));
        }