Esempio n. 1
0
        public void Restore(IRestoreData restoreData)
        {
            var allParams = new List <InitParams>();
            var curr      = restoreData as LogControllerRestoreData;

            while (curr.logParams.Count > 0)
            {
                for (int i = curr.logParams.Count - 1; i >= 0; i--)
                {
                    allParams.Add(curr.logParams[i]);
                    if (allParams.Count >= maxLogEntryNum)
                    {
                        break;
                    }
                }

                var lastParams = curr.logParams[0];
                var entry      = checkpointManager.IsReached(lastParams.currentNodeName, lastParams.currentDialogueIndex,
                                                             lastParams.variablesHashBeforeChange) as GameStateStepRestoreCheckpointEntry;
                this.RuntimeAssert(entry != null,
                                   "the earliest log in each restore data must be pointing at another checkpoint");
                curr = entry[restorableObjectName] as LogControllerRestoreData;
            }

            Clear();
            for (int i = allParams.Count - 1; i >= 0; i--)
            {
                allParams[i].logEntryIndex = i;
                AddEntry(allParams[i]);
            }
        }
Esempio n. 2
0
        public void Restore(IRestoreData restoreData)
        {
            var allParams = new List <LogParam>();
            var data      = restoreData as LogControllerRestoreData;

            while (data.logParams.Count > 0)
            {
                for (int i = data.logParams.Count - 1; i >= 0; i--)
                {
                    allParams.Add(data.logParams[i]);
                    if (allParams.Count >= maxLogEntryNum)
                    {
                        break;
                    }
                }

                this.RuntimeAssert(TryGetCheckpoint(data.logParams[0], false, out var entry),
                                   "The earliest log in each restore data must point at another checkpoint.");
                data = entry.restoreDatas[restorableObjectName] as LogControllerRestoreData;
            }

            Clear();
            for (int i = allParams.Count - 1; i >= 0; i--)
            {
                allParams[i].logEntryIndex = i;
                AddEntry(allParams[i]);
            }
        }
Esempio n. 3
0
        public void Restore(IRestoreData restoreData)
        {
            var data = restoreData as AutoVoiceRestoreData;

            nameToEnabled = data.nameToEnabled.ToDictionary(x => x.Key, x => x.Value);
            nameToIndex   = data.nameToIndex.ToDictionary(x => x.Key, x => x.Value);
        }
Esempio n. 4
0
        public void Restore(IRestoreData restoreData)
        {
            if (backPanel != null)
            {
                backPanel.SetActive(false);
            }

            RemoveAllSelectButton();
        }
Esempio n. 5
0
        public virtual void Restore(IRestoreData restoreData)
        {
            var data = restoreData as CompositeSpriteControllerBaseRestoreData;

            data.transformRestoreData.Restore(transform);
            color = data.color;
            RenderQueueOverrider.Ensure(gameObject).renderQueue = data.renderQueue;
            SetPose(data.currentImageName, false);
        }
Esempio n. 6
0
        public void Restore(IRestoreData restoreData)
        {
            var data = restoreData as RestoreData;

            if (data.currentImageName != null)
            {
                SetImage(data.currentImageName);
            }
            else
            {
                ClearImage();
            }
        }
Esempio n. 7
0
        public void Restore(IRestoreData restoreData)
        {
            var data = restoreData as VideoRestoreData;

            if (data.currentVideoName != null)
            {
                SetVideo(data.currentVideoName);
            }
            else
            {
                ClearVideo();
            }
        }
Esempio n. 8
0
        public void Restore(IRestoreData restoreData)
        {
            var data = restoreData as VideoRestoreData;

            if (!string.IsNullOrEmpty(data.currentVideoName))
            {
                SetVideo(data.currentVideoName);
            }
            else
            {
                ClearVideo();
            }
        }
Esempio n. 9
0
        public virtual void Restore(IRestoreData restoreData)
        {
            var data = restoreData as PrefabRestoreData;

            data.transformRestoreData.Restore(transform);
            if (!string.IsNullOrEmpty(data.currentPrefabName))
            {
                SetPrefab(data.currentPrefabName);
            }
            else
            {
                ClearPrefab();
            }
        }
Esempio n. 10
0
        public void Restore(IRestoreData restoreData)
        {
            var data = restoreData as PostProcessingRestoreData;

            // Materials must be RestorableMaterial
            MaterialFactory factory = MaterialPool.Ensure(gameObject).factory;

            layers.Clear();
            foreach (var materialRestoreData in data.layersData)
            {
                var material = RestorableMaterial.RestoreMaterialFromData(materialRestoreData, factory);
                layers.Add(material);
            }
        }
Esempio n. 11
0
        public override void Restore(IRestoreData restoreData)
        {
            var baseData = restoreData as PrefabRestoreData;

            base.Restore(baseData);

            var data = restoreData as TimelineRestoreData;

            if (playableDirector != null)
            {
                playableDirector.time = data.time;
                playableDirector.Evaluate();
            }
        }
Esempio n. 12
0
        public void Restore(IRestoreData restoreData)
        {
            var data = restoreData as RestoreData;

            if (data.isPlaying)
            {
                if (currentAudioName != data.audioName || !audioSource.isPlaying)
                {
                    PlayAudio(data.audioName);
                }
            }
            else
            {
                StopAudio();
                currentAudioName = data.audioName;
            }
        }
        public virtual void Restore(IRestoreData restoreData)
        {
            var data = restoreData as CompositeSpriteControllerBaseRestoreData;

            data.transformRestoreData.Restore(transform);
            color = data.color;

            if (spriteRenderer != null)
            {
                // Material must be RestorableMaterial or DefaultMaterial
                if (data.materialRestoreData != null)
                {
                    MaterialFactory factory = MaterialPoolComponent.Ensure(gameObject).factory;
                    spriteRenderer.material =
                        RestorableMaterial.RestoreMaterialFromData(data.materialRestoreData, factory);
                }
                else
                {
                    spriteRenderer.material = MaterialPoolComponent.Ensure(gameObject).defaultMaterial;
                }
            }

            RenderQueueOverrider.Ensure(gameObject).renderQueue = data.renderQueue;

            if (data.currentImageName == currentImageName)
            {
                return;
            }

            if (!string.IsNullOrEmpty(data.currentImageName))
            {
                string[] parts = StringToPoseArray(data.currentImageName);
                if (parts.Length == 1)
                {
                    SetImage(data.currentImageName, fade: false);
                }
                else
                {
                    SetPose(parts, fade: false);
                }
            }
            else
            {
                ClearImage(fade: false);
            }
        }
Esempio n. 14
0
        public void Restore(IRestoreData restoreData)
        {
            var data = restoreData as TimelineRestoreData;

            data.transformRestoreData.Restore(transform);
            if (data.currentTimelinePrefabName != null)
            {
                SetTimelinePrefab(data.currentTimelinePrefabName);
                if (playableDirector != null)
                {
                    playableDirector.time = data.time;
                    playableDirector.Evaluate();
                }
            }
            else
            {
                ClearTimelinePrefab();
            }
        }
Esempio n. 15
0
        public void Restore(IRestoreData restoreData)
        {
            var data = restoreData as PostProcessingRestoreData;

            // Materials must be RestorableMaterial
            MaterialFactory factory = MaterialPoolComponent.Ensure(gameObject).factory;

            layers.Clear();
            foreach (var layerData in data.layersData)
            {
                var layer = new List <Material>();
                foreach (var materialRestoreData in layerData)
                {
                    var material = RestorableMaterial.RestoreMaterialFromData(materialRestoreData, factory);
                    layer.Add(material);
                }

                layers.Add(layer);
            }

            layersEnabledUntil = data.layersEnabledUntil;
        }
Esempio n. 16
0
        public void Restore(IRestoreData restoreData)
        {
            var data = restoreData as AssetLoaderRestoreData;

            // Serialized assets are in MRU order
            foreach (var pair in data.cachedAssetCounts)
            {
                var type  = pair.Key;
                var cache = cachedAssets[type];
                cache.Clear();
                foreach (var pathAndCount in pair.Value)
                {
                    var path          = pathAndCount.Key;
                    var count         = pathAndCount.Value;
                    var localizedPath = TryGetLocalizedPath(path);
                    var request       = Resources.LoadAsync(localizedPath);
                    cache[path] = new CachedAssetEntry {
                        count = count, request = request
                    };
                }
            }
        }
Esempio n. 17
0
        public void Restore(IRestoreData restoreData)
        {
            var data = restoreData as RestoreData;

            characterAppearance.SetActive(data.isActive);
        }
Esempio n. 18
0
        public void Restore(IRestoreData restoreData)
        {
            blackPanel.SetActive(false);

            RemoveAllSelectButton();
        }