Ejemplo n.º 1
0
        /// <summary>
        /// 播放CG视频
        /// </summary>
        /// <param name="spath"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="tips"></param>
        /// <param name="urldownloadingtips"></param>
        /// <param name="roate"></param>
        /// <param name="videoFinishedEvent"></param>
        /// <param name="evft"></param>
        public void playvideo(string spath, int width, int height, string tips, string urldownloadingtips, float roate, UnityAction videoFinishedEvent, eVideoFromType evft = eVideoFromType.eVFT_Local)
        {
            List <string> loadpath = new List <string>();

            if (evft == eVideoFromType.eVFT_Local)
            {
                _msCgpath = spath;
                loadpath.Add(_msCgpath);
            }
            else
            {
                _msCgURL = spath;
            }
            loadpath.Add(_msVideoObjectPath);
            string[] paths = loadpath.ToArray();
            _mOnFinishVideo = videoFinishedEvent;
            ResourceLoadManager.requestRes(paths, eLoadResPath.RP_Resources, (o, r) =>
            {
                if (r == eLoadedNotify.Load_Successfull)
                {
                    StartCoroutine(_playVideo(spath, width, height, tips, urldownloadingtips, roate, videoFinishedEvent, evft));
                }
                else if (r == eLoadedNotify.Load_NotTotleSuccessfull)
                {
                    DLoger.LogError(spath + "= load failed!");
                    _Finish();
                }
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Name"></param>
        public static void RemoveInstance(string Name)
        {
            if (m_Container != null && m_SingletonMap.ContainsKey(Name))
            {
                UnityEngine.Object.Destroy((UnityEngine.Object)(m_SingletonMap[Name]));
                m_SingletonMap.Remove(Name);

                DLoger.LogWarning("Singleton REMOVE! (" + Name + ")");
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 非泛型接口
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static Object getInstance(System.Type type)
 {
     if (m_Container == null)
     {
         m_Container      = new GameObject();
         m_Container.name = m_Name;
         m_Container.AddComponent(typeof(SingleMono));
     }
     if (!m_SingletonMap.ContainsKey(type.Name))
     {
         Component t = m_Container.AddComponent(type);
         if (t != null)
         {
             m_SingletonMap.Add(type.Name, t);
         }
         else
         {
             DLoger.LogWarning("Singleton Type ERROR! (" + type.Name + ")");
         }
     }
     return(m_SingletonMap[type.Name]);
 }
Ejemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static Object getInstance <T>() where T : MonoBehaviour
 {
     if (m_Container == null)
     {
         m_Container      = new GameObject();
         m_Container.name = m_Name;
         m_Container.AddComponent(typeof(SingleMono));
     }
     if (!m_SingletonMap.ContainsKey(typeof(T).Name))
     {
         T t = m_Container.AddComponent <T>();
         if (t != null)
         {
             m_SingletonMap.Add(typeof(T).Name, t);
         }
         else
         {
             DLoger.LogWarning("Singleton Type ERROR! (" + typeof(T).Name + ")");
         }
     }
     return(m_SingletonMap[typeof(T).Name]);
 }