Пример #1
0
		internal Background DeserializeBackground(JObject obj, Section ownerSection)
		{
			Background result = new Background(ownerSection);

			result.TopColor = obj["topColor"].ToColor();
			result.BottomColor = obj["bottomColor"].ToColor();

			JArray layersData = (JArray)obj["layers"];
			result.Layers = DeserializeBackgroundLayers(layersData, ownerSection.Camera, ownerSection.Bounds);

			return result;
		}
Пример #2
0
        private static Background GenerateBackground(Section owner)
        {
            Background result = new Background(owner);
            result.TopColor = result.BottomColor = new Color(0, 0, 0, 0);

            BackgroundLayer layer = new BackgroundLayer(GameServices.Camera, owner.Bounds);
            layer.BackgroundTextureResourceName = "Background";
            layer.ScrollDirection = (BackgroundScrollDirection)1;
            layer.ScrollRate = 0.5f;

            result.AddLayerToFront(layer);
            return result;
        }
Пример #3
0
		internal object GetBackgroundLayerObjects(Background background)
		{
			List<object> result = new List<object>(background.Layers.Count);

			foreach (var layer in background.Layers)
			{
				result.Add(new
				{
					resourceName = layer.BackgroundTextureResourceName,
					scrollDirection = (int)layer.ScrollDirection,
					scrollRate = layer.ScrollRate
				});
			}

			return result;
		}