Esempio n. 1
0
        /// <summary>
        /// Scans the supplied parent adapter
        /// Converts ChildGroupPacks to SaveablePacks and saves them to dictionary
        /// These packs are used later (in "Process" method) to apply the changes after the play mode is stopped
        /// </summary>
        /// <param name="parentAdapter"></param>
        /// <param name="pack"></param>
        public void Update(GroupAdapter parentAdapter, ChildGroupPack pack)
        {
            //Debug.Log("Update: " + parentAdapter);
#if DEBUG
            if (DebugMode)
            {
                //Debug.Log(string.Format("Linking {0} -> {1}", parentAdapter, childAdapter));
                Debug.Log(string.Format("ParentChildLinker: Updating {0}", parentAdapter));
            }
#endif
            //Debug.Log("parentAdapter: " + parentAdapter);
            // 1. we have to monitor parentAdapter for later (if not yet monitored)
            if (Application.isPlaying)
            {
                PersistenceManager.Instance.Watch(parentAdapter);
            }

            // 2. if no pack supplied, read it now
            if (null == pack)
            {
                //Debug.Log("ParentChildLinker: Pack not defined. Reading now.");
                pack = ChildGroupPack.Read(parentAdapter);
            }

            // 3. register adapters for later
            pack.RegisterAdapters();

            // 4. get relation object
            var guidPack = pack.ToSaveablePack();

            // 5. cache it (overwrite existing!)
            _changes[guidPack.ParentInstanceId] = guidPack;
        }
Esempio n. 2
0
        /// <summary>
        /// Scans the supplied parent adapter
        /// Converts ChildGroupPacks to SaveablePacks and saves them to dictionary
        /// These packs are used later (in "Process" method) to apply the changes after the play mode is stopped
        /// </summary>
        /// <param name="parentAdapter"></param>
        /// <param name="pack"></param>
        public void Update(GroupAdapter parentAdapter, ChildGroupPack pack)
        {
            //Debug.Log("Update: " + parentAdapter);
#if DEBUG
            if (DebugMode)
            {
                //Debug.Log(string.Format("Linking {0} -> {1}", parentAdapter, childAdapter));
                Debug.Log(string.Format("ParentChildLinker: Updating {0}", parentAdapter));
            }
#endif
            //Debug.Log("parentAdapter: " + parentAdapter);
            // 1. we have to monitor parentAdapter for later (if not yet monitored)
            if (Application.isPlaying)
                PersistenceManager.Instance.Watch(parentAdapter);

            // 2. if no pack supplied, read it now
            if (null == pack)
            {
                //Debug.Log("ParentChildLinker: Pack not defined. Reading now.");
                pack = ChildGroupPack.Read(parentAdapter);
            }

            // 3. register adapters for later
            pack.RegisterAdapters();

            // 4. get relation object
            var guidPack = pack.ToSaveablePack();

            // 5. cache it (overwrite existing!)
            _changes[guidPack.ParentInstanceId] = guidPack;
        }