Ejemplo n.º 1
0
        /// <summary>
        /// Return the SceneData of the specified scene
        /// </summary>
        /// <returns></returns>
        public static SceneData GetSceneData(string sceneName)
        {
            if (Registery.m_scenes.ContainsKey(sceneName))
            {
                return(Registery.m_scenes[sceneName]);
            }
            else
            {
                SceneData data = new SceneData(sceneName);
                Registery.m_scenes.Add(sceneName, data);

                return(data);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Check if a DataContainer exists for the givenkey into the SceneData of the active scene and output the result
        /// </summary>
        /// <param name="key">The Id of the container</param>
        /// <param name="output">result if it exists or null</param>
        /// <returns>true if a DataContainer has been found</returns>
        public static bool HasData(string key, out DataContainer output)
        {
            SceneData sData = GetActiveSceneData();

            if (sData.m_datas.ContainsKey(key))
            {
                output = sData.m_datas[key];
                return(true);
            }
            else
            {
                output = null;
                return(false);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Register a container into the SceneData of the active scene
        /// </summary>
        /// <param name="container"></param>
        public static void RegisterData(DataContainer container)
        {
            string key = container.m_key;

            if (key.EndsWith(PrettyCode.SUFFIX))
            {
                SceneData sData = GetActiveSceneData();

                if (sData.m_datas.ContainsKey(key))
                {
                    sData.m_datas[key] = container;
                }
                else
                {
                    sData.m_datas.Add(key, container);
                }
            }
            else
            {
                Debug.LogWarning("Insertion Aborted. Incorrect Key Validation: " + key + " MonoPersistent probably needs to be baked.");
            }
        }