Example #1
0
        static void Main(string[] args)
        {
            IContainer container = new Container();

            ContainerInitiazer.Initialize(container);

            string         map_file        = "/home/gvso/Desktop/WEMSimUnity/Unity/Assets/Scripts/Example/Config/example.map.yml";
            MapInitializer map_initializer =
                (MapInitializer)container.Get("map.initializer");

            map_initializer.Initialize(map_file);

            //Map map = (Map) container.Get("map");
            //Console.Write(map);

            List <string> agenda_files = new List <string> ();

            agenda_files.Add("/home/gvso/Desktop/WEMSimUnity/Unity/Assets/Scripts/Example/Config/Agendas/example.agenda.yml");
            agenda_files.Add("/home/gvso/Desktop/WEMSimUnity/Unity/Assets/Scripts/Example/Config/Agendas/example2.agenda.yml");

            AgendaInitializer agenda_initializer =
                (AgendaInitializer)container.Get("agenda.initializer");

            agenda_initializer.Initialize(agenda_files);

            AgendaContainer agenda_container = (AgendaContainer)container.Get("agenda.container");

            Console.WriteLine(agenda_container.Get("example.agenda"));
            /*Console.WriteLine(agenda_container.Get("example2.agenda"));*/
        }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        rotation = this.transform.localRotation;


        if (StageReset || MapInitializer.GetSpawnEnable())
        {
            characterController         = GetComponent <CharacterController>();
            characterController.enabled = false;
            abc.x = MapInitializer.GetSpawnData("px");
            abc.y = MapInitializer.GetSpawnData("py");
            abc.z = MapInitializer.GetSpawnData("pz");
            UpdatePlayerXYZ(abc.x, abc.y, abc.z);
        }
        px = this.transform.position.x;
        py = this.transform.position.y;
        pz = this.transform.position.z;
        rx = this.transform.rotation.x;
        ry = this.transform.rotation.y;
        rz = this.transform.rotation.z;

        //リセット処理その2(その1はFirstPersonController.cs)
        // if (Input.GetKey(KeyCode.Return)) {
        //     characterController.enabled = false;
        //     ClearCheckFlg = true; }

        if (ClearCheckFlg)
        {
            // UpdatePlayerXYZ(abc.x, 15, abc.z);
        }
    }
Example #3
0
        public void CompileMapInitializer(MapInitializer mapInit)
        {
            XmlElement tmpElement = document.CreateElement("MapInitializer");

            ProcessMapItemInitializers(tmpElement, mapInit.ItemInitializers);
            currentElement.AppendChild(tmpElement);
        }
Example #4
0
    public override void Initialize()
    {
        _map = gameObject.AddComponent <MapInitializer> ();
        _map.Initialize(_mapPrefab, TerraMysticaParameters._mapPath);
        _map.LoadMap();

        InitializeCamera();
    }
Example #5
0
    public override void Initialize()
    {
        TerraMysticaParameters.Initialize();
        Debug.Log("--- Path: " + TerraMysticaParameters._mapPath);

        _map = gameObject.AddComponent <MapInitializer> ();
        _map.Initialize(_mapPrefab, TerraMysticaParameters._mapPath);
        _map.LoadMap();
    }
Example #6
0
        static GetDonationsForParticipants()
        {
            MapInitializer.Activate();

            if (participants == null)
            {
                participants = new ConcurrentDictionary <Guid, ParticipantDto>();
            }
        }
Example #7
0
        public void Initialize_Test()
        {
            // Create the object to test.
            MapInitializer mapInitializer = new MapInitializer();

            // Setup some simple training data.
            IList <Vector> trainingData = new List <Vector>
            {
                new Vector {
                    1, 3
                },
                new Vector {
                    2, 4
                },
                new Vector {
                    5, 3
                }
            };

            // Determine the min and max based on the training data.
            double min = trainingData.Min(vector => vector.Min());
            double max = trainingData.Max(vector => vector.Max());

            // Determine the depth of the map based on the training data.
            int depth = trainingData.First().Count;

            // Setup a map to initialize.
            Map map = new Map(width: 2, height: 2, depth: depth);

            // Execute the code to test.
            mapInitializer.Initialize(map, trainingData);

            // Verify that the map is filled with MapNodes with correct data.
            for (int x = 0; x < map.Width; x++)
            {
                for (int y = 0; y < map.Height; y++)
                {
                    MapNode mapNode = map[x, y];

                    Assert.IsNotNull(mapNode, "MapNode");
                    Assert.AreEqual(x, mapNode.X, "MapNode.X");
                    Assert.AreEqual(y, mapNode.Y, "MapNode.Y");
                    Assert.IsNotNull(mapNode.Weights, "MapNode.Weights");
                    Assert.AreEqual(depth, mapNode.Weights.Count, "MapNode.Weights.Count");

                    // Verify that the MapNodes weights are within the allowed bounds.
                    for (int z = 0; z < depth; z++)
                    {
                        double weight = mapNode.Weights[z];

                        Assert.IsTrue(weight >= min, "Min");
                        Assert.IsTrue(weight <= max, "Max");
                    }
                }
            }
        }
Example #8
0
        internal static void Main(string[] args)
        {
            MapInitializer.Initialize();

            using (IrcBot bot = new IrcBot(IrcConfiguration.GetConfig()))
            {
                bot.OpenConnection();
                bot.Start();
            }
        }
Example #9
0
        public MapPage()
        {
            InitializeComponent();

            SetButtons();
            MapInitializer.StyleMap(MainMap);
            UpdateMap();

            MessagingCenter.Subscribe <EventArgs>(this, "RefreshData", args => {
                UpdateMap();
            });
        }
Example #10
0
        private void Awake()
        {
            var mapInitializer = new MapInitializer(_gridWidth, _gridLength, _floorDetectionLayerMask);

            _baseGrid = mapInitializer.InitializeBaseGrid();
            for (var i = 1; i < _scalesCount; i++)
            {
                _higherScaleGrids.Add(mapInitializer.InitializeHigherScaleGrid(_baseGrid, i));
            }

            _dangers = new DangerStore(_baseGrid, FindObjectsOfType <BulletsFactory>());
        }
Example #11
0
        //private static void DumpFormats()
        //{
        //    var manager = new DriverManager();
        //    manager.DumpExtensions(true);

        //    manager.DumpExtensions(false);
        //}

        private static void LoadConfig(IApplicationContainer container)
        {
            Logger.Current.Trace("Start LoadConfig");
            MapInitializer.InitMapConfig();

            Logger.Current.Trace("Before container.GetSingleton");
            var configService = container.GetSingleton <IConfigService>();

            Logger.Current.Trace("After container.GetSingleton");

            configService.LoadAll();
            Logger.Current.Trace("End LoadConfig");
        }
Example #12
0
        private IGameContext GetGameServer()
        {
            var contextProvider = new InMemoryPersistenceContextProvider();
            var gameConfig      = contextProvider.CreateNewContext().CreateNew <GameConfiguration>();

            gameConfig.Maps.Add(contextProvider.CreateNewContext().CreateNew <GameMapDefinition>());

            var mapInitializer = new MapInitializer(gameConfig);
            var gameServer     = new GameContext(gameConfig, contextProvider, mapInitializer);

            gameServer.Configuration.MaximumPartySize = 5;

            return(gameServer);
        }
Example #13
0
        private IGameContext GetGameServer()
        {
            var contextProvider = new InMemoryPersistenceContextProvider();
            var gameConfig      = contextProvider.CreateNewContext().CreateNew <GameConfiguration>();

            gameConfig.Maps.Add(contextProvider.CreateNewContext().CreateNew <GameMapDefinition>());

            var mapInitializer = new MapInitializer(gameConfig, new NullLogger <MapInitializer>());
            var gameServer     = new GameContext(gameConfig, contextProvider, mapInitializer, new NullLoggerFactory(), new PlugInManager(new List <PlugInConfiguration>(), new NullLoggerFactory(), null));

            gameServer.Configuration.MaximumPartySize = 5;

            return(gameServer);
        }
Example #14
0
    private List <GameObject> m_spawnList     = new List <GameObject>();      //ID・スポナーのリスト

    //初期化
    void Awake()
    {
        //マップ初期化クラス
        initializer = this.gameObject.GetComponent <MapInitializer>();

        //マップ切り替え時の処理を設定
        m_nowMapID.mChanged += value =>
        {
            //マップチップ情報を取得
            m_nowMap = MapInitializer.MAP_DATA;
            //スタート部屋IDを取得
            m_startId = initializer.StartID();
            //ID・部屋リストを取得
            initializer.GetRooms(out m_roomList);
        };
    }
Example #15
0
        public void Initialize_ExceptionOnEmptyTrainingData_Test()
        {
            MapInitializer mapInitializer = new MapInitializer();

            try
            {
                mapInitializer.Initialize(map: new Map(0, 0, 0), trainingData: new List <Vector>());
            }
            catch (ArgumentException argumentException)
            {
                Assert.AreEqual(
                    string.Format("Unable to initialize a self-organizing map without training data.{0}Parameter name: trainingData", Environment.NewLine),
                    argumentException.Message);

                throw;
            }
        }
Example #16
0
        public void Initialize_ExceptionOnNullMap_Test()
        {
            MapInitializer mapInitializer = new MapInitializer();

            try
            {
                mapInitializer.Initialize(map: null, trainingData: new List <Vector>());
            }
            catch (ArgumentNullException argumentNullException)
            {
                Assert.AreEqual(
                    string.Format("Unable to initialize a null self-organizing map.{0}Parameter name: map", Environment.NewLine),
                    argumentNullException.Message);

                throw;
            }
        }
Example #17
0
        /// <summary>
        /// Gets the player.
        /// </summary>
        /// <returns>The test player.</returns>
        public static Player GetPlayer()
        {
            var gameConfig = MockRepository.GenerateStub <GameConfiguration>();

            gameConfig.RecoveryInterval = int.MaxValue;
            gameConfig.Stub(c => c.Maps).Return(new List <GameMapDefinition>());
            gameConfig.Stub(c => c.Items).Return(new List <ItemDefinition>());
            var map = MockRepository.GenerateStub <GameMapDefinition>();

            map.Stub(m => m.DropItemGroups).Return(new List <DropItemGroup>());
            map.Stub(m => m.MonsterSpawns).Return(new List <MonsterSpawnArea>());
            gameConfig.Maps.Add(map);

            var mapInitializer = new MapInitializer(gameConfig, null);
            var gameContext    = new GameContext(gameConfig, new InMemoryPersistenceContextProvider(), null, mapInitializer);

            return(GetPlayer(gameContext));
        }
Example #18
0
    void Update()
    {
        //初期座標の更新
        if (MapInitializer.GetSpawnEnable())
        {
            float ini_x = MapInitializer.GetSpawnData("px");
            float ini_y = MapInitializer.GetSpawnData("py");
            float ini_z = MapInitializer.GetSpawnData("pz");
            playerTransform.position = new Vector3(ini_x, ini_y, ini_z);
        }

        // マウスで視点移動
        float x_rotate = Input.GetAxis("Mouse X") * 3.0f;
        float y_rotate = Input.GetAxis("Mouse Y");

        playerTransform.transform.Rotate(0, x_rotate, 0);
        cameraTransform.transform.Rotate(-y_rotate, 0, 0);

        // WASDで移動する
        float x = 0.0f;
        float z = 0.0f;

        if (Input.GetKey(KeyCode.D))
        {
            x += 1.0f;
        }
        if (Input.GetKey(KeyCode.A))
        {
            x -= 1.0f;
        }
        if (Input.GetKey(KeyCode.W))
        {
            z += 1.0f;
        }
        if (Input.GetKey(KeyCode.S))
        {
            z -= 1.0f;
        }

        Vector3 move = z * playerTransform.forward + x * playerTransform.right;

        rb.velocity = move * speed;
    }
Example #19
0
        /**
         * Initializes all the essentials services.
         *
         * @param IContainer container
         *   The service container where to store the services.
         */
        public static void Initialize(IContainer container)
        {
            /*
             * These services do not depend on anything.
             */
            container.Set("map", Map.Map.create(container));
            container.Set("agenda.container", AgendaContainer.create(container));
            container.Set("agenda.generator", AgendaGenerator.create(container));
            container.Set("yaml.agenda.deserializer", AgendaDeserializer.create(container));
            container.Set("yaml.map.deserializer", MapDeserializer.create(container));

            /*
             * These services depends on other services.
             */
            container.Set("map.initializer", MapInitializer.create(container));

            // Agenda Initializer expects the map to be fully initialized.
            container.Set("agenda.initializer", AgendaInitializer.create(container));
        }
Example #20
0
        public NewJobLocation(Job Job) : base(Job)
        {
            var rlayout = new RelativeLayout();

            map = new Xamarin.Forms.GoogleMaps.Map();
            MapInitializer.StyleMap(map);
            _ = MapInitializer.CenterOnUserAsync(map);
            StackLayout.Children.Add(rlayout);
            Title = "Pick the location!";

            rlayout.Children.Add(map,
                                 Constraint.Constant(0),
                                 Constraint.Constant(0),
                                 Constraint.RelativeToParent(rl => rl.Width),
                                 Constraint.RelativeToParent(rl => rl.Height));

            var center_on_location_button = new ImageButton()
            {
                Source          = "target.png",
                BackgroundColor = new Color(0, 0, 0, 0),
            };

            center_on_location_button.Clicked += CenterOnLocationAsync;
            rlayout.Children.Add(center_on_location_button,
                                 Constraint.RelativeToParent(rl => rl.Width - rl.Width * 0.16),
                                 Constraint.RelativeToParent(rl => rl.Width * 0.04),
                                 Constraint.RelativeToParent(rl => rl.Width * 0.12),
                                 Constraint.RelativeToParent(rl => rl.Width * 0.12));


            var pin = new Image()
            {
                Source = "map_pin_red.png",
            };

            rlayout.Children.Add(pin,
                                 Constraint.RelativeToParent(rl => rl.Width / 2 - rl.Width * 0.05),
                                 Constraint.RelativeToParent(rl => rl.Height / 2 - rl.Width * 0.10),
                                 Constraint.RelativeToParent(rl => rl.Width * 0.10),
                                 Constraint.RelativeToParent(rl => rl.Width * 0.10));
        }
Example #21
0
        /// <summary>
        /// Gets the player.
        /// </summary>
        /// <returns>The test player.</returns>
        public static Player GetPlayer()
        {
            var gameConfig = new Mock <GameConfiguration>();

            gameConfig.SetupAllProperties();
            gameConfig.Setup(c => c.Maps).Returns(new List <GameMapDefinition>());
            gameConfig.Setup(c => c.Items).Returns(new List <ItemDefinition>());
            gameConfig.Setup(c => c.Skills).Returns(new List <Skill>());
            var map = new Mock <GameMapDefinition>();

            map.SetupAllProperties();
            map.Setup(m => m.DropItemGroups).Returns(new List <DropItemGroup>());
            map.Setup(m => m.MonsterSpawns).Returns(new List <MonsterSpawnArea>());
            gameConfig.Object.RecoveryInterval = int.MaxValue;
            gameConfig.Object.Maps.Add(map.Object);

            var mapInitializer = new MapInitializer(gameConfig.Object, null);
            var gameContext    = new GameContext(gameConfig.Object, new InMemoryPersistenceContextProvider(), null, mapInitializer);

            return(GetPlayer(gameContext));
        }
Example #22
0
        async void UpdateMap()
        {
            MainMap.Pins.Clear();

            await MapInitializer.CenterOnUserAsync(MainMap);



            MainMap.InfoWindowClicked += InfoWindowClicked;
            //adding pins where jobs are
            ServiceManager.GetService <JobService>().GetAllJobs()
            .ForEach(job => {
                var pin = new Pin()
                {
                    Label          = job.Title,
                    Position       = job.Location,
                    BindingContext = job,
                    Icon           = BitmapDescriptorFactory.FromBundle("map_pin")
                };
                MainMap.Pins.Add(pin);
            });
        }
Example #23
0
        /// <summary>
        /// Gets the player.
        /// </summary>
        /// <returns>The test player.</returns>
        public static Player GetPlayer()
        {
            var gameConfig = new Mock <GameConfiguration>();

            gameConfig.SetupAllProperties();
            gameConfig.Setup(c => c.Maps).Returns(new List <GameMapDefinition>());
            gameConfig.Setup(c => c.Items).Returns(new List <ItemDefinition>());
            gameConfig.Setup(c => c.Skills).Returns(new List <Skill>());
            gameConfig.Setup(c => c.PlugInConfigurations).Returns(new List <PlugInConfiguration>());
            var map = new Mock <GameMapDefinition>();

            map.SetupAllProperties();
            map.Setup(m => m.DropItemGroups).Returns(new List <DropItemGroup>());
            map.Setup(m => m.MonsterSpawns).Returns(new List <MonsterSpawnArea>());
            map.Object.TerrainData             = new byte[ushort.MaxValue + 3];
            gameConfig.Object.RecoveryInterval = int.MaxValue;
            gameConfig.Object.Maps.Add(map.Object);

            var mapInitializer = new MapInitializer(gameConfig.Object, new NullLogger <MapInitializer>());
            var gameContext    = new GameContext(gameConfig.Object, new InMemoryPersistenceContextProvider(), mapInitializer, new NullLoggerFactory(), new PlugInManager(null, new NullLoggerFactory(), null));

            return(GetPlayer(gameContext));
        }
Example #24
0
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        GameObject map = null;

        if (useTestMap)
        {
            map = LoadMap();
            LoadTiles();
            this.GetComponent <FogInitializer>().GenerateFog(-7, 7, -15, 17);
        }
        else
        {
            MapGeneratorScript initializer = this.GetComponent <MapGeneratorScript>();
            map = initializer.GenerateMap();
            this.GetComponent <FogInitializer>().GenerateFog(0, initializer.WIDTH, 0, initializer.HEIGTH);
        }
        LoadPlayerUnits(map);
        initialized = true;
    }
Example #25
0
 public void CompileMapInitializer(MapInitializer mapInit)
 {
     DumpMapItemInitializersList(mapInit.ItemInitializers);
 }
 public WheelRimServiceTests()
 {
     MapInitializer.InitializeMapper();
 }
Example #27
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject initObj = GameObject.Find("MapController");

        mapInitializer = initObj.GetComponent <MapInitializer>();
    }
 public MainWindow()
 {
     InitializeComponent();
     _markersHandler = new MarkersHandler();
     gmapHost.Child  = MapInitializer.GetGMapControl();
 }
 public MotorOilServiceTests()
 {
     MapInitializer.InitializeMapper();
 }
Example #30
0
 void Start()
 {
     abc.x = MapInitializer.GetSpawnData("rx");
     abc.y = MapInitializer.GetSpawnData("ry");
     abc.z = MapInitializer.GetSpawnData("rz");
 }