コード例 #1
0
ファイル: hotMgr.cs プロジェクト: pureivan/XIL
        public static void Init(IResLoad resLoad = null)
        {
            if (appdomain != null)
            {
                return;
            }

#if UNITY_EDITOR
            DllInitByEditor.Release();
#endif
            if (resLoad == null)
            {
#if UNITY_EDITOR
                ResLoad.Set(new EditorResLoad());
#endif
            }
            else
            {
                ResLoad.Set(resLoad);
            }

            InitHotModule();

            refType = new RefType("hot.hotApp");
            refType.TryInvokeMethod("Init");

            AllTypes = new List <IType>();
            foreach (var ator in appdomain.LoadedTypes)
            {
                AllTypes.Add(ator.Value);
            }

            AutoReplace(AllTypes);
            InitByProperty(typeof(AutoInitAndRelease), "Init", AllTypes);
        }
コード例 #2
0
 public void AddListener(IResLoad listener)
 {
     if (mListeners == null)
     {
         mListeners = new List <IResLoad>();
     }
     if (!mListeners.Contains(listener))
     {
         mListeners.Add(listener);
     }
 }
コード例 #3
0
        public static void Init(IResLoad resLoad = null)
        {
            if (appdomain != null)
            {
                return;
            }

#if UNITY_EDITOR
            DllInitByEditor.Release();
#endif
            if (resLoad == null)
            {
#if UNITY_EDITOR
                ResLoad.Set(new EditorResLoad());
#endif
            }
            else
            {
                ResLoad.Set(resLoad);
            }

            InitHotModule();

#if HOT_DEBUG
            if (UnityEngine.Application.isPlaying)
            {
                System.Type debugger_type;
                if (IL.Help.TryGetTypeByFullName("hot.Debugger", out debugger_type))
                {
                    var    debugger = new RefType(true, debugger_type);
                    object port     = debugger.TryGetField("port");
                    if (port != null)
                    {
                        var ds = appdomain.DebugService;
                        ds.StartDebugService((int)port);
                        object vsWaitTimeoutTime = debugger.TryGetField("vsWaitTimeoutTime");
                        if (vsWaitTimeoutTime != null)
                        {
                            int wt = (int)vsWaitTimeoutTime;
                            if (wt > 0)
                            {
                                L.Log("vsWait begin!");
                                int count = 0;
                                while (!ds.IsDebuggerAttached)
                                {
                                    System.Threading.Thread.Sleep(1000);
                                    ++count;
                                    if (count >= wt)
                                    {
                                        L.Log("vsWait timeout!");
                                        break;
                                    }
                                }
                                L.Log("vsWait end!");
                            }
                        }
                    }
                }
            }
#endif
            refType = new RefType("hot.hotApp");
            refType.TryInvokeMethod("Init");

            AllTypes = new List <IType>();
            foreach (var ator in appdomain.LoadedTypes)
            {
                AllTypes.Add(ator.Value);
            }

            AutoReplace(AllTypes);
            InitByProperty(typeof(AutoInitAndRelease), "Init", AllTypes);
        }
コード例 #4
0
 public static void Set(IResLoad load)
 {
     current = load;
 }