public MainWindow() { //Change locale US (make sure language in application) CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US"); XmlLanguage lang = XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag); FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(lang)); FrameworkContentElement.LanguageProperty.OverrideMetadata(typeof(System.Windows.Documents.TextElement), new FrameworkPropertyMetadata(lang)); InitializeComponent(); logger = LogManager.GetCurrentClassLogger(); prajuritDatabase = new PrajuritDatabase(); prajurits = new List <Prajurit>(); pesertaDataGrid.DataContext = prajurits; senjatas = new Dictionary <int, Senjata>(); recorder = new EventsRecorder(); liveGameController = new LiveGameController(this); replayController = new ReplayGameController(this); watchController = new WatchGameController(this); mapDrawer = new MapDrawer(map, prajurits); mapDrawer.setVisibility(showACheckBox.IsChecked.Value, showBCheckBox.IsChecked.Value); //check checkbox Tim }
public override List <Tile> GetPossibleMovements(Slime slime) { List <Tile> tiles = new List <Tile>(); switch (tutorialStatus) { case TutorialFSMStatus.MOVEFIRSTSLIME: tiles.Add(MapDrawer.GetTileAt(-1, -3)); break; case TutorialFSMStatus.RETURNSLIME: tiles.Add(MapDrawer.GetTileAt(0, -2)); break; case TutorialFSMStatus.MOVESECONDARYSLIME: if (selectedSlime != playerSlime && selectedSlime != null) { tiles.Add(MapDrawer.GetTileAt(1, -2)); } break; case TutorialFSMStatus.MOVETOCONQUER: tiles.Add(MapDrawer.GetTileAt(-1, -1)); break; } return(tiles); }
private static void UserquakeHandler(UserquakeOptions options) { if (options.Areacode.Length != options.Confidence.Length) { Console.Error.WriteLine("The number of elements in Areacode (--areacode) and Confidence (--confidence) must be the same."); return; } var userquakePoints = options.Areacode.Select((areacode, index) => new UserquakePoint(areacode, options.Confidence[index])).ToArray(); if (options.ConfidencesFile != null) { userquakePoints = File.ReadAllLines(options.ConfidencesFile).Select((line) => line.Split(',')).Select((items) => new UserquakePoint(items[0], double.Parse(items[1]))).ToArray(); } var drawer = new MapDrawer() { MapType = options.MapType, Trim = options.Trim, UserquakePoints = userquakePoints, }; var png = drawer.DrawAsPng(); using var file = File.OpenWrite(options.Output); png.CopyTo(file); file.Close(); png.Close(); }
public async Task SetupInit() { if (!await LetLocationStart()) { MessengerService.Toast(this, "Unable to get current location", true); } MapDrawer.MoveCameraZoom(CurrentLocation, 8); try { var path = DatabaseService.GetInstance().GetClosestRiver(); if (path.Points != null) { MapDrawer.DrawLine(path.Points.ToArray()); var launchSites = from p in DatabaseService.GetInstance().Points where p.RiverId == DatabaseService.GetInstance().ClosestRiverId&& p.IsLaunchSite select p; foreach (var site in launchSites) { MapDrawer.DrawMarker(site); } } else { MessengerService.Toast(this, "Failed to get nearest river", true); } } catch (Exception) { MessengerService.Toast(this, "Failed to get nearest river", true); } }
void Start() { inputController = Camera.main.GetComponent <TutorialInputController>(); uiController = Camera.main.GetComponent <TutorialUIController>(); soundController = gameObject.GetComponent <SoundController>(); camController = Camera.main.GetComponent <CameraController>(); TileFactory.tileMaterial = tileMaterial; matrix = new Matrix(MapParser.ReadMap("Maps/tutorial")); MapDrawer.instantiateMap(matrix.getIterable()); players = new List <Player> (); players.Add(new Player("Jugador", StatsFactory.GetStat(SlimeCoreTypes.SLOTH))); // Test with 2 players //players.Add(new Player("IA Tutorial", 1, StatsFactory.GetStat(SlimeCoreTypes.SLOTH))); // Test with 2 players players[0].SetColor(new Color(1, 1, 1)); //players[1].SetColor(new Color(1,0,1)); playerSlime = SlimeFactory.instantiateSlime(players[0], new Vector2(0f, -2f)); //SlimeFactory.instantiateSlime(players[1], new Vector2(0f,2f)); status = GameControllerStatus.WAITINGFORACTION; currentPlayer = players [0]; uiController.UpdateRound(currentTurn + 1); uiController.UpdatePlayer(GetCurrentPlayer().GetColor()); uiController.UpdateActions(playerActions, GetCurrentPlayer().actions); uiController.ShowBothPanels(); InitDialogChains(); InitMarker(); marker.SetParentTransform(playerSlime.transform); marker.SetMarkerRelativeSize(); marker.SetActive(false); FloatingTextController.Initialize(); }
protected override void ThinkAction() { position++; Slime actionSlime = null; if (position == 3) { actionSlime = gameController.GetCurrentPlayer().GetSlimes()[1]; } else { actionSlime = gameController.GetCurrentPlayer().GetSlimes()[0]; } //Solucio cutre if (actions[position].GetAction() == ActionType.ATTACK) { actions[position] = new SlimeAction(ActionType.ATTACK, MapDrawer.GetTileAt(-1, -1).GetSlimeOnTop()); } if (position >= actions.Count) { thoughtAction = new AISlimeAction(actionSlime, ActionType.CONQUER, gameController.GetSelectedSlime().actualTile); } thoughtAction = new AISlimeAction(actionSlime, actions[position]); }
private static void DrawItems(Tile tile, Rectangle target) { Item tileItem = tile.MainObject as Item; if (tileItem != null) { ComponentHasTexture itemVisual = tileItem.GetExactComponent <ComponentHasTexture>(); Point2D topLeft = new Point2D(0, 0); int length = itemVisual.Visuals.Count; for (int i = 0; i < length; i++) { AbstractVisual visual = itemVisual.Visuals[i]; topLeft.X = target.X; topLeft.Y = target.Y; visual.Render(MapDrawer, topLeft); } ItemCountBounds.X = target.Location.X + (TileSize.X / 2); ItemCountBounds.Y = target.Location.Y + TileSize.Y; MapDrawer.DrawText(tileItem.CurrentlyStacked.ToString(), ItemCountBounds, ItemCountFont, SimpleTextRenderer.Alignment.Left, RenderLayer.MapItemCount); } }
/// <summary> /// Draws a tile. /// </summary> private static void DrawTile(Tile tile, Point2D start) { //A target location for 32x textures to be centered in the tile, without being enlarged. X32Target.X = start.X + 16; X32Target.Y = start.Y + 16; ComponentRenderer tileRenderer = tile.GetComponent <ComponentRenderer>(); tileRenderer.Render(MapDrawer, start); TileItemTarget.X = start.X; TileItemTarget.Y = start.Y; DrawItems(tile, TileItemTarget); switch (tile.ImpendingAction) { case MagicalLifeAPI.Entity.AI.Task.ActionSelected.Mine: MapDrawer.Draw(AssetManager.Textures[AssetManager.NameToIndex[TextureLoader.GUIPickaxeMapIcon]], X32Target, RenderLayer.GUI); break; case MagicalLifeAPI.Entity.AI.Task.ActionSelected.Chop: MapDrawer.Draw(AssetManager.Textures[AssetManager.NameToIndex[TextureLoader.GUIAxeMapIcon]], X32Target, RenderLayer.GUI); break; default: //Do nothing. break; } }
public static bool Prefix(MapDrawer __instance, ref string __state) { if (Active) { CellRect visibleSections = __instance.VisibleSections; bool flag = false; foreach (IntVec3 intVec in visibleSections) { Section sect = __instance.sections[intVec.x, intVec.z]; if (__instance.TryUpdateSection(sect)) { Log.Warning("drew a section on screen"); flag = true; } } if (!flag) { for (int i = 0; i < __instance.SectionCount.x; i++) { for (int j = 0; j < __instance.SectionCount.z; j++) { if (__instance.TryUpdateSection(__instance.sections[i, j])) { Log.Warning("full loop"); return(false); } } } } return(false); } return(true); }
public MapComponentSeenFog(Map map) : base(map) { mapCellLength = map.cellIndices.NumGridCells; mapSizeX = map.Size.x; mapSizeZ = map.Size.z; fogGrid = map.fogGrid; thingGrid = map.thingGrid; mapDrawer = map.mapDrawer; designationManager = this.map.designationManager; maxFactionLoadId = 0; foreach (Faction faction in Find.World.factionManager.AllFactionsListForReading) { maxFactionLoadId = Math.Max(maxFactionLoadId, faction.loadID); } factionsShownCells = new int[maxFactionLoadId + 1][]; knownCells = new bool[mapCellLength]; viewBlockerCells = new bool[mapCellLength]; idxToCellCache = new IntVec3[mapCellLength]; compHideFromPlayerGrid = new List <CompHideFromPlayer> [mapCellLength]; compAffectVisionGrid = new List <CompAffectVision> [mapCellLength]; for (int i = 0; i < mapCellLength; i++) { idxToCellCache[i] = CellIndicesUtility.IndexToCell(i, mapSizeX); compHideFromPlayerGrid[i] = new List <CompHideFromPlayer>(16); compAffectVisionGrid[i] = new List <CompAffectVision>(16); } }
public PlotMaker([NotNull] MapDrawer mapDrawer, [NotNull] ILogger logger, [CanBeNull] OsmMapDrawer osmMapDrawer) : base(logger, Stage.Plotting, nameof(PlotMaker)) { OsmMapDrawer = osmMapDrawer; _mapDrawer = mapDrawer; }
public void TryGenerateImage() { var terrainCase = new TerrainCase(0, 0, 0); var wallCase = new WallCase(0, 0); var board = new Board(10, 10); var mapdrawer = new MapDrawer(board); var line = new List <Case>() { terrainCase, wallCase, terrainCase, wallCase, terrainCase, wallCase, terrainCase, wallCase, terrainCase }; var boardLine = new BoardLine(line); for (int i = 0; i < board.Width; i++) { board.BoardContent.Add(boardLine); boardLine.LineContent.Reverse(); } var rand = new Random(); int r; mapdrawer.DrawMap(board); }
//public GameObject playerPrefab; /*public GameObject playerPrefab; * public GameObject wallPrefab; * public Transform mapTransform; * public List<GameObject> floorPrefab;*/ public void InitializeDungeon() { MapManager.map = new Tile[mapWidth, mapHeight]; MD = GetComponent <MapDrawer>(); spawnedEnemiesCount = 0; mapk = MD.mapk; //camera = GetComponent<CameraScript>(); }
// Start is called before the first frame update void Start() { attackingFoes = new List <Transform>(); mapDrawer = FindObjectOfType <MapDrawer>(); gameManager = FindObjectOfType <GameManager>(); parameters = gameManager.parameters; }
/////////////////////////////////////////////////////////////////////////////////////////////////// void Awake() { if (instance == null) instance = this; else if (instance != this) Destroy(gameObject); DontDestroyOnLoad(gameObject); currentMap = new Map ("NewMap", 0, 0, new int[1,1] ); mapDrawer = GetComponent<MapDrawer>(); }
public void Start_() { map_drawer = SceneGlobals.map_drawer; SceneGlobals.map_core = this; CurrentSystem = ReferenceSystem.default_system; Vector3 pivot_point = Vector3.zero; map_drawer.AddSpriteGroup(new Polygon(4, Vector3.zero, Vector3.up, Vector3.right * 130), map_drawer.sprites, new Vector2Int(10, 10), 1); }
// Simply gets the needed references. private void ManagerSetProperties() { mg = GetComponent <MapGenerator>(); drawer = GetComponent <MapDrawer>(); playerSpawner = GetComponent <SpawnPlayer>(); dfs = GetComponent <SpaceDFS>(); spawner = GetComponent <SpawnObjects>(); scaler = statScaler.GetComponent <Scaler>(); }
public ServiceRepository([NotNull] PlotMaker plotMaker, [NotNull] MapDrawer mapDrawer, [NotNull] MySqlConnection sqlConnection, [NotNull] Logger logger, [NotNull] RunningConfig runningConfig, [NotNull] Random rnd) { PlotMaker = plotMaker; MapDrawer = mapDrawer; SqlConnection = sqlConnection; Logger = logger; MyLogger = logger; RunningConfig = runningConfig; Rnd = rnd; }
public override List <Tile> GetSplitRangeTiles(Slime slime) { List <Tile> tiles = new List <Tile> (); switch (tutorialStatus) { case TutorialFSMStatus.SPLITSLIME: tiles.Add(MapDrawer.GetTileAt(0, -1)); break; } return(tiles); }
public void setTutorialActions() { tutorialActions.Add(new SlimeAction(ActionType.SPLIT, MapDrawer.GetTileAt(3, -3))); tutorialActions.Add(new SlimeAction(ActionType.MOVE, MapDrawer.GetTileAt(1, -2))); tutorialActions.Add(new SlimeAction(ActionType.MOVE, MapDrawer.GetTileAt(1, -1))); //Slime 1 tutorialActions.Add(new SlimeAction(ActionType.MOVE, MapDrawer.GetTileAt(-1, -1))); tutorialActions.Add(new SlimeAction(ActionType.CONQUER, MapDrawer.GetTileAt(-1, -1))); tutorialActions.Add(new SlimeAction(ActionType.MOVE, MapDrawer.GetTileAt(0, -1))); //Slime 1 tutorialActions.Add(new SlimeAction(ActionType.FUSION, MapDrawer.GetTileAt(-1, -1))); //Slime 1 tutorialActions.Add(new SlimeAction(ActionType.ATTACK, MapDrawer.GetTileAt(-3, 0))); //tutorialActions.Add(new SlimeAction(ActionType.CONQUER, MapDrawer.GetTileAt(-1, -1))); tutorialActions.Add(new SlimeAction(ActionType.ATTACK, MapDrawer.GetTileAt(-2, 1))); }
private static void DrawItems(Tile tile, Rectangle target) { if (tile.Item != null) { Texture2D texture = AssetManager.Textures[tile.Item.TextureIndex]; MapDrawer.Draw(texture, target, RenderLayer.Items); ItemCountBounds.X = target.Location.X + TileSize.X / 2; ItemCountBounds.Y = target.Location.Y + TileSize.Y; MapDrawer.DrawText(tile.Item.CurrentlyStacked.ToString(), ItemCountBounds, ItemCountFont, SimpleTextRenderer.Alignment.Left, RenderLayer.MapItemCount); } }
static bool Prefix(MapDrawer __instance) { Map map = __instance.map; if (!copyFrom.TryGetValue(map.uniqueID, out MapDrawer keepDrawer)) { return(true); } map.mapDrawer = keepDrawer; keepDrawer.map = map; foreach (Section section in keepDrawer.sections) { section.map = map; for (int i = 0; i < section.layers.Count; i++) { SectionLayer layer = section.layers[i]; if (!ShouldKeep(layer)) { section.layers[i] = (SectionLayer)Activator.CreateInstance(layer.GetType(), section); } else if (layer is SectionLayer_LightingOverlay lighting) { lighting.glowGrid = map.glowGrid.glowGrid; } else if (layer is SectionLayer_TerrainScatter scatter) { scatter.scats.Do(s => s.map = map); } } } foreach (Section s in keepDrawer.sections) { foreach (SectionLayer layer in s.layers) { if (!ShouldKeep(layer)) { layer.Regenerate(); } } } copyFrom.Remove(map.uniqueID); return(false); }
/// <summary> /// Loads a mapDrawer with given SHP file /// </summary> /// <param name="filename">Filename.</param> public void InitMapDrawer(string filename) { try { UIConsole.Debug($"ImageManager -- Initializing MapDrawer with {filename}"); mapDrawer = new MapDrawer(filename); if (mapDrawer.ShapeFile == null) { mapDrawer = null; throw new ArgumentException("Error loading ShapeFile"); } } catch (Exception e) { UIConsole.Error($"ImageManager -- There was an error initializing MapDrawer: {e}"); } }
public TutorialIA(GameController gameController) : base(gameController) { position = -1; actions = new List <SlimeAction>(); //Init actions actions.Add(new SlimeAction(ActionType.CONQUER, MapDrawer.GetTileAt(-4, 1))); actions.Add(new SlimeAction(ActionType.MOVE, MapDrawer.GetTileAt(-3, 2))); actions.Add(new SlimeAction(ActionType.SPLIT, MapDrawer.GetTileAt(-2, 1))); actions.Add(new SlimeAction(ActionType.ATTACK, MapDrawer.GetTileAt(-1, -1))); //Slime 1 actions.Add(new SlimeAction(ActionType.MOVE, MapDrawer.GetTileAt(-3, 0))); actions.Add(new SlimeAction(ActionType.ATTACK, MapDrawer.GetTileAt(-1, -1))); actions.Add(new SlimeAction(ActionType.ATTACK, MapDrawer.GetTileAt(-1, -1))); }
private void Awake() { active = this; drawer = GetComponent <MapDrawer>(); cam = FindObjectOfType <CameraBehaviour>(); raycaster = FindObjectOfType <GraphicRaycaster>(); console = FindObjectOfType <ConsoleBehaviour>(); planet_view = CelestialData.None; planet_hover = CelestialData.None; celestials.Clear(); UpdateChapter(); }
public void Start() { rB = GetComponent <Rigidbody2D>(); //anim = GetComponent<Animator>(); anim = GetComponent <PlayerAnimator>(); //canvasTransform = GameObject.Find("UI").transform; staminaBar = GameObject.FindGameObjectWithTag("StaminaBar").GetComponent <Image>(); healthBar = GameObject.FindGameObjectWithTag("HealthBar").GetComponent <Image>(); staminaBar.fillAmount = 1f; healthBar.fillAmount = 1f; gameManager = GameObject.Find("GameManager"); MD = gameManager.GetComponent <MapDrawer>(); dungeon = gameManager.GetComponent <DungeonGenerator>(); ////////////////////////////////////////////////////////////////////// ///HIT BOX не беретс¤///////////////////////////////////////////// mapk = MD.mapk; mapWidth = dungeon.mapWidth; mapHeight = dungeon.mapHeight; health = maxHealth; stamina = maxStamina; defence = 1; staminaPerAttack = 30; isDied = false; foreach (var hitBox in hitBoxes) { HitBox hB = hitBox.GetComponent <HitBox>(); hB.damage = damage; hB.thrust = strength; hB.owner = "Player"; } curEffectsIncrease = new Dictionary <typeEnum, float> { [typeEnum.speed] = 0, [typeEnum.stamina] = 0, [typeEnum.strength] = 0 }; curEffectsDuring = new Dictionary <typeEnum, float> { [typeEnum.speed] = 0, [typeEnum.stamina] = 0, [typeEnum.strength] = 0 }; }
/// <summary> /// Loads default map drawer /// </summary> public void InitMapDrawer() { try { UIConsole.Debug($"ImageManager -- Initializing MapDrawer with {DefaultShapeFile}"); mapDrawer = new MapDrawer(DefaultShapeFile); if (mapDrawer.ShapeFile != null) { return; } mapDrawer = null; throw new ArgumentException("Error loading ShapeFile"); } catch (Exception e) { UIConsole.Error($"ImageManager -- There was an error initializing MapDrawer: {e}"); } }
public override List <Tile> GetJoinTile(Slime slime) { List <Tile> tiles = new List <Tile> (); switch (tutorialStatus) { case TutorialFSMStatus.JOINSLIME: if (selectedSlime != playerSlime && selectedSlime != null) { tiles.Add(MapDrawer.GetTileAt(0, -2)); } break; } return(tiles); }
public override List <Tile> GetSlimesInAttackRange(Slime slime) { List <Tile> tiles = new List <Tile> (); switch (tutorialStatus) { case TutorialFSMStatus.ATTACKSLIME: tiles.Add(MapDrawer.GetTileAt(0, 0)); break; default: break; } return(tiles); }
void Start() { map = new Map((int)MapSize.x, (int)MapSize.y); map.SeedFlowers(1); foreach (FlowerType flower in InitialSpawns) { map.SeedFlowers(2, flower); } mapRect = new Rect(0, 0, MapSize.x, MapSize.y); mapDrawer = GetComponent <MapDrawer>(); mapDrawer.DrawMap(map); }
public ServiceRepository([NotNull] PlotMaker plotMaker, [NotNull] MapDrawer mapDrawer, [NotNull] Logger logger, [NotNull] RunningConfig runningConfig, [NotNull] Random rnd) { PlotMaker = plotMaker; MapDrawer = mapDrawer; Logger = logger; MyLogger = logger; RunningConfig = runningConfig; Rnd = rnd; SqlConnectionPreparer = new SqlConnectionPreparer(runningConfig); StartingTime = DateTime.Now; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Start() { mapDrawer = GameManager.instance.GetComponent<MapDrawer>(); }
void Start() { if (instance == null) instance = this; editedMap = GameManager.instance.currentMap; mapDrawer = GameManager.instance.GetComponent<MapDrawer>(); terrainHolder = new GameObject ("Terrain"); tilesGOarray = new GameObject[editedMap.width,editedMap.height]; savePanel.SetActive (false); mapDrawer.DrawTerrain (editedMap, terrainHolder); PlaceTheCam (); }