public TilePaletteWindow(ISubscriber subscriber, TileSettings tileSettings, IAssetsDatabase assetsDatabase) { _tileSettings = tileSettings; _assetsDatabase = assetsDatabase; subscriber.Subscribe <ComponentAddedMessage>(Handle); subscriber.Subscribe <ComponentRemovedMessage>(Handle); }
private static async Task GenerateTileImagesAsyncInternal(Border mediumTileHost, Border wideTileHost, TileSettings settings) { var tileModel = await TileModelBuilder.BuildTileModelAsync(settings); await TileImageGenerator.GenerateMediumTileImageFileAsync(tileModel, mediumTileHost); await TileImageGenerator.GenerateWideTileImageFileAsync(tileModel, wideTileHost); }
// Use this for initialization void Start () { // init grid tiles = new TileSettings[countX][]; for (int i = 0; i < countX; i++) { tiles [i] = new TileSettings[countY]; for (int j = 0; j < countY; j++) { tiles [i] [j] = new TileSettings (); } } // load map, set isCollide to grid foreach (Transform layerObject in mapObject.transform) { foreach (Transform child in layerObject) { //Debug.Log ("child is found " + child.position.x + ", " + child.position.y); PolygonCollider2D coll = child.GetComponent<PolygonCollider2D> (); if (null == coll) continue; IntVec2 coords = getTileCoordsByTransformCoords (child.position); Debug.Log ("mark as collided: " + coords.x + ", " + coords.y); tiles [coords.x] [coords.y].isCollide = true; } } InvokeRepeating ("UpdatePathFinder", 0, updateTime); }
public ConfigureTileCommand(Map map, Tile target, TileSettings setting) { this.newSettings = setting; this.targetTile = target; this.map = map; pos = map.getTilePos(target.ID); }
public Tile(string prefabPath, Vector3 scale) { this.ID = lastID + 1; this.Scale = scale; lastID = this.ID; this.PrefabPath = prefabPath; this.Settings = new TileSettings(); }
private string CreateIcon(TileSettings tileSettings, string baseName, string folderPath) { var iconName = $"{baseName}.ico"; var iconPath = Path.Combine(folderPath, iconName); SaveIcon(tileSettings.Image, iconPath); TouchFile(iconPath); return(iconPath); }
public TileSettings(TileSettings clone) { this.minTriggerSize = clone.minTriggerSize; triggerTargets = new int[clone.triggerTargets.Length]; for (int i = 0; i < clone.triggerTargets.Length; i++) { this.triggerTargets[i] = clone.triggerTargets[i]; } }
void removeTargets() { TileSettings newSettings = new TileSettings(tile.Settings); newSettings.triggerTargets = new int[0]; ConfigureTileCommand command = new ConfigureTileCommand(creator.Level, tile, newSettings); creator.Commands.perform(command); }
public MainPage() { InitializeComponent(); NavigationCacheMode = NavigationCacheMode.Required; TileSettings = new TileSettings(); TileSettings.Load(); DataContext = TileSettings; }
void Generate() { // Layer for (int i = 0; i < layerSettings.Length; i++) { // For each tile setting in the layer settings, populate the ONE tilemap // on the layer game object // Later tiles will overwrite previous tiles! for (int j = 0; j < layerSettings[i].tileSettings.Length; j++) { TileSettings curSettings = layerSettings[i].tileSettings[j]; float[,] noiseMap = NoiseGenerator.GenerateNoiseMap(totalSize.x, totalSize.y, seed, curSettings.scale, curSettings.octaves, curSettings.persistance, curSettings.lacunarity, curSettings.offset); // Populate the tilemaps for each layer of each chunk for (int x = 0; x < chunkCnt.x; x++) { for (int y = 0; y < chunkCnt.y; y++) { // Get the tilemap for this layer Tilemap tm = mapChunks[x * chunkCnt.x + y].layers[i].go.GetComponent <Tilemap>(); for (int tx = 0; tx < chunkSize.x; tx++) { for (int ty = 0; ty < chunkSize.y; ty++) { // Using only one noisemap per tile type so setting // tile based on the offset here // This should match the world position and noisemap position Vector3Int offset = new Vector3Int(tx + (x * chunkSize.x), ty + (y * chunkSize.y), 0); if (noiseMap[offset.x, offset.y] > curSettings.noiseThreshold) { if (curSettings.noiseMapMode) { tm.SetTile(offset, curSettings.tileType); tm.SetTileFlags(offset, TileFlags.None); tm.SetColor(offset, Color.Lerp(Color.white, Color.black, noiseMap[offset.x, offset.y])); } else if (curSettings.randomizeDensity && (noiseMap[offset.x, offset.y] > Random.value)) { tm.SetTile(offset, curSettings.tileType); } else if (!curSettings.randomizeDensity) { tm.SetTile(offset, curSettings.tileType); } } } } } } } } }
public IEnumerable <LinkTypes> GetSupportedLinkTypes(TileSettings tileSettings) { if (tileSettings.Uri.IsFile) { yield return(LinkTypes.DirectLink); yield return(LinkTypes.ProxyLink); } else { yield return(LinkTypes.ProxyLink); } }
private static TileSettings LoadConfiguration() { var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddUserSecrets <TileSettings>(true) .Build(); var settings = new TileSettings(); configuration.Bind(settings); return(settings); }
/// <summary> /// Removes a specified tileSettings object from list /// </summary> /// <param name="fileName">The TileSettings.settingsName string to remove</param> public void RemoveTilePreset(string name) { TileSettings toDeleteRef = null; foreach (TileSettings tileSettings in tileSettingsArray) { if (tileSettings.settingsName == name) { toDeleteRef = tileSettings; } } tileSettingsArray.Remove(toDeleteRef); }
public override void configure(TileSettings settings, LevelLoader loader) { foreach (int targetID in settings.triggerTargets) { Debug.Log(targetID); TilePrefab target = loader.getTileInstance(targetID); Debug.Log(target); Debug.Log(target.GetType()); if (typeof(Triggerable).IsAssignableFrom(target.GetType())) { targets.Add((Triggerable)target); } } }
public void CreateDirectLink(TileSettings tileSettings) { if (!tileSettings.Uri.IsFile) { throw new ArgumentException("Path must lead to a local file.", nameof(tileSettings.Uri)); } string localPath = tileSettings.Uri.ToString(); var baseName = Path.GetFileNameWithoutExtension(localPath); var folderPath = Path.GetDirectoryName(localPath); string imageName_150 = CreateImage(tileSettings, baseName, folderPath, 150); string imageName_75 = CreateImage(tileSettings, baseName, folderPath, 70); string manifestPath = CreateManifest(tileSettings.Name, tileSettings, baseName, folderPath, imageName_150, imageName_75); }
public void CreateProxyLink(TileSettings tileSettings) { var baseName = String.Join("", new Regex(@"[A-Za-z\d]").Matches(tileSettings.Name).Cast <Match>().Select(o => o.Value)); var folderPath = _proxyFolderPath; var startMenuPath = _proxyStartMenuPath; string executablePath = CreateProxyExecutable(tileSettings.Uri, baseName, folderPath); string imageName_150 = CreateImage(tileSettings, baseName, folderPath, 150); string imageName_75 = CreateImage(tileSettings, baseName, folderPath, 70); string iconPath = CreateIcon(tileSettings, baseName, folderPath); string manifestPath = CreateManifest(tileSettings.Name, tileSettings, baseName, folderPath, imageName_150, imageName_75); string linkName = CreateLink(tileSettings.Name, baseName, startMenuPath, executablePath, iconPath); }
public static IBitmap ToBitmap(this ITile[,] tiles, TileSettings settings = null, Player player = null) { if (settings == null) { settings = TileSettings.Default; } IBitmap output = new Picture(16 * tiles.GetLength(0), 16 * tiles.GetLength(1), Palette); for (int yy = 0; yy < tiles.GetLength(1); yy++) { for (int xx = 0; xx < tiles.GetLength(0); xx++) { ITile tile = tiles[xx, yy]; if (tile == null || player != null && !player.Visible(tile)) { continue; } int x = (xx * 16), y = (yy * 16); output.AddLayer(tile.ToBitmap(settings, player), x, y, dispose: true); } } if (settings.CityLabels) { for (int yy = 0; yy < tiles.GetLength(1) - 1; yy++) { for (int xx = 0; xx < tiles.GetLength(0); xx++) { ITile tile = tiles[xx, yy]; if (tile == null || tile.City == null || player != null && !player.Visible(tile)) { continue; } int x = (xx == 0) ? 0 : (xx * 16) - 8; int y = (yy * 16) + 16; string label = tile.City.Name; output.DrawText(label, x, y, CityLabel); } } } return(output); }
void addTargets(List <Tile> tiles) { TileSettings newSettings = new TileSettings(tile.Settings); List <int> targets = new List <int>(newSettings.triggerTargets); foreach (Tile t in tiles) { if (!targets.Contains(t.ID)) { targets.Add(t.ID); } } newSettings.triggerTargets = targets.ToArray(); ConfigureTileCommand command = new ConfigureTileCommand(creator.Level, tile, newSettings); creator.Commands.perform(command); }
public static void UpdateTile(TileSettings settings) { if (!TileExists) { return; } var mediumTileContent = TileContentFactory.CreateTileSquare150x150Image(); mediumTileContent.Branding = TileBranding.None; mediumTileContent.Image.Src = Constants.MediumTileImageFileUriNoCache; var wideTileContent = TileContentFactory.CreateTileWide310x150Image(); wideTileContent.Branding = settings.ShowWideTileBranding ? TileBranding.Name : TileBranding.None; wideTileContent.Image.Src = Constants.WideTileImageFileUriNoCache; wideTileContent.Square150x150Content = mediumTileContent; TileUpdateManager.CreateTileUpdaterForSecondaryTile(Constants.TileId).Update(wideTileContent.CreateNotification()); }
private string CreateImage(TileSettings tileSettings, string baseName, string folderPath, int resolution) { var resizedImage = tileSettings.Image.CreateResizedImage(resolution, resolution, false); var imageName = $"{baseName}_{resolution}x{resolution}.png"; var imagePath = Path.Combine(folderPath, imageName); resizedImage.SaveAsPng(imagePath); //using (var fileStream = new FileStream(imagePath, FileMode.Create)) //{ // BitmapEncoder encoder = new PngBitmapEncoder(); // var frame = BitmapFrame.Create(tileSettings.Image); // encoder.Frames.Add(frame); // encoder.Save(fileStream); //} TouchFile(imagePath); return(imageName); }
private static async Task CreateTileAsyncInternal(TileSettings settings) { if (TileExists) { return; } var tile = new SecondaryTile(); tile.TileId = Constants.TileId; tile.DisplayName = Constants.TileDisplayName; tile.Arguments = Constants.LaunchCalendarArguments; tile.VisualElements.Square71x71Logo = new Uri(Constants.SmallTileImageFileUri); tile.VisualElements.Square150x150Logo = new Uri(Constants.MediumTileImageFileUriNoCache); tile.VisualElements.Wide310x150Logo = new Uri(Constants.WideTileImageFileUriNoCache); tile.VisualElements.ShowNameOnSquare150x150Logo = false; tile.VisualElements.ShowNameOnWide310x150Logo = settings.ShowWideTileBranding; await tile.RequestCreateAsync().AsTask(); }
private string CreateManifest(string name, TileSettings tileSettings, string baseName, string folderPath, string imageName_150, string imageName_75) { var manifestName = $"{baseName}.VisualElementsManifest.xml"; var manifestPath = Path.Combine(folderPath, manifestName); var backgroundColorString = tileSettings.BackgroundColor == Colors.Transparent ? "Transparent" : tileSettings.BackgroundColor.ToHex(false); Dictionary <string, string> replacementsDict = new Dictionary <string, string>(); replacementsDict["{imagePath_150}"] = imageName_150; replacementsDict["{imagePath_75}"] = imageName_75; replacementsDict["{color}"] = backgroundColorString; replacementsDict["{showName}"] = tileSettings.ShowLabel ? "on" : "off"; replacementsDict["{labelType}"] = tileSettings.UseDarkLabel ? "dark" : "light"; replacementsDict["{name}"] = name; replacementsDict["'"] = "\""; string win10TP2_TemplateManifest = @" <Application Id='App'> <VisualElements DisplayName = '{name}' Description = '{name}' BackgroundColor = '{color}' ShowNameOnSquare150x150Logo='{showName}' ForegroundText='{labelType}' Square150x150Logo='{imagePath_150}' Square70x70Logo='{imagePath_75}' Logo='{imagePath_150}' SmallLogo='{imagePath_75}' ToastCapable='false'> <DefaultTile ShowName='allLogos'/> <SplashScreen BackgroundColor='white' Image='images\splash-sdk.png'/> </VisualElements> </Application>"; var manifest = _replaceRegex.Replace(win10TP2_TemplateManifest, (m) => replacementsDict[m.Value]).Trim(); File.WriteAllText(manifestPath, manifest); TouchFile(manifestPath); return(manifestPath); }
void ITileCreator.CreateTile(TileSettings tileSettings) { var supportedLinkTypes = GetSupportedLinkTypes(tileSettings); if (!supportedLinkTypes.Contains(tileSettings.LinkType)) { throw new ArgumentException($"LinkType:{tileSettings.LinkType} is not supported for this instance! (Supported LinkTypes:{supportedLinkTypes})", nameof(tileSettings)); } switch (tileSettings.LinkType) { case LinkTypes.DirectLink: CreateDirectLink(tileSettings); break; case LinkTypes.ProxyLink: default: CreateProxyLink(tileSettings); break; } }
internal static TileData ToTileData(this BandTile tile, int startStripOrder, Guid applicationId) { TileSettings tileSettings = TileSettings.EnableNotification; if (tile.IsBadgingEnabled) { tileSettings |= TileSettings.EnableBadging; } if (tile.IsScreenTimeoutDisabled) { tileSettings |= TileSettings.ScreenTimeoutDisabled; } TileData td = new TileData(); td.AppID = tile.TileId; td.StartStripOrder = (uint)startStripOrder; td.ThemeColor = 0u; td.SettingsMask = (ushort)tileSettings; td.SetNameAndOwnerId(tile.Name, applicationId); return(td); }
private static Func<Appointment, bool> CreateAppointmentFilter(TileSettings settings) { HashSet<string> calendarIds = null; if (settings.ExcludedCalendarIds != null) { calendarIds = new HashSet<string>(settings.ExcludedCalendarIds); } Regex subjectExpression = null; if (settings.SubjectFilter != null) { subjectExpression = new Regex(settings.SubjectFilter); } Regex locationExpression = null; if (settings.LocationFilter != null) { locationExpression = new Regex(settings.LocationFilter); } return appointment => { if (calendarIds != null && calendarIds.Contains(appointment.CalendarId)) { return false; } if (subjectExpression != null && subjectExpression.IsMatch(appointment.Subject)) { return false; } if (locationExpression != null && locationExpression.IsMatch(appointment.Location)) { return false; } return true; }; }
public static async Task<TileModel> BuildTileModelAsync(TileSettings settings) { var model = new TileModel(); var now = DateTimeOffset.Now; var appointmentStore = await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AllCalendarsReadOnly); var appointments = await appointmentStore.FindAppointmentsAsync(now, TimeSpan.FromDays(settings.DayCount)); var appointmentFilter = CreateAppointmentFilter(settings); var filteredAppoinments = appointments.OrderBy(a => a.StartTime).Where(appointmentFilter).Take(settings.AppointmentCount).ToArray(); if (filteredAppoinments.Length > 0) { var appointmentText = GetAppointmentText(filteredAppoinments[0], settings); model.Appointment1Name = appointmentText.Item1; model.Appointment1DateTime = appointmentText.Item2; } if (filteredAppoinments.Length > 1) { var appointmentText = GetAppointmentText(filteredAppoinments[1], settings); model.Appointment2Name = appointmentText.Item1; model.Appointment2DateTime = appointmentText.Item2; } if (filteredAppoinments.Length > 2) { var appointmentText = GetAppointmentText(filteredAppoinments[2], settings); model.Appointment3Name = appointmentText.Item1; model.Appointment3DateTime = appointmentText.Item2; } model.Day = now.Day.ToString(); model.DayOfWeek = DateTimeFormatInfo.CurrentInfo.AbbreviatedDayNames[(int)now.DayOfWeek]; return model; }
public void OnEnable() { mouseDrag = Vector3.zero; tileEditorSettings = (TileSettings)target; SceneView.onSceneGUIDelegate += SceneUpdate; preferences = AssetDatabase.LoadAssetAtPath("Assets/TileEditor/TileEditorPreferences.asset", typeof(TileEditorPreferences)) as TileEditorPreferences; string cursorPath = "Assets/TileEditor/Prefabs/TileCursor.prefab"; GameObject cursorPrefab = (GameObject)AssetDatabase.LoadAssetAtPath(cursorPath, typeof(GameObject)); if (cursorPrefab) { cursor = (GameObject)EditorUtility.InstantiatePrefab(cursorPrefab); } string tileSelectionPath = "Assets/TileEditor/Prefabs/TileSelectionRect.prefab"; selectionPrefab = (GameObject)AssetDatabase.LoadAssetAtPath(tileSelectionPath, typeof(GameObject)); brush = new Brush(); brush.LoadTileSet(preferences.lastBrush); tileWidth = preferences.TileWidth; }
// BUG: Deleting doesn't remove from the 'tiles' list. protected override void Deserialize() { Tiles = new Dictionary <Uri, TileSettings>(); string i; if (Setting.TryGetValue("tiles", out i)) { var t = i.Split(new string[] { " tile:" }, StringSplitOptions.RemoveEmptyEntries); foreach (var knownNavigationUri in t) { Uri tileUri; if (Uri.TryCreate(knownNavigationUri, UriKind.Relative, out tileUri)) { var ts = new TileSettings(tileUri); if (Setting.TryGetValue(knownNavigationUri + ".title", out i)) { ts.Title = i; } if (Setting.TryGetValue(knownNavigationUri + ".type", out i)) { ts.StyleType = i; } Uri uri = null; if (Setting.TryGetValue(knownNavigationUri + ".frontPhoto", out i)) { if (!string.IsNullOrEmpty(i)) { if (Uri.TryCreate(i, UriKind.RelativeOrAbsolute, out uri)) { ts.FrontPhoto = uri; } } } if (Setting.TryGetValue(knownNavigationUri + ".backPhoto", out i)) { if (!string.IsNullOrEmpty(i)) { if (Uri.TryCreate(i, UriKind.RelativeOrAbsolute, out uri)) { ts.BackPhoto = uri; } } } if (Setting.TryGetValue(knownNavigationUri + ".shellFrontPhoto", out i)) { if (!string.IsNullOrEmpty(i)) { if (Uri.TryCreate(i, UriKind.RelativeOrAbsolute, out uri)) { ts.ShellFrontPhotoPath = uri; } } } Tiles[tileUri] = ts; } } } base.Deserialize(); }
protected override bool HasUpdate(uint gameTick) { if (!(_update || _fullRedraw)) { return(false); } if (Game.MovingUnit == null && (gameTick % 2 == 1)) { return(false); } Player renderPlayer = Settings.RevealWorld ? null : Human; IUnit activeUnit = ActiveUnit; if (Game.MovingUnit != null && !_fullRedraw) { IUnit movingUnit = Game.MovingUnit; ITile tile = movingUnit.Tile; int dx = GetX(tile); int dy = GetY(tile); if (dx < _tilesX && dy < _tilesY) { dx *= 16; dy *= 16; MoveUnit movement = movingUnit.Movement; this.FillRectangle(dx - 16, dy - 16, 48, 48, 5) .AddLayer(Map[movingUnit.X - 1, movingUnit.Y - 1, 3, 3].ToBitmap(player: renderPlayer), dx - 16, dy - 16, dispose: true); Bytemap unitPicture = movingUnit.ToBitmap(); this.AddLayer(unitPicture, dx + movement.X, dy + movement.Y); if (movingUnit is IBoardable && tile.Units.Any(u => u.Class == UnitClass.Land && (tile.City == null || (tile.City != null && u.Sentry)))) { this.AddLayer(unitPicture, dx + movement.X - 1, dy + movement.Y - 1); } return(true); } } else if (_fullRedraw) { _fullRedraw = false; this.Clear(5) .AddLayer(Tiles.ToBitmap(player: renderPlayer), dispose: true); } if (activeUnit != null && Game.CurrentPlayer == Human && !GameTask.Any()) { ITile tile = activeUnit.Tile; int dx = GetX(tile); int dy = GetY(tile); if (dx < _tilesX && dy < _tilesY) { dx *= 16; dy *= 16; // blink status TileSettings setting = ((gameTick % 4) < 2) ? TileSettings.BlinkOn : TileSettings.BlinkOff; this.AddLayer(tile.ToBitmap(setting), dx, dy, dispose: true); DrawHelperArrows(dx, dy); } return(true); } _update = false; return(true); }
public static IAsyncAction GenerateTileImagesAsync(Border mediumTileHost, Border wideTileHost, TileSettings settings) { return GenerateTileImagesAsyncInternal(mediumTileHost, wideTileHost, settings).AsAsyncAction(); }
public void Load(int algorithmNum) { Num = algorithmNum; using (XmlReader reader = XmlReader.Create(Paths.DataPath + "FloorAlgorithm\\" + algorithmNum + ".xml")) { while (reader.Read()) { if (reader.IsStartElement()) { switch (reader.Name) { case "Name": { Name = reader.ReadString(); break; } case "FloorSetting": { if (reader.Read()) { string settingName = reader.ReadElementString("FloorInt"); bool settingBool = reader.ReadElementString("FloorIntBool").ToBool(); FloorSettings.Add(new Tuple <string, bool>(settingName, settingBool)); } } break; case "LayerSetting": { LayerSettings.Add(reader.ReadString()); } break; case "TileSetting": { TileSettings.Add(reader.ReadString()); } break; case "FoliageSetting": { FoliageSettings.Add(reader.ReadString()); } break; case "CoverSetting": { CoverSettings.Add(reader.ReadString()); } break; case "ItemGroup": { ItemGroups.Add(reader.ReadString()); } break; case "NpcGroup": { NpcGroups.Add(reader.ReadString()); } break; case "RoomGroup": { RoomGroups.Add(reader.ReadString()); } break; } } } } }
public void applyColorSettings(TileSettings ts) { Settings = ts; setColor(); }
public void Initialize(Type type, Vector3 pos, float scale, float heightScaleRatio, float velocity, float sinkTime, int tileDepth, int scoreReward) { // Set tile type. int typeIndex = (int)type; tileType = type; // Basic properties targetPos = pos; shakeOffset = Vector3.zero; UpdateEntityPos(); TileSettings properties = tiles[typeIndex]; float scaleMultiplier = tiles[typeIndex].tileScaleFactor; float hbX = Mathf.Max(properties.minimumDimensions.x, scale * scaleMultiplier); float hbY = Mathf.Max(properties.minimumDimensions.y, properties.constantHitboxHeight); float hbZ = Mathf.Max(properties.minimumDimensions.z, scale * scaleMultiplier * heightScaleRatio * properties.hitboxDepthRatio); // Some hitbox properties should not affect visual scaling. Vector3 visualScaling = new Vector3(1f, 1f, 1f / properties.hitboxDepthRatio); if (properties.hitboxHeightScaling > 0f) { float heightScaler = hbZ * properties.hitboxHeightScaling; // Depth multiplied by factor. hbY += heightScaler; visualScaling.y = heightScaler * 2f / properties.hitboxDepthRatio; // Scale visual height. } hitboxExtent = new Vector3(hbX, hbY, hbZ); mapDepth = tileDepth; baseScoreReward = scoreReward; horizontalVelocity = velocity; sinkLoseTime = sinkAnimationCurve.keys[1].time; // The point before the rapid sinking animation. sinkDuration = sinkTime / sinkLoseTime; // Account for the lose time threshold. // Toggle visuals of tile and update its scaling. for (int i = 0; i < tiles.Length; i++) { if (i == typeIndex) { tiles[i].visualRoot.SetActive(true); float scaleWidth = hitboxExtent.x * visualScaling.x * 2f; float scaleHeight = visualScaling.y; // Independent from hitbox size. Scale with the hitbox height scaling. float scaleDepth = hitboxExtent.z * visualScaling.z * 2f; tiles[i].visualRoot.transform.localScale = new Vector3(scaleWidth, scaleHeight, scaleDepth); } else { tiles[i].visualRoot.SetActive(false); } } // Other visual stuff. RandomizeRotationVisuals(); ResetInsect(); ResetParticles(); // Other variables. frogAttached = false; didAwardScore = false; sinking = false; velocityDampen = 1f; landBobOffsetY = 0f; idleBobY = 0f; sinkTimer = 0f; sinkOffsetY = 0f; idleTimer = Mathf.PI * 2f * Random.value; }
public static IAsyncAction CreateTileAsync(TileSettings settings) { return CreateTileAsyncInternal(settings).AsAsyncAction(); }
public IEnumerable <LinkTypes> GetSupportedLinkTypes(TileSettings tileSettings) => Creator.GetSupportedLinkTypes(tileSettings);
public CalendarItem(string id, string name, TileSettings tileSettings) { Id = id; Name = name; _tileSettings = tileSettings; }
// BUG: Deleting doesn't remove from the 'tiles' list. protected override void Deserialize() { Tiles = new Dictionary<Uri, TileSettings>(); string i; if (Setting.TryGetValue("tiles", out i)) { var t = i.Split(new string[] { " tile:"}, StringSplitOptions.RemoveEmptyEntries); foreach (var knownNavigationUri in t) { Uri tileUri; if (Uri.TryCreate(knownNavigationUri, UriKind.Relative, out tileUri)) { var ts = new TileSettings(tileUri); if (Setting.TryGetValue(knownNavigationUri + ".title", out i)) { ts.Title = i; } if (Setting.TryGetValue(knownNavigationUri + ".type", out i)) { ts.StyleType = i; } Uri uri = null; if (Setting.TryGetValue(knownNavigationUri + ".frontPhoto", out i)) { if (!string.IsNullOrEmpty(i)) { if (Uri.TryCreate(i, UriKind.RelativeOrAbsolute, out uri)) { ts.FrontPhoto = uri; } } } if (Setting.TryGetValue(knownNavigationUri + ".backPhoto", out i)) { if (!string.IsNullOrEmpty(i)) { if (Uri.TryCreate(i, UriKind.RelativeOrAbsolute, out uri)) { ts.BackPhoto = uri; } } } if (Setting.TryGetValue(knownNavigationUri + ".shellFrontPhoto", out i)) { if (!string.IsNullOrEmpty(i)) { if (Uri.TryCreate(i, UriKind.RelativeOrAbsolute, out uri)) { ts.ShellFrontPhotoPath = uri; } } } Tiles[tileUri] = ts; } } } base.Deserialize(); }
public void updateSettings(TileSettings settings) { this.Settings = settings; }
public Tile(string prefabPath, Vector3 scale, TileSettings settings) : this(prefabPath, scale) { updateSettings(settings); }
public static IAsyncAction GenerateTileImagesAsync(TileSettings settings) { return GenerateTileImagesAsyncInternal(null, null, settings).AsAsyncAction(); }
public void CreateTile(TileSettings tileSettings) => Creator.CreateTile(tileSettings);
public static IBitmap ToBitmap(this ITile tile, TileSettings settings = null, Player player = null) { if (settings == null) { settings = TileSettings.Default; } IBitmap output = new Picture(16, 16, Palette); output.AddLayer(MapTile.TileBase(tile)); if (GFX256 && settings.Improvements && tile.DrawIrrigation()) { output.AddLayer(MapTile.Irrigation); } output.AddLayer(MapTile.TileLayer(tile)); output.AddLayer(MapTile.TileSpecial(tile)); // Add tile improvements if (tile.Type != Terrain.River && settings.Improvements) { if (!GFX256 && tile.DrawIrrigation()) { output.AddLayer(MapTile.Irrigation); } if (tile.DrawMine()) { output.AddLayer(MapTile.Mine); } } if (settings.Roads) { if (tile.DrawRoad()) { output.AddLayer(MapTile.Road[tile.DrawRoadDirections()]); } if (tile.DrawRailRoad()) { output.AddLayer(MapTile.RailRoad[tile.DrawRailRoadDirections()]); } } if (tile.DrawFortress()) { output.AddLayer(MapTile.Fortress); } if (tile.DrawHut()) { output.AddLayer(MapTile.Hut); } if (player != null) { Direction fog = Direction.None; foreach (Direction direction in new[] { West, North, East, South }) { if (player.Visible(tile, direction)) { continue; } fog += (int)direction; } if (fog != None) { output.AddLayer(MapTile.Fog[fog]); } } if (settings.Cities && tile.City != null) { output.AddLayer(Icons.City(tile.City, smallFont: settings.CitySmallFonts)); if (settings.ActiveUnit && tile.Units.Any(u => u == Game.ActiveUnit && u.Owner != Game.PlayerNumber(player))) { output.AddLayer(tile.UnitsToPicture(), -1, -1, dispose: true); } } if ((settings.EnemyUnits || settings.Units) && (tile.City == null || tile.Units.Any(u => u == Game.ActiveUnit))) { int unitCount = tile.Units.Count(u => settings.Units || player == null || u.Owner != Game.PlayerNumber(player)); if (unitCount > 0) { output.AddLayer(tile.UnitsToPicture(), dispose: true); } } return(output); }
private static Tuple<string, string> GetAppointmentText(Appointment appointment, TileSettings settings) { var nameText = new StringBuilder(appointment.Subject.Trim()); if (settings.ShowLocation && !String.IsNullOrWhiteSpace(appointment.Location)) { nameText.AppendFormat(" @ {0}", appointment.Location); } var dateTimeText = AppointmentDateTimeFormatter.Format(appointment); return Tuple.Create(nameText.ToString(), dateTimeText); }