Beispiel #1
0
        public static List <Toy> Perform(GameDriver driver)
        {
            Log.Debug("Loading: Toys");
            var toysFolder = DataPath.Get("Toys");
            var toyFiles   = Directory.GetFiles(toysFolder);

            var toys = new List <Toy>();

            foreach (var toyFile in toyFiles)
            {
                var toy = JsonData.DeserializeFromFile <Toy>(toyFile);
                toy.Active = false;
                toy.Name   = Path.GetFileNameWithoutExtension(toyFile);
                foreach (var damage in toy.DamagePoints)
                {
                    damage.Active = true;
                }

                if (driver.CurrentToy != null && toy.Name == driver.CurrentToy.Name)
                {
                    toy.Active        = true;
                    driver.CurrentToy = toy;
                }

                toys.Add(toy);
            }

            return(toys);
        }
        public static GameInterface Initialize(GameDriver driver)
        {
            Log.Message("Initializing: Game Interface");
            var path = DataPath.Get("UI\\GameUI.json");

            return(JsonData.DeserializeFromFile <GameInterface>(path));
        }
Beispiel #3
0
        public static DeskClock Perform(GameDriver driver)
        {
            Log.Debug("Loading: Desk Clock");
            var elementsFolder = DataPath.Get("Elements");
            var path           = Path.Combine(elementsFolder, "DeskClock.json");

            return(JsonData.DeserializeFromFile <DeskClock>(path));
        }
        public static PaintingKit Perform(GameDriver driver)
        {
            Log.Debug("Loading: Painting Kit");
            var elementsFolder = DataPath.Get("Elements");
            var path           = Path.Combine(elementsFolder, "PaintingKit.json");

            return(JsonData.DeserializeFromFile <PaintingKit>(path));
        }
        public static void Perform()
        {
            Log.Debug("Saving: Painting Kit");
            var elementsFolder = DataPath.Get("Elements");
            var path           = Path.Combine(elementsFolder, "PaintingKit.json");

            JsonData.SerializeToFile(GameDriver.Instance.PaintingKit, path);
        }
Beispiel #6
0
        public static void Perform()
        {
            Log.Debug("Saving: Desk Clock");
            var elementsFolder = DataPath.Get("Elements");
            var path           = Path.Combine(elementsFolder, "DeskClock.json");

            JsonData.SerializeToFile(GameDriver.Instance.Clock, path);
        }
Beispiel #7
0
        public static void Perform()
        {
            var hotspot = new Hotspot
            {
                Name        = "Hotspot",
                Sprite      = GenerateSprite.Default(),
                DebugSprite = GenerateSprite.Default(),
                Transform   = Transform2D.Identity
            };

            JsonData.SerializeToFile(hotspot, DataPath.Get("Hotspot.json"));
        }
Beispiel #8
0
        public static void Perform()
        {
            Log.Debug("Saving: Toys");
            var toysFolder = DataPath.Get("Toys");
            var toys       = GameDriver.Instance.Toys;

            foreach (var toy in toys)
            {
                var path = Path.Combine(toysFolder, toy.Name + ".json");
                JsonData.SerializeToFile(toy, path);
            }
        }
Beispiel #9
0
        public static DeskClock Initialize(GameDriver driver)
        {
            var path  = DataPath.Get("Elements\\DeskClock.json");
            var clock = JsonData.DeserializeFromFile <DeskClock>(path);

            clock.Hour   = 8;
            clock.Minute = 0;
            clock.MinuteHandTransform.Angle = 0.0f;
            clock.HourHandTransform.Angle   = 240.0f;
            clock._minuteAngle = 0.0f;
            return(clock);
        }
        public static void Perform()
        {
            Log.Debug("Saving: Hotspots");
            var toysFolder = DataPath.Get("Hotspots");
            var hotspots   = GameDriver.Instance.HotSpots;

            foreach (var hotspot in hotspots)
            {
                var path = Path.Combine(toysFolder, hotspot.Name + ".json");
                JsonData.SerializeToFile(hotspot, path);
            }
        }
Beispiel #11
0
        public TextureBank Initialize(GameDriver driver)
        {
            Log.Message("Initializing: Texture Bank");
            _textures = new Dictionary <string, Texture2D>();

            var pathMapPath = DataPath.Get("TextureBank.json");
            var pathMap     = JsonData.DeserializeFromFile <StringConfiguration>(pathMapPath);

            foreach (var entry in pathMap)
            {
                var texture = driver.Content.Load <Texture2D>(entry.Value);
                _textures.Add(entry.Key, texture);
            }

            return(this);
        }
        public static void Perform()
        {
            var toy = new Toy
            {
                Name         = "TestToy",
                LargeSprite  = GenerateSprite.Default(),
                DamagePoints = new List <ToyDamagePoint>
                {
                    new ToyDamagePoint
                    {
                        Active = true,
                        Type   = "BurstSeam",
                        Sprite = GenerateSprite.Default()
                    },
                }
            };

            var path = DataPath.Get("Toys\\TestToy.json");

            JsonData.SerializeToFile(toy, path);
        }
Beispiel #13
0
        public static SewingKit Initialize(GameDriver driver)
        {
            var path = DataPath.Get("Elements\\SewingKit.json");

            return(JsonData.DeserializeFromFile <SewingKit>(path));
        }