コード例 #1
0
ファイル: SaveSystem.cs プロジェクト: S4D3H/ProjectJanitor
        /// <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);
            }
        }
コード例 #2
0
ファイル: SaveSystem.cs プロジェクト: S4D3H/ProjectJanitor
        /// <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);
            }
        }
コード例 #3
0
ファイル: SaveSystem.cs プロジェクト: S4D3H/ProjectJanitor
        /// <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.");
            }
        }