// ------------- private void Comparison() { var surf = (imgSelectedFile.Tag as IImageSurface); if (surf == null) { return; } var dif = nudHamming.Value; var arg = new object[] { surf }; var prc = (string)(cbComparisonType.SelectedItem as ComboBoxItem).Tag; if ((int)tileItemView1.Tag == 0) { tileItemView1.ItemsSource = _UODataManager.GetItemTile(TileFlag.None, true).Where(t => DynamicExecutor.InvokeMethod <ushort>(t.Surface.GetSurface(), typeof(IImageSurface), prc, arg) <= dif); } else if ((int)tileItemView1.Tag == 1) { tileItemView1.ItemsSource = _UODataManager.GetLandTile(TileFlag.None, true).Where(t => t.Surface != null && DynamicExecutor.InvokeMethod <ushort>(t.Surface.GetSurface(), typeof(IImageSurface), prc, arg) <= dif); } else if ((int)tileItemView1.Tag == 2) { tileItemView1.ItemsSource = _UODataManager.GetLandTile(TileFlag.None, true).Where(t => t.Texture != null && DynamicExecutor.InvokeMethod <ushort>(t.Texture.GetSurface(), typeof(IImageSurface), prc, arg) <= dif); } else if ((int)tileItemView1.Tag == 3) { tileItemView1.ItemsSource = _UODataManager.GetGumpSurf(true).Where(t => DynamicExecutor.InvokeMethod <ushort>(t.Surface.GetSurface(), typeof(IImageSurface), prc, arg) <= dif); } tbStatusLabel.Text = String.Format((string)tbStatusLabel.Tag, (tileItemView1.ItemsSource as IEnumerable <object>).Count()); }
public MainWindow() { InitializeComponent(); // test - lets switch to our tab at startup tabControl1.SelectedIndex = 2; // Lets try to find clients at system var clients = ClientInfo.Get(); if (clients.Length != 0) // we must remember that we have no warinties that client is cirtanly valid // now we need create base uo data storage class, it base class we will use to do any work with uo data, so generally we need to store it as static. // but just now for testing we dont do it. (Remember shilw we will write controls in EsseceUDK.Add-ins we need to get manager at EsseceUDK assembly) { var manager = new UODataManager(new Uri(clients[0].DirectoryPath), UODataType.ClassicAdventuresOnHighSeas, UOLang.Russian, false); // ok, we get manager just now let get tiles and set them as sourse to our list. Yeh, it's really simple) tileItemView1.ItemsSource = manager.GetItemTile(TileFlag.Wall); // lets get all walls to look throw // just now we use same souce for binding to differen controls. So we represent different data viewer for same data. var lands = manager.GetLandTile(TileFlag.None).Where(t => t.TileId < 1000); // just now we get first 1000 valid lands for testing (we dont take care what is this) tileLandView1.ItemsSource = lands; tileTexmView1.ItemsSource = lands; // PS xaml is good, but lets devide all properties of controls in two types: visual-style and visual-logic. // The first one is part of theme or control design. The second are user customizable or controll changeble, // for example - sizes of tiles in tileItemView1 (we just add some Properties to it later). The idea is that if // we decide ti rewrite control in future to own we can easily change it without any problems. } else { // it's seems we cant find clients so we just throw Exception throw new Exception("No one \"Ultima Online\" client was founded."); } }
public void Populate() { if (CheckFromTxt) { foreach (var factory in Factories) { factory.Populate(); } } foreach (var fact in Factories) { Categories.Add(fact.Categories); } var walls = DataManager.GetItemTile().Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Height >= 15 && !itemData.Name.Contains("arc") && !itemData.Flags.HasFlag(TileFlag.Window) && !itemData.Flags.HasFlag(TileFlag.Door)).ToList(); var windows = DataManager.GetItemTile().Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Height >= 15 && itemData.Flags.HasFlag(TileFlag.Window)).ToList(); var halfWalls = DataManager.GetItemTile().Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Height >= 10 && itemData.Height < 15 && !itemData.Flags.HasFlag(TileFlag.Window)).ToList(); var quarterWalls = DataManager.GetItemTile().Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Height >= 5 && itemData.Height < 10 && !itemData.Flags.HasFlag(TileFlag.Window)).ToList(); var archs = DataManager.GetItemTile().Where(itemData => itemData.Flags.HasFlag(TileFlag.Wall) && itemData.Name.Contains("arc")).ToList(); var roof = DataManager.GetItemTile().Where(itemData => itemData.Flags.HasFlag(TileFlag.Roof)).ToList(); var floors = DataManager.GetItemTile().Where(itemData => itemData.Flags.HasFlag(TileFlag.Surface)).ToList(); var wallCategory = new TileCategory() { Name = "wall", TypeTile = TypeTile.Wall }; var windowCategory = new TileCategory() { Name = "window", TypeTile = TypeTile.Wall }; var halfCategory = new TileCategory() { Name = "half", TypeTile = TypeTile.Wall }; var quarterCategory = new TileCategory() { Name = "quarter", TypeTile = TypeTile.Wall }; var arcsCategory = new TileCategory() { Name = "arch", TypeTile = TypeTile.Wall }; var roofCategory = new TileCategory() { Name = "roof", TypeTile = TypeTile.Roofs }; var floorcategory = new TileCategory() { Name = "floor", TypeTile = TypeTile.Floor }; var lists = Misc.Categories.Union(Walls.Categories).Union(Roofs.Categories).Union(Floors.Categories).ToList(); if (!CheckFromTxt) { lists.Clear(); } var listcat = new ObservableCollection <TileCategory>(); FullEmptyCategoriesTxTChecked(lists, walls, wallCategory); FullEmptyCategoriesTxTChecked(lists, quarterWalls, quarterCategory); FullEmptyCategoriesTxTChecked(lists, halfWalls, halfCategory); FullEmptyCategoriesTxTChecked(lists, windows, windowCategory); FullEmptyCategoriesTxTChecked(lists, archs, arcsCategory); FullEmptyCategoriesTxTChecked(lists, roof, roofCategory); FullEmptyCategoriesTxTChecked(lists, floors, floorcategory); foreach (var s in wallCategory.List) { var category = new TileCategory() { Name = s.Name }; category.AddStyle(s); var half = Selector(halfCategory, s); var quarter = Selector(quarterCategory, s); var window = Selector(windowCategory, s); var arch = Selector(arcsCategory, s); var r = Selector(roofCategory, s); if (half != null) { category.AddStyle(half); } if (quarter != null) { category.AddStyle(quarter); } if (window != null) { category.AddStyle(window); } if (arch != null) { category.AddStyle(arch); } if (r != null) { category.AddStyle(r); } listcat.Add(category); } listcat.Add(RemoveDuplicates(listcat, windowCategory)); listcat.Add(RemoveDuplicates(listcat, roofCategory)); listcat.Add(RemoveDuplicates(listcat, halfCategory)); listcat.Add(RemoveDuplicates(listcat, quarterCategory)); listcat.Add(RemoveDuplicates(listcat, arcsCategory)); Categories.Add(listcat); }
public void MassSubstitue(TileCategory categoryContained, TileCategory categoryOutside) { var oldTiles = MultiTiles.Select(tile => categoryContained.FindTile(tile.Id)).Where(t => t != null); foreach (var oldtile in oldTiles) { var oldIdDescription = _tileData.GetItemTile(oldtile.Id); var tiles = categoryOutside.FindByPosition(oldtile.PositionString); var tileDataTiles = tiles.Where( tile => _tileData.GetItemTile(tile.Id).Height == oldIdDescription.Height && oldIdDescription.Flags.HasFlag(TileFlag.Window) == _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Window) && oldIdDescription.Flags.HasFlag(TileFlag.Wall) == _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Wall) && oldIdDescription.Flags.HasFlag(TileFlag.Roof) == _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Roof) && oldIdDescription.Flags.HasFlag(TileFlag.Surface) == _tileData.GetItemTile(tile.Id).Flags.HasFlag(TileFlag.Surface)); var tmp = tileDataTiles.FirstOrDefault(); if (tmp != null) { MassSet(oldtile.Id, tmp); } } Categories.Remove(categoryContained); Categories.Add(categoryOutside); UpdateCategories(); RaisePropertyChanged(() => Categories); RaisePropertyChanged(() => MultiTiles); RaisePropertyChanged(() => Text); }
public int Compare(IEntryMapTile l, IEntryMapTile r) { // 0 -> l = r // -1 -> l < r // +1 -> l > r var pl = l.Altitude; var pr = r.Altitude; var il = l as IItemMapTile; var ir = r as IItemMapTile; if (il != null) { var dl = dataManager.GetItemTile(l.TileId); if (dl.Height > 0) { ++pl; } if (dl.Flags.HasFlag(TileFlag.Background)) { --pl; } if (dl.Flags.HasFlag(TileFlag.Foliage)) { ++pl; } if (dl.Flags.HasFlag(TileFlag.Wall) || dl.Flags.HasFlag(TileFlag.Window)) { ++pl; } } else { pl -= 2; } if (ir != null) { var dr = dataManager.GetItemTile(r.TileId); if (dr.Height > 0) { ++pr; } if (dr.Flags.HasFlag(TileFlag.Background)) { --pr; } if (dr.Flags.HasFlag(TileFlag.Foliage)) { ++pr; } if (dr.Flags.HasFlag(TileFlag.Wall) || dr.Flags.HasFlag(TileFlag.Window)) { ++pr; } } else { pr -= 2; } if (pl == pr) { return(0); } return(pl > pr ? +1 : -1); }
public MainWindow() { InitializeComponent(); Application.Current.ApplyTheme("ExpressionDark"); // ThemeManager.GetThemes()[0]; // test - lets switch to our tab at startup tabControl1.SelectedIndex = 6; // Lets try to find clients at system var clients = ClientInfo.GetInSystem(); if (clients.Length != 0) // we must remember that we have no warinties that client is cirtanly valid // now we need create base uo data storage class, it base class we will use to do any work with uo data, so generally we need to store it as static. // but just now for testing we dont do it. (Remember shilw we will write controls in EsseceUDK.Add-ins we need to get manager at EsseceUDK assembly) { var manager = new UODataManager(new Uri(clients[0].DirectoryPath), UODataType.ClassicAdventuresOnHighSeas, UOLang.Russian, new UODataOptions(), true);// false); userControlTileMerger.UODataManager = manager; // ok, we get manager just now let get tiles and set them as sourse to our list. Yeh, it's really simple) var items = manager.GetItemTile(TileFlag.None, true);//TileFlag.Wall); // lets get all walls to look throw //foreach (var item in items) // item.Surface.GetSurface().GetHammingDistanceForAvrHash(null); tileItemView1.ItemsSource = items; // just now we use same souce for binding to differen controls. So we represent different data viewer for same data. var lands = manager.GetLandTile(TileFlag.None).Where(t => t.EntryId < 1000); // just now we get first 1000 valid lands for testing (we dont take care what is this) tileLandView1.ItemsSource = lands; tileTexmView1.ItemsSource = lands; //manager.GetLandTile(0x0001).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\L0x002A.bmp"); //manager.GetLandTile(0x0002).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\L0x0089.bmp"); //manager.GetLandTile(0x0003).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\L0x321D.bmp"); //manager.GetLandTile(0x0004).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\L0x3472.bmp"); //manager.GetLandTile(0x0005).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\L0x346E.bmp"); //manager.GetLandTile(0x0006).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\L0x3475.bmp"); //manager.GetLandTile(0x0001).Texture = manager.CreateSurface(@"E:\______________________\3d\++\ss\T0x002A.bmp"); //manager.GetLandTile(0x0002).Texture = manager.CreateSurface(@"E:\______________________\3d\++\ss\T0x0089.bmp"); //manager.GetLandTile(0x0003).Texture = manager.CreateSurface(@"E:\______________________\3d\++\ss\T0x321D.bmp"); //manager.GetLandTile(0x0004).Texture = manager.CreateSurface(@"E:\______________________\3d\++\ss\T0x3472.bmp"); //manager.GetLandTile(0x0005).Texture = manager.CreateSurface(@"E:\______________________\3d\++\ss\T0x346E.bmp"); //manager.GetLandTile(0x0006).Texture = manager.CreateSurface(@"E:\______________________\3d\++\ss\T0x3475.bmp"); //manager.GetItemTile(0x0001).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\I0xF6C2.bmp"); //manager.GetItemTile(0x0002).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\I0xF6FC.bmp"); //manager.GetItemTile(0x0003).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\I0xF6BA.bmp"); //manager.GetItemTile(0x0004).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\I0x3BB4.bmp"); //manager.GetItemTile(0x0005).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\I0xF6A2.bmp"); //manager.GetItemTile(0x0006).Surface = manager.CreateSurface(@"E:\______________________\3d\++\ss\I0x248B.bmp"); // PS xaml is good, but lets devide all properties of controls in two types: visual-style and visual-logic. // The first one is part of theme or control design. The second are user customizable or controll changeble, // for example - sizes of tiles in tileItemView1 (we just add some Properties to it later). The idea is that if // we decide ti rewrite control in future to own we can easily change it without any problems. } else { // it's seems we cant find clients so we just throw Exception throw new Exception("No one \"Ultima Online\" client was founded."); } }