Ejemplo n.º 1
0
        private void LoadUIForm(UIConfigData uiInfo, string uiFormName)
        {
            Transform parent = null;

            switch ((UIFormDepth)uiInfo.UIFormsDepth)
            {
            case UIFormDepth.Normal: parent = traNormal; break;

            case UIFormDepth.Fixed: parent = traFixed; break;

            case UIFormDepth.PopUp: parent = traPopUp; break;

            case UIFormDepth.Notice: parent = traNotice; break;
            }

            UIParam uiParam = new UIParam();

            uiParam.UIFormsDepth    = (UIFormDepth)uiInfo.UIFormsDepth;
            uiParam.UIFormsShowMode = (UIFormShowMode)uiInfo.UIFormShowMode;

            if ((LoadType)uiInfo.LandType == LoadType.Resources)
            {
                GameObject prefab = ResoucesMgr.Instance.Load <GameObject>(uiInfo.ResourcesPath, false);
                LoadUIFormFinish(uiFormName, prefab, parent, uiParam);
            }
            else if ((LoadType)uiInfo.LandType == LoadType.AssetBundle)
            {
                AbParam abParam = new AbParam();
                abParam.SceneName = "UI";
                abParam.AbName    = uiInfo.AssetBundlePath;
                abParam.AssetName = uiInfo.AssetName;
                AssetManager.Instance.LoadAsset(abParam, (error, asset) =>
                {
                    if (string.IsNullOrEmpty(error))
                    {
                        LoadUIFormFinish(uiFormName, asset as GameObject, parent, uiParam);
                    }
                    else
                    {
                        LoadUIFormFinish(uiFormName, null, parent, uiParam);
                    }
                });
            }
        }
Ejemplo n.º 2
0
        private void Load(AudioConfigData audioData)
        {
            LoadType loadType = (LoadType)audioData.LandType;

            if (loadType == LoadType.Resources)
            {
                AudioClip audioClip = ResoucesMgr.Instance.Load <AudioClip>(audioData.ResourcesPath, false);
                if (audioClip != null)
                {
                    LoadFinish(audioData.Name, audioClip);
                }
                else
                {
                    Debug.LogError(GetType() + "/Load()/ load audio error! audioName:" + audioData.Name);
                    ChangeState(audioData.Name, AudioState.Error);
                }
            }
            else if (loadType == LoadType.AssetBundle)
            {
                AbParam abParam = new AbParam();
                abParam.SceneName = audioData.SceneName;
                abParam.AbName    = audioData.AssetBundlePath;
                abParam.AssetName = audioData.AssetName;

                AssetManager.Instance.LoadAsset(abParam, (error, asset) =>
                {
                    if (string.IsNullOrEmpty(error))
                    {
                        LoadFinish(audioData.Name, asset as AudioClip);
                    }
                    else
                    {
                        Debug.LogError(GetType() + "/Load()/ load audio error! audioName:" + audioData.Name);
                        ChangeState(audioData.Name, AudioState.Error);
                    }
                });
            }
        }