示例#1
0
        IEnumerator InitializeInternal()
        {
            initialized = true;
            Instance    = this;
            DontDestroyOnLoad(this);

            ThreadingBridge.Initialize();

            // for webgl we cannot use custom attributes to find classes, so we rely on a delegate to create the logic instance for us.

            Initialize();

            #if UNITY_WEBGL
            webGLHelper = this.AddComponentIfNotExists <WebGLPlatformHelper>();
            #endif

            gameOptions = this.AddComponentIfNotExists <GameOptions>();
            gameMusic   = this.AddComponentIfNotExists <GameMusic>();
            gameLoca    = this.AddComponentIfNotExists <GameLocalization>();
            gameLoca.Initialize();
            gameInput       = this.AddComponentIfNotExists <GameInput>();
            sceneTransition = this.AddComponentIfNotExists <SceneTransition>();



            objectPool = new ObjectPool();

            yield return(new WaitForEndOfFrame());

            GameSetupReady();
        }
示例#2
0
        public static void Dispatch(System.Action callback)
        {
            if (callback == null)
            {
                return;
            }

            ThreadingBridge.Dispatch(() => { callback(); });
        }
示例#3
0
 public static void CallThreadedFunction(Action action)
 {
     ThreadingBridge.ExecuteThreaded(() => {
         try
         {
             action();
         }catch (Exception e)
         {
             ThreadingHelper.Dispatch(() => {
                 throw e;
             });
         }
     });
 }
示例#4
0
 public static void QueueUserWorkItem(ThreadCallback callback)
 {
     ThreadingBridge.ExecuteThreaded(() => { callback(null); });
 }