예제 #1
0
        public void Callback_Mine(bool isEmergency)
        {
            var playerGroup = Game.Map.FindGroup <GameLogic.Groups.PlayerGroup>();
            var data        = new Window_SelectTiles.TilesSelectionData(
                (tilePos) =>
                (Game.Map.Tiles[tilePos].IsMinable() &&
                 !playerGroup.JobQueries.AnyJobsAffecting(tilePos)),
                true, "WINDOW_MINEPOSES_TITLE", "WINDOW_MINEPOSES_MESSAGE");

            data.OnFinished += (tilePoses) =>
            {
                if (tilePoses != null)
                {
                    playerGroup.AddJob(new GameLogic.Units.Player_Char.Job_Mine(tilePoses,
                                                                                isEmergency,
                                                                                Game.Map));
                }

                //Destroy this window.
                Callback_Button_Close();
            };
            var wnd = (Window_SelectTiles)ContentUI.Instance.CreateWindow(
                ContentUI.Instance.Window_SelectTiles, data);

            wnd.Callback_WorldTileClicked(Target);
        }
예제 #2
0
        public void Callback_NewJob_Mine(bool makeEmergency)
        {
            //Ask the player to select any other tiles to mine.
            var playerGroup = Game.Map.FindGroup <GameLogic.Groups.PlayerGroup>();
            var data        = new Window_SelectTiles.TilesSelectionData(
                (tilePos) =>
                (Game.Map.Tiles[tilePos].IsMinable() &&
                 !playerGroup.JobQueries.AnyJobsAffecting(tilePos)),
                true, "WINDOW_MINEPOSES_TITLE", "WINDOW_MINEPOSES_MESSAGE");

            data.OnFinished += (tilePoses) =>
            {
                if (tilePoses != null)
                {
                    Target.AddJob(new Job_Mine(tilePoses, makeEmergency, Game.Map));
                }
            };
            ContentUI.Instance.CreateWindow(ContentUI.Instance.Window_SelectTiles, data);
        }