Exemplo n.º 1
1
        public GameLoader(string fileName, Assembly [] preloads, Action<string> die)
        {
            Game = new Game(this, die);
            string extention = null;
            try
            {
                extention = fileName.Substring(fileName.LastIndexOf('.'));
            }
            catch (Exception)
            {
                die("File " + fileName + " could Not be loaded");
                return;
            }

            if (".kgl" == extention)
            {
                loaderUtility = new KGLLoaderUtility(fileName, this);
            }
            else
            {
                die("File " + fileName + " could Not be loaded");
            }

            foreach (Assembly loaded in preloads)
            {
                string name = Path.GetFileName(loaded.Location);
                if (!LoadedFiles.ContainsKey(name))
                {
                    LoadedFiles.Add(name, loaded);
                    ClassFactory.LoadServicesAndManagers(loaded);
                }
            }
        }
Exemplo n.º 2
0
 internal LoadedScene(string name, PropertyHolder values, SceneLoader loader, Game game, LoaderUtility loaderUtil)
     : base(values, loaderUtil)
 {
     Loader = loader;
     Game = game;
     Name = name;
 }
Exemplo n.º 3
0
        internal SceneLoader(string sceneName, object scene, LoaderUtility loaderUtility, GameLoader gameLoader)
        {
            GameLoader = gameLoader;
            Game = GameLoader.Game;
            this.loaderUtility = loaderUtility;

            PropertyHolder sceneValues = loaderUtility.GetProperties(scene);

            LoadedScene = new LoadedScene(sceneName, sceneValues, this, gameLoader.Game, loaderUtility);

            IEnumerable<object> managers = loaderUtility.GetOfType(scene, loaderUtility.ManagerType);

            foreach (object manager in managers)
            {
                PropertyHolder managerValues = loaderUtility.GetProperties(manager);
                string type = loaderUtility.GetType(manager);
                LoadedManager lm = LoadedManager.GetLoadedManager(type, LoadedScene, managerValues, loaderUtility);
                LoadedScene.addLoadedManager(lm);
            }

            IEnumerable<object> entities = loaderUtility.GetOfType(scene, loaderUtility.EntityType);

            foreach (object entity in entities)
            {
                string name = loaderUtility.GetName(entity);
                if (ClassFactory.isRegistered(name)) Game.CurrentGame.Die("The name " + name + " can't be both defined and used for an entity");
                LoadedEntity loadedEntity = gameLoader.entityParse(entity, name, onid++);
                LoadedScene.addLoadedEntity(loadedEntity);
            }
        }
Exemplo n.º 4
0
 internal LoadedAssignment(object target, object type, object value, LoaderUtility loader)
     : base(null, loader)
 {
     Target = target;
     Value = value;
     Type = type;
     Loader = loader;
 }
Exemplo n.º 5
0
    private void Awake()
    {
        XRGeneralSettings.Instance.Manager.InitializeLoaderSync();

        if (XRGeneralSettings.Instance.Manager.activeLoader == null)
        {
            Debug.LogError("Initializing XR Failed. Check Editor or Player log for details.");
        }
        else
        {
            XRGeneralSettings.Instance.Manager.StartSubsystems();
            LoaderUtility.Initialize();
            SceneManager.LoadScene("Lidar Feed", LoadSceneMode.Single);
        }
    }
Exemplo n.º 6
0
        void OnDestroy()
        {
            if (IsTakeOver)
            {
                takeOverPosition_ = transform.position;
                takeOverRotation_ = transform.rotation;
            }
            else
            {
#if DOWNLOADED_ARFOUNDATION
                LoaderUtility.Deinitialize();
                LoaderUtility.Initialize();
#endif
            }
        }
Exemplo n.º 7
0
        internal LoadedEntity(string name, PropertyHolder values, int id, IEnumerable<string> prototypes, LoaderUtility loaderUtil)
            : base(values, loaderUtil)
        {
            Name = name;
            this.id = id;
            foreach (string prototype in prototypes)
            {
                isExactType.Add(prototype);
                isType.Add(prototype);
                isType.AddRange(Prototypes[prototype].isType);
            }

            //it is a prototype
            #if !TEST
            if(name != null && Prototypes.ContainsKey(name)) Game.CurrentGame.Die("The prototype " + name + " was already defined");
            #endif
            if (id < 0) Prototypes[name] = this;
        }
    public void LoadITSYScene(GameObject chosenEpisode)
    {
        session = GameObject.Find("AR Session");

        if (session != null)
        {
            var sessionScript = session.GetComponent <ARSession>();
            sessionScript.Reset();
        }

        if (chosenEpisode != null)
        {
            episode = chosenEpisode;
        }

        LoaderUtility.Initialize();
        SceneManager.LoadScene("ITSY", LoadSceneMode.Single);
    }
Exemplo n.º 9
0
        internal static LoadedManager GetLoadedManager(string type, LoadedScene ls, PropertyHolder values, LoaderUtility loaderUtil)
        {
            Dictionary<string, LoadedManager> managersByName;

            if(!ManagerMap.TryGetValue(ls, out managersByName))
            {
                ManagerMap[ls] =  managersByName = new Dictionary<string, LoadedManager>();
            }

            LoadedManager loadedManager;
            if (!managersByName.TryGetValue(type, out loadedManager))
            {
                loadedManager = new LoadedManager(type, values, loaderUtil);
                managersByName[type] = loadedManager;
            }
            else
            {
                if (values != null) loadedManager.Values.AddRange(values);
            }
            return loadedManager;
        }
 public void LoadMenu()
 {
     ARSelectScript.shownEpisode = true;
     LoaderUtility.Initialize();
     SceneManager.LoadScene("Menu", LoadSceneMode.Single);
 }
Exemplo n.º 11
0
 void OnSceneUnloaded(Scene current)
 {
     LoaderUtility.Deinitialize();
     LoaderUtility.Initialize();
 }
Exemplo n.º 12
0
 public void BackButtonPressed()
 {
     SceneManager.LoadScene("Menu", LoadSceneMode.Single);
     LoaderUtility.Deinitialize();
 }
Exemplo n.º 13
0
 protected LoadedBaseAction(PropertyHolder values, LoaderUtility loaderUtil)
     : base(values, loaderUtil)
 {
 }
Exemplo n.º 14
0
 internal LoadedAction(string type, PropertyHolder values, LoaderUtility loaderUtil)
     : base(values, loaderUtil)
 {
     this.type = type;
 }
Exemplo n.º 15
0
        // Start is called before the first frame update
        void Start()
        {
            var activeLoader = LoaderUtility.GetActiveLoader();

            var planeDescriptors = new List <XRPlaneSubsystemDescriptor>();

            SubsystemManager.GetSubsystemDescriptors <XRPlaneSubsystemDescriptor>(planeDescriptors);

            var rayCastDescriptors = new List <XRRaycastSubsystemDescriptor>();

            SubsystemManager.GetSubsystemDescriptors <XRRaycastSubsystemDescriptor>(rayCastDescriptors);

            var faceDescriptors = new List <XRFaceSubsystemDescriptor>();

            SubsystemManager.GetSubsystemDescriptors <XRFaceSubsystemDescriptor>(faceDescriptors);

            var imageDescriptors = new List <XRImageTrackingSubsystemDescriptor>();

            SubsystemManager.GetSubsystemDescriptors <XRImageTrackingSubsystemDescriptor>(imageDescriptors);

            var envDescriptors = new List <XREnvironmentProbeSubsystemDescriptor>();

            SubsystemManager.GetSubsystemDescriptors <XREnvironmentProbeSubsystemDescriptor>(envDescriptors);

            var anchorDescriptors = new List <XRAnchorSubsystemDescriptor>();

            SubsystemManager.GetSubsystemDescriptors <XRAnchorSubsystemDescriptor>(anchorDescriptors);

            var objectDescriptors = new List <XRObjectTrackingSubsystemDescriptor>();

            SubsystemManager.GetSubsystemDescriptors <XRObjectTrackingSubsystemDescriptor>(objectDescriptors);

            var participantDescriptors = new List <XRParticipantSubsystemDescriptor>();

            SubsystemManager.GetSubsystemDescriptors <XRParticipantSubsystemDescriptor>(participantDescriptors);

            var depthDescriptors = new List <XRDepthSubsystemDescriptor>();

            SubsystemManager.GetSubsystemDescriptors <XRDepthSubsystemDescriptor>(depthDescriptors);

            var occlusionDescriptors = new List <XROcclusionSubsystemDescriptor>();

            SubsystemManager.GetSubsystemDescriptors <XROcclusionSubsystemDescriptor>(occlusionDescriptors);

            var cameraDescriptors = new List <XRCameraSubsystemDescriptor>();

            SubsystemManager.GetSubsystemDescriptors <XRCameraSubsystemDescriptor>(cameraDescriptors);

            var sessionDescriptors = new List <XRSessionSubsystemDescriptor>();

            SubsystemManager.GetSubsystemDescriptors <XRSessionSubsystemDescriptor>(sessionDescriptors);

            if (planeDescriptors.Count > 0 && rayCastDescriptors.Count > 0)
            {
                m_SimpleAR.interactable     = true;
                m_Scale.interactable        = true;
                m_Interaction.interactable  = true;
                m_SampleUX.interactable     = true;
                m_CheckSupport.interactable = true;
            }

            if (faceDescriptors.Count > 0)
            {
                m_FaceTracking.interactable = true;
#if UNITY_IOS
                m_FaceBlendShapes.interactable = true;
#endif
#if UNITY_ANDROID
                m_FaceRegions.interactable = true;
#endif
                foreach (var faceDescriptor in faceDescriptors)
                {
                    if (faceDescriptor.supportsEyeTracking)
                    {
                        m_EyePoses.interactable      = true;
                        m_FixationPoint.interactable = true;
                        m_EyeLasers.interactable     = true;
                        break;
                    }
                }
            }

            if (occlusionDescriptors.Count > 0)
            {
                foreach (var occlusionDescriptor in occlusionDescriptors)
                {
                    if (occlusionDescriptor.supportsHumanSegmentationDepthImage && occlusionDescriptor.supportsHumanSegmentationStencilImage)
                    {
                        m_HumanSegmentation.interactable = true;
                        break;
                    }
                }
            }

            if (cameraDescriptors.Count > 0)
            {
                foreach (var cameraDescriptor in cameraDescriptors)
                {
                    if ((cameraDescriptor.supportsAverageBrightness || cameraDescriptor.supportsAverageIntensityInLumens) &&
                        cameraDescriptor.supportsAverageColorTemperature && cameraDescriptor.supportsCameraConfigurations &&
                        cameraDescriptor.supportsCameraImage)
                    {
                        m_LightEstimation.interactable = true;
                    }
                }
            }

            if (imageDescriptors.Count > 0)
            {
                m_ImageTracking.interactable = true;
            }

            if (envDescriptors.Count > 0)
            {
                m_EnvironmentProbes.interactable = true;
            }

            if (planeDescriptors.Count > 0)
            {
                m_PlaneDetection.interactable = true;
                foreach (var planeDescriptor in planeDescriptors)
                {
                    if (planeDescriptor.supportsClassification)
                    {
                        m_PlaneClassification.interactable = true;
                        break;
                    }
                }
            }

            if (anchorDescriptors.Count > 0)
            {
                m_Anchors.interactable = true;
            }

            if (objectDescriptors.Count > 0)
            {
                m_ObjectTracking.interactable = true;
            }

            if (cameraDescriptors.Count > 0)
            {
                foreach (var cameraDescriptor in cameraDescriptors)
                {
                    if (cameraDescriptor.supportsCameraImage)
                    {
                        m_CpuImages.interactable = true;
                        break;
                    }
                }
            }

    #if UNITY_IOS
            if (sessionDescriptors.Count > 0 && ARKitSessionSubsystem.worldMapSupported)
            {
                m_ARWorldMap.interactable = true;
            }

            if (planeDescriptors.Count > 0 && rayCastDescriptors.Count > 0 && participantDescriptors.Count > 0 && ARKitSessionSubsystem.supportsCollaboration)
            {
                m_ARCollaborationData.interactable = true;
            }

            if (sessionDescriptors.Count > 0 && ARKitSessionSubsystem.coachingOverlaySupported)
            {
                m_ARKitCoachingOverlay.interactable = true;
            }
    #endif

            if (depthDescriptors.Count > 0)
            {
                m_PointCloud.interactable = true;
            }

            if (planeDescriptors.Count > 0)
            {
                m_PlaneOcclusion.interactable = true;
            }

            if (activeLoader.GetLoadedSubsystem <XRMeshSubsystem>() != null)
            {
                m_Meshing.interactable = true;
            }
        }
Exemplo n.º 16
0
 protected LoadedActionable(object conditionalExpr, LoaderUtility loader)
     : base(null, loader)
 {
     Actions = new List<LoadedBaseAction>();
     ConditianlExpression = conditionalExpr;
 }
Exemplo n.º 17
0
 internal LoadedEvent(string type, PropertyHolder values, LoadedEntity entity, LoaderUtility loaderUtil)
     : base(values, loaderUtil)
 {
     this.type = type;
     entity.AddLoadedEvent(this);
 }
        public void GetEmptyConfigurationFileName()
        {
            _configurationWrapper.SetUpAppSetting("EmptyConfigurationFileName", string.Empty);

            Assert.That(LoaderUtility.GetConfigurationFileName("EmptyConfigurationFileName", "Mapping.xml"), Is.EqualTo(string.Empty));
        }
        public void GetConfigurationFileName()
        {
            _configurationWrapper.SetUpAppSetting("ConfigurationFileThatDoesNotExist", @"C:\NonExistingConfigurationFile.xml");

            Assert.That(LoaderUtility.GetConfigurationFileName("ConfigurationFileThatDoesNotExist", "Mapping.xml"), Is.EqualTo(@"C:\NonExistingConfigurationFile.xml"));
        }
Exemplo n.º 20
0
 protected LoadedObject(PropertyHolder values, LoaderUtility loaderUtil)
 {
     Values = values;
     LoaderUtil = loaderUtil;
 }
Exemplo n.º 21
0
 private LoadedManager(string type, PropertyHolder values, LoaderUtility loaderUtil)
     : base(values, loaderUtil)
 {
     Type = type;
 }
Exemplo n.º 22
0
 static void LoadScene(string sceneName)
 {
     LoaderUtility.Initialize();
     SceneManager.LoadScene(sceneName, LoadSceneMode.Single);
 }
 public void GetTypeWithTypeUtilityNotation()
 {
     Assert.That(LoaderUtility.GetType("Remotion.Data.DomainObjects::ConfigurationLoader.XmlBasedConfigurationLoader.LoaderUtility"), Is.EqualTo(typeof(LoaderUtility)));
 }
Exemplo n.º 24
0
 internal LoadedLoop(object whileVal, LoaderUtility loader, LoadedBaseAction before, LoadedBaseAction after)
     : base(whileVal, loader)
 {
     Before = before;
     After = after;
 }
Exemplo n.º 25
0
 internal LoadedCondition(object ifVal, LoadedCondition elseCond, LoaderUtility loaderUtil)
     : base(ifVal, loaderUtil)
 {
     ElseCond = elseCond;
 }
 public void GetConfigurationFileNameForNonExistingAppSettingsKey()
 {
     Assert.That(LoaderUtility.GetConfigurationFileName("AppSettingKeyDoesNotExist", "Mapping.xml"), Is.EqualTo(Path.Combine(ReflectionUtility.GetConfigFileDirectory(), "Mapping.xml")));
 }
Exemplo n.º 27
0
 internal LoadedComponent(string name, PropertyHolder values, LoaderUtility loaderUtil)
     : base(values, loaderUtil)
 {
     Name = name;
     Type = ClassFactory.TypesDict[Name];
 }