Example #1
0
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            MaterialData data = Serializer.LoadScriptData <MaterialData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            Material[] mats = GetComponent <Renderer>().materials;

            string[] materialIDs = StringToStringArray(data._materialIDs);

            for (int i = 0; i < materialIDs.Length; i++)
            {
                if (mats.Length >= i)
                {
                    Material _material = AssetLoader.RetrieveAsset(mats[i], materialIDs[i]);
                    if (_material != null)
                    {
                        mats[i] = _material;
                    }
                }
            }

            GetComponent <Renderer>().materials = mats;
        }
Example #2
0
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            NavMesh2DData data = Serializer.LoadScriptData <NavMesh2DData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            if (GetComponent <NavigationMesh>())
            {
                NavigationMesh navMesh = GetComponent <NavigationMesh>();
                navMesh.polygonColliderHoles.Clear();
                KickStarter.navigationManager.navigationEngine.ResetHoles(navMesh);

                if (!string.IsNullOrEmpty(data._linkedIDs))
                {
                    int[] linkedIDs = StringToIntArray(data._linkedIDs);
                    for (int i = 0; i < linkedIDs.Length; i++)
                    {
                        PolygonCollider2D polyHole = Serializer.returnComponent <PolygonCollider2D> (linkedIDs[i]);
                        if (polyHole != null)
                        {
                            navMesh.AddHole(polyHole);
                        }
                    }
                }
            }
        }
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            ConversationData data = Serializer.LoadScriptData <ConversationData> (stringData);

            if (data == null)
            {
                return;
            }

            if (GetComponent <Conversation>())
            {
                Conversation conversation = GetComponent <Conversation>();

                bool[] optionStates = StringToBoolArray(data._optionStates);
                conversation.SetOptionStates(optionStates);

                bool[] optionLocks = StringToBoolArray(data._optionLocks);
                conversation.SetOptionLocks(optionLocks);

                bool[] optionChosens = StringToBoolArray(data._optionChosens);
                conversation.SetOptionChosens(optionChosens);

                conversation.lastOption = data.lastOption;
            }
        }
Example #4
0
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            NavMesh2DData data = Serializer.LoadScriptData <NavMesh2DData> (stringData);

            if (data == null)
            {
                return;
            }

            if (GetComponent <NavigationMesh>())
            {
                NavigationMesh navMesh = GetComponent <NavigationMesh>();
                navMesh.polygonColliderHoles.Clear();

                if (data._linkedIDs.Length > 0)
                {
                    int[] linkedIDs = StringToIntArray(data._linkedIDs);
                    for (int i = 0; i < linkedIDs.Length; i++)
                    {
                        PolygonCollider2D polyHole = Serializer.returnComponent <PolygonCollider2D> (linkedIDs[i]);
                        if (polyHole != null)
                        {
                            navMesh.AddHole(polyHole);
                        }
                    }
                }
            }
        }
Example #5
0
        public override void LoadData(string stringData)
        {
            SoundData data = Serializer.LoadScriptData <SoundData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            Sound sound = GetComponent <Sound>();

            if (sound is Music)
            {
                return;
            }

            if (KickStarter.saveSystem.loadingGame == LoadingGame.No && sound.surviveSceneChange)
            {
                return;
            }

            sound.LoadData(data);
        }
Example #6
0
        public override void LoadData(string stringData)
        {
            HotspotData data = Serializer.LoadScriptData <HotspotData> (stringData);

            if (data == null)
            {
                return;
            }

            if (data.isOn)
            {
                gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.hotspotLayer);
            }
            else
            {
                gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.deactivatedLayer);
            }

            if (GetComponent <Hotspot>())
            {
                Hotspot _hotspot = GetComponent <Hotspot>();

                StringToButtonStates(_hotspot, data.buttonStates);

                if (data.hotspotName != "")
                {
                    _hotspot.SetName(data.hotspotName, data.displayLineID);
                }
            }
        }
Example #7
0
		public override void LoadData (string stringData)
		{
			NameData data = Serializer.LoadScriptData <NameData> (stringData);
			if (data == null) return;

			gameObject.name = data.newName;
		}
Example #8
0
        public override void LoadData(string stringData)
        {
            AnimatorData data = Serializer.LoadScriptData <AnimatorData> (stringData);

            if (data == null)
            {
                loadedData = false;
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            if (!string.IsNullOrEmpty(data.controllerID))
            {
                RuntimeAnimatorController runtimeAnimatorController = AssetLoader.RetrieveAsset(_animator.runtimeAnimatorController, data.controllerID);
                if (runtimeAnimatorController != null)
                {
                    _animator.runtimeAnimatorController = runtimeAnimatorController;
                }
            }

            StringToParameterValues(Animator.parameters, data.parameterData);
            StringToLayerWeights(data.layerWeightData);
            StringToStates(data.stateData);

            loadedData = true;
        }
Example #9
0
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            ShapeableData data = Serializer.LoadScriptData <ShapeableData> (stringData);

            if (data == null)
            {
                return;
            }

            if (GetComponent <Shapeable>())
            {
                Shapeable shapeable = GetComponent <Shapeable>();

                int[]   activeKeyIDs = StringToIntArray(data._activeKeyIDs);
                float[] values       = StringToFloatArray(data._values);

                for (int i = 0; i < activeKeyIDs.Length; i++)
                {
                    if (values.Length > i)
                    {
                        shapeable.shapeGroups[i].SetActive(activeKeyIDs[i], values[i], 0f, MoveMethod.Linear, null);
                    }
                }
            }
        }
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            NPCData data = Serializer.LoadScriptData <NPCData> (stringData);

            if (data == null)
            {
                loadedData = false;
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            if (data.isOn)
            {
                gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.hotspotLayer);
            }
            else
            {
                gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.deactivatedLayer);
            }
            transform.position    = new Vector3(data.LocX, data.LocY, data.LocZ);
            transform.eulerAngles = new Vector3(data.RotX, data.RotY, data.RotZ);
            transform.localScale  = new Vector3(data.ScaleX, data.ScaleY, data.ScaleZ);

            if (GetComponent <NPC>())
            {
                NPC npc = GetComponent <NPC>();
                npc.SetRotation(transform.rotation);
                npc.LoadData(data);
            }

            loadedData = true;
        }
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            TriggerData data = Serializer.LoadScriptData <TriggerData> (stringData);

            if (data == null)
            {
                loadedData = false;
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            if (GetComponent <Collider>())
            {
                GetComponent <Collider>().enabled = data.isOn;
            }
            else if (GetComponent <Collider2D>())
            {
                GetComponent <Collider2D>().enabled = data.isOn;
            }

            loadedData = true;
        }
Example #12
0
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         * <param name = "restoringSaveFile">True if the game is currently loading a saved game file, as opposed to just switching scene</param>
         */
        public override void LoadData(string stringData, bool restoringSaveFile = false)
        {
            TimelineData data = Serializer.LoadScriptData <TimelineData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

                        #if UNITY_2017_1_OR_NEWER
            PlayableDirector director = GetComponent <PlayableDirector>();
            director.time = data.currentTime;
            if (data.isPlaying)
            {
                director.Play();
            }
            else
            {
                director.Stop();
            }
                        #else
            ACDebug.LogWarning("The 'Remember Director' component is only compatible with Unity 5.6 onward.", this);
                        #endif
        }
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         * <param name = "restoringSaveFile">True if the game is currently loading a saved game file, as opposed to just switching scene</param>
         */
        public override void LoadData(string stringData, bool restoringSaveFile = false)
        {
            SoundData data = Serializer.LoadScriptData <SoundData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            Sound sound = GetComponent <Sound>();

            if (sound is Music)
            {
                return;
            }

            if (!restoringSaveFile && sound.surviveSceneChange)
            {
                return;
            }

            sound.LoadData(data);
        }
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            FootstepSoundData data = Serializer.LoadScriptData <FootstepSoundData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            if (GetComponent <FootstepSounds>())
            {
                FootstepSounds footstepSounds = GetComponent <FootstepSounds>();

                AudioClip[] walkSounds = StringToSounds(data.walkSounds);
                if (walkSounds != null && walkSounds.Length > 0)
                {
                    footstepSounds.footstepSounds = walkSounds;
                }

                AudioClip[] runSounds = StringToSounds(data.runSounds);
                if (runSounds != null && runSounds.Length > 0)
                {
                    footstepSounds.runSounds = runSounds;
                }
            }
        }
Example #15
0
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            VisibilityData data = Serializer.LoadScriptData <VisibilityData> (stringData);

            if (data == null)
            {
                loadedData = false;
                return;
            }

            if (GetComponent <SpriteFader>())
            {
                SpriteFader spriteFader = GetComponent <SpriteFader>();
                if (data.isFading)
                {
                    if (data.isFadingIn)
                    {
                        spriteFader.Fade(FadeType.fadeIn, data.fadeTime, data.fadeAlpha);
                    }
                    else
                    {
                        spriteFader.Fade(FadeType.fadeOut, data.fadeTime, data.fadeAlpha);
                    }
                }
                else
                {
                    spriteFader.EndFade();
                    spriteFader.SetAlpha(data.fadeAlpha);
                }
            }
            else if (GetComponent <SpriteRenderer>() && saveColour)
            {
                Color _color = new Color(data.colourR, data.colourG, data.colourB, data.colourA);
                GetComponent <SpriteRenderer>().color = _color;
            }

            if (GetComponent <FollowTintMap>())
            {
                GetComponent <FollowTintMap>().LoadData(data);
            }

            if (limitVisibility)
            {
                limitVisibility.isLockedOff = !data.isOn;
            }
            else if (GetComponent <Renderer>())
            {
                GetComponent <Renderer>().enabled = data.isOn;
            }

            if (affectChildren)
            {
                foreach (Renderer _renderer in GetComponentsInChildren <Renderer>())
                {
                    _renderer.enabled = data.isOn;
                }
            }

            loadedData = true;
        }
Example #16
0
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            ContainerData data = Serializer.LoadScriptData <ContainerData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            if (_Container != null)
            {
                _Container.items.Clear();

                int[] linkedIDs = StringToIntArray(data._linkedIDs);
                int[] counts    = StringToIntArray(data._counts);
                int[] IDs       = StringToIntArray(data._IDs);

                if (IDs != null)
                {
                    for (int i = 0; i < IDs.Length; i++)
                    {
                        ContainerItem newItem = new ContainerItem(linkedIDs[i], counts[i], IDs[i]);
                        _Container.items.Add(newItem);
                    }
                }
            }
        }
Example #17
0
        public override void LoadData(string stringData)
        {
            ContainerData data = Serializer.LoadScriptData <ContainerData> (stringData);

            if (data == null)
            {
                return;
            }

            if (GetComponent <Container>())
            {
                Container container = GetComponent <Container>();
                container.items.Clear();

                int[] linkedIDs = StringToIntArray(data._linkedIDs);
                int[] counts    = StringToIntArray(data._counts);
                int[] IDs       = StringToIntArray(data._IDs);

                for (int i = 0; i < IDs.Length; i++)
                {
                    ContainerItem newItem = new ContainerItem(linkedIDs[i], counts[i], IDs[i]);
                    container.items.Add(newItem);
                }
            }
        }
Example #18
0
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData, bool restoringSaveFile = false)
        {
            SoundData data = Serializer.LoadScriptData <SoundData> (stringData);

            if (data == null)
            {
                return;
            }

            Sound       sound       = GetComponent <Sound>();
            AudioSource audioSource = GetComponent <AudioSource>();

            sound.relativeVolume = data.relativeVolume;
            if (!restoringSaveFile && sound.surviveSceneChange)
            {
                return;
            }

            if (data.isPlaying)
            {
                audioSource.clip = AssetLoader.RetrieveAsset(audioSource.clip, data.clipID);
                sound.PlayAtPoint(data.isLooping, data.samplePoint);
            }
            else
            {
                sound.Stop();
            }
        }
Example #19
0
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            MoveableData data = Serializer.LoadScriptData <MoveableData> (stringData);

            if (data == null)
            {
                loadedData = false;
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            if (GetComponent <DragBase>())
            {
                if (data.isOn)
                {
                    GetComponent <DragBase>().TurnOn();
                }
                else
                {
                    GetComponent <DragBase>().TurnOff();
                }
            }

            if (data.isOn)
            {
                gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.hotspotLayer);
            }
            else
            {
                gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.deactivatedLayer);
            }

            transform.position    = new Vector3(data.LocX, data.LocY, data.LocZ);
            transform.eulerAngles = new Vector3(data.RotX, data.RotY, data.RotZ);
            transform.localScale  = new Vector3(data.ScaleX, data.ScaleY, data.ScaleZ);

            if (GetComponent <Moveable_Drag>())
            {
                Moveable_Drag moveable_Drag = GetComponent <Moveable_Drag>();
                moveable_Drag.LetGo(true);
                if (moveable_Drag.dragMode == DragMode.LockToTrack && moveable_Drag.track != null)
                {
                    moveable_Drag.trackValue  = data.trackValue;
                    moveable_Drag.revolutions = data.revolutions;
                    moveable_Drag.StopAutoMove();
                    moveable_Drag.track.SetPositionAlong(data.trackValue, moveable_Drag);
                }
            }

            if (GetComponent <Moveable>())
            {
                GetComponent <Moveable>().LoadData(data);
            }

            loadedData = true;
        }
Example #20
0
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            VideoPlayerData data = Serializer.LoadScriptData <VideoPlayerData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            if (GetComponent <VideoPlayer>())
            {
                VideoPlayer videoPlayer = GetComponent <VideoPlayer>();

                //videoPlayer.frame = data.currentFrame;
                videoPlayer.time = data.currentTime;

                if (data.isPlaying)
                {
                    if (!videoPlayer.isPrepared)
                    {
                        loadTime      = data.currentTime;
                        playAfterLoad = true;
                        videoPlayer.prepareCompleted += OnPrepareVideo;
                        videoPlayer.Prepare();
                    }
                    else
                    {
                        videoPlayer.Play();
                    }
                }
                else
                {
                    if (data.currentTime > 0f)
                    {
                        if (!videoPlayer.isPrepared)
                        {
                            loadTime      = data.currentTime;
                            playAfterLoad = false;
                            videoPlayer.prepareCompleted += OnPrepareVideo;
                            videoPlayer.Prepare();
                        }
                        else
                        {
                            videoPlayer.Pause();
                        }
                    }
                    else
                    {
                        videoPlayer.Stop();
                    }
                }
            }
        }
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            ConversationData data = Serializer.LoadScriptData <ConversationData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            if (GetComponent <Conversation>())
            {
                Conversation conversation = GetComponent <Conversation>();

                bool[]   optionStates  = StringToBoolArray(data._optionStates);
                bool[]   optionLocks   = StringToBoolArray(data._optionLocks);
                bool[]   optionChosens = StringToBoolArray(data._optionChosens);
                string[] optionLabels  = StringToStringArray(data._optionLabels);
                int[]    optionLineIDs = StringToIntArray(data._optionLineIDs);

                for (int i = 0; i < conversation.options.Count; i++)
                {
                    if (optionStates != null && optionStates.Length > i)
                    {
                        conversation.options[i].isOn = optionStates[i];
                    }

                    if (optionLocks != null && optionLocks.Length > i)
                    {
                        conversation.options[i].isLocked = optionLocks[i];
                    }

                    if (optionChosens != null && optionChosens.Length > i)
                    {
                        conversation.options[i].hasBeenChosen = optionChosens[i];
                    }

                    if (optionLabels != null && optionLabels.Length > i)
                    {
                        conversation.options[i].label = optionLabels[i];
                    }

                    if (optionLineIDs != null && optionLineIDs.Length > i)
                    {
                        conversation.options[i].lineID = optionLineIDs[i];
                    }
                }

                conversation.lastOption = data.lastOption;
            }
        }
        public override void LoadData(string stringData)
        {
            AnimatorData data = Serializer.LoadScriptData <AnimatorData> (stringData);

            if (data == null)
            {
                return;
            }

            StringToParameterValues(_animator.parameters, data.parameterData);
            StringToLayerWeights(data.layerWeightData);
            StringToStates(data.stateData);
        }
Example #23
0
        public override void LoadData(string stringData)
        {
            NameData data = Serializer.LoadScriptData <NameData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            gameObject.name = data.newName;
        }
Example #24
0
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            HotspotData data = Serializer.LoadScriptData <HotspotData> (stringData);

            if (data == null)
            {
                loadedData = false;
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            if (data.isOn)
            {
                gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.hotspotLayer);
            }
            else
            {
                gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.deactivatedLayer);
            }

            if (GetComponent <Hotspot>())
            {
                Hotspot _hotspot = GetComponent <Hotspot>();

                if (data.isOn)
                {
                    _hotspot.TurnOn();
                }
                else
                {
                    _hotspot.TurnOff();
                }

                StringToButtonStates(_hotspot, data.buttonStates);

                if (data.hotspotName != "")
                {
                    _hotspot.SetName(data.hotspotName, data.displayLineID);
                }
                _hotspot.ResetMainIcon();
            }

            loadedData = true;
        }
Example #25
0
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            TriggerData data = Serializer.LoadScriptData <TriggerData> (stringData);

            if (data == null)
            {
                return;
            }

            if (GetComponent <Collider>())
            {
                GetComponent <Collider>().enabled = data.isOn;
            }
            else if (GetComponent <Collider2D>())
            {
                GetComponent <Collider2D>().enabled = data.isOn;
            }
        }
Example #26
0
        public override void LoadData(string stringData)
        {
            VisibilityData data = Serializer.LoadScriptData <VisibilityData> (stringData);

            if (data == null)
            {
                return;
            }

            if (GetComponent <SpriteFader>())
            {
                SpriteFader spriteFader = GetComponent <SpriteFader>();
                if (data.isFading)
                {
                    if (data.isFadingIn)
                    {
                        spriteFader.Fade(FadeType.fadeIn, data.fadeTime, data.fadeAlpha);
                    }
                    else
                    {
                        spriteFader.Fade(FadeType.fadeOut, data.fadeTime, data.fadeAlpha);
                    }
                }
                else
                {
                    spriteFader.EndFade();
                    spriteFader.SetAlpha(data.fadeAlpha);
                }
            }

            if (GetComponent <Renderer>())
            {
                GetComponent <Renderer>().enabled = data.isOn;
            }

            if (affectChildren)
            {
                foreach (Renderer _renderer in GetComponentsInChildren <Renderer>())
                {
                    _renderer.enabled = data.isOn;
                }
            }
        }
Example #27
0
        public override void LoadData(string stringData)
        {
            TrackData data = Serializer.LoadScriptData <TrackData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            DragTrack track = GetComponent <DragTrack>();

            if (track && track.allTrackSnapData != null)
            {
                string[] valuesArray = data.enabledStates.Split(SaveSystem.pipe[0]);
                for (int i = 0; i < track.allTrackSnapData.Count; i++)
                {
                    if (i < valuesArray.Length)
                    {
                        string[] chunkData = valuesArray[i].Split(SaveSystem.colon[0]);
                        if (chunkData != null && chunkData.Length == 2)
                        {
                            int _regionID = 0;
                            if (int.TryParse(chunkData[0], out _regionID))
                            {
                                TrackSnapData snapData = track.GetSnapData(_regionID);
                                if (snapData != null)
                                {
                                    int _isEnabled = 1;
                                    if (int.TryParse(chunkData[1], out _isEnabled))
                                    {
                                        snapData.IsEnabled = (_isEnabled == 1);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        public override void LoadData(string stringData)
        {
            ActionList actionList = GetComponent <ActionList>();

            if (actionList == null)
            {
                return;
            }

            ActionListParamData data = Serializer.LoadScriptData <ActionListParamData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            actionList.SetParameterData(data.paramData);
        }
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            ContainerData data = Serializer.LoadScriptData <ContainerData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            if (_Container)
            {
                List <InvInstance> invInstances = new List <InvInstance> ();

                if (!string.IsNullOrEmpty(data._linkedIDs))
                {
                    int[] linkedIDs = StringToIntArray(data._linkedIDs);
                    int[] counts    = StringToIntArray(data._counts);

                    if (linkedIDs != null)
                    {
                        for (int i = 0; i < linkedIDs.Length; i++)
                        {
                            invInstances.Add(new InvInstance(linkedIDs[i], counts[i]));
                        }
                    }

                    _Container.InvCollection = new InvCollection(invInstances);
                }
                else if (!string.IsNullOrEmpty(data.collectionData))
                {
                    _Container.InvCollection = InvCollection.LoadData(data.collectionData);
                }
            }
        }
Example #30
0
        public override void LoadData(string stringData)
        {
            VariablesData data = Serializer.LoadScriptData <VariablesData> (stringData);

            if (data == null)
            {
                loadedData = false;
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            Variables.vars = SaveSystem.UnloadVariablesData(data.variablesData, Variables.vars);

            foreach (GVar var in Variables.vars)
            {
                var.Upload(VariableLocation.Component);
            }

            loadedData = true;
        }