예제 #1
0
        public static void Example()
        {
            var loader = new JsonLoader();
            var data   = loader.LoadObject <Data>("TestLoader/config");

            foreach (var actor in data.Actors)
            {
                Logger.Log($"actor type: {actor.Key}, name: {actor.Value.Name}, age: {actor.Value.Age}");
            }
        }
예제 #2
0
        public static void Example()
        {
            var loader = new JsonLoader();
            var data   = loader.LoadObject <Data>("TestLoader/config");

            foreach (var actor in data.Actors)
            {
                Logger.Log(actor.Value.GetType().ToString());
            }

            var zombie = data.Actors.Values.First(actor => actor is Zombie) as Zombie;

            Logger.Log(zombie?.SomeZombieField);
        }
예제 #3
0
        private void TestWithRemoteConfig()
        {
            LoadConfig();

            void LoadConfig()
            {
                var loader = new JsonLoader();
                var data   = loader.LoadObject <ConfigData>("config");//objects creating by factory inside TypeBaseConverter

                foreach (var item in data.Components)
                {
                    Logger.Log(item.Value.GetType().ToString());
                }
            }
        }