public void DrawShadow2(int l, int t, int r, int b) { MirImage image = BodyLibrary?.GetImage(ArmourFrame); if (image == null) { return; } int w = (DrawX + image.OffSetX) - l; int h = (DrawY + image.OffSetY) - t; Matrix m = Matrix.Scaling(1F, 0.5f, 0); m.M21 = -0.50F; DXManager.Sprite.Transform = m * Matrix.Translation(DrawX + image.ShadowOffSetX - w + (image.Height) / 2 + h / 2, DrawY + image.ShadowOffSetY - h / 2, 0); DXManager.Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.None); float oldOpacity = DXManager.Opacity; if (oldOpacity != 0.5F) { DXManager.SetOpacity(0.5F); } DXManager.Sprite.Draw(DXManager.ScratchTexture, Rectangle.FromLTRB(l, t, r, b), Vector3.Zero, Vector3.Zero, Color.Black); DXManager.Sprite.Transform = Matrix.Identity; DXManager.Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Point); if (0.5F != oldOpacity) { DXManager.SetOpacity(oldOpacity); } }
private void MapControl_MapInfoChanged(object sender, EventArgs e) { foreach (DXControl temp in MapInfoObjects.Values) { temp.Dispose(); } MapInfoObjects.Clear(); if (GameScene.Game.MapControl.MapInfo == null) { return; } TitleLabel.Text = GameScene.Game.MapControl.MapInfo.Description; Image.Index = GameScene.Game.MapControl.MapInfo.MiniMap; ScaleX = Image.Size.Width / (float)GameScene.Game.MapControl.Width; ScaleY = Image.Size.Height / (float)GameScene.Game.MapControl.Height; MirLibrary library; if (CEnvir.LibraryList.TryGetValue(LibraryFile.Background, out library)) { MirImage image = library.CreateImage(GameScene.Game.MapControl.MapInfo.Background, ImageType.Image); GameScene.Game.MapControl.BackgroundImage = image; if (image != null) { GameScene.Game.MapControl.BackgroundScaleX = GameScene.Game.MapControl.Width * MapControl.CellWidth / (float)(image.Width - Config.GameSize.Width); GameScene.Game.MapControl.BackgroundScaleY = GameScene.Game.MapControl.Height * MapControl.CellHeight / (float)(image.Height - Config.GameSize.Height); } } foreach (NPCInfo ob in Globals.NPCInfoList.Binding) { Update(ob); } foreach (MovementInfo ob in Globals.MovementInfoList.Binding) { Update(ob); } foreach (ClientObjectData ob in GameScene.Game.DataDictionary.Values) { Update(ob); } }
public CharacterPlayer() { InternalChild = new Panel(); InternalChild.Widgets.Add(_body = new MirImage { Library = LibraryType.Interface1c, UseOffset = true }); InternalChild.Widgets.Add(_shadow = new MirImage { Library = LibraryType.Interface1c, UseOffset = true, Opacity = 0.5f }); }
public MainPanel() { LibraryFile = LibraryFile.GameInter; Index = 50; ExperienceBar = new DXImageControl { Parent = this, LibraryFile = LibraryFile.GameInter, Index = 51, }; ExperienceBar.Location = new Point((Size.Width - ExperienceBar.Size.Width) / 2 + 1, 2 + 1); ExperienceBar.BeforeDraw += (o, e) => { if (ExperienceBar.Library == null) { return; } if (MapObject.User.Level >= Globals.ExperienceList.Count) { return; } decimal MaxExperience = Globals.ExperienceList[MapObject.User.Level]; if (MaxExperience == 0) { return; } //Get percent. MirImage image = ExperienceBar.Library.CreateImage(56, ImageType.Image); if (image == null) { return; } int x = (ExperienceBar.Size.Width - image.Width) / 2; int y = (ExperienceBar.Size.Height - image.Height) / 2; float percent = (float)Math.Min(1, Math.Max(0, MapObject.User.Experience / MaxExperience)); if (percent == 0) { return; } PresentTexture(image.Image, this, new Rectangle(ExperienceBar.DisplayArea.X + x, ExperienceBar.DisplayArea.Y + y - 1, (int)(image.Width * percent), image.Height), Color.White, ExperienceBar); }; DXControl HealthBar = new DXControl { Parent = this, Location = new Point(35, 22), Size = ExperienceBar.Library.GetSize(52), }; HealthBar.BeforeDraw += (o, e) => { if (ExperienceBar.Library == null) { return; } if (MapObject.User.Stats[Stat.Health] == 0) { return; } float percent = Math.Min(1, Math.Max(0, MapObject.User.CurrentHP / (float)MapObject.User.Stats[Stat.Health])); if (percent == 0) { return; } MirImage image = ExperienceBar.Library.CreateImage(52, ImageType.Image); if (image == null) { return; } PresentTexture(image.Image, this, new Rectangle(HealthBar.DisplayArea.X, HealthBar.DisplayArea.Y, (int)(image.Width * percent), image.Height), Color.White, HealthBar); }; DXControl ManaBar = new DXControl { Parent = this, Location = new Point(35, 36), Size = ExperienceBar.Library.GetSize(52), }; ManaBar.BeforeDraw += (o, e) => { if (ExperienceBar.Library == null) { return; } if (MapObject.User.Stats[Stat.Mana] == 0) { return; } float percent = Math.Min(1, Math.Max(0, MapObject.User.CurrentMP / (float)MapObject.User.Stats[Stat.Mana])); if (percent == 0) { return; } MirImage image = ExperienceBar.Library.CreateImage(54, ImageType.Image); if (image == null) { return; } PresentTexture(image.Image, this, new Rectangle(ManaBar.DisplayArea.X, ManaBar.DisplayArea.Y, (int)(image.Width * percent), image.Height), Color.White, ManaBar); }; DXImageControl OtherBar = new DXImageControl { Parent = this, Location = new Point(35, 50), LibraryFile = LibraryFile.GameInter, Index = 58, Visible = false, }; DXButton CharacterButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 82, Parent = this, Location = new Point(650, 23), Hint = "角色 [Q]" }; CharacterButton.MouseClick += (o, e) => { GameScene.Game.CharacterBox.Visible = !GameScene.Game.CharacterBox.Visible; }; DXButton InventoryButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 87, Parent = this, Location = new Point(689, 23), Hint = "背包 [W]\n" + "宠物背包 [U]" }; InventoryButton.MouseClick += (o, e) => GameScene.Game.InventoryBox.Visible = !GameScene.Game.InventoryBox.Visible; DXButton SpellButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 92, Parent = this, Location = new Point(728, 23), Hint = "技能 [E]" }; SpellButton.MouseClick += (o, e) => GameScene.Game.MagicBox.Visible = !GameScene.Game.MagicBox.Visible; DXButton QuestButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 112, Parent = this, Location = new Point(767, 23), Hint = "任务 [J]" }; QuestButton.MouseClick += (o, e) => GameScene.Game.QuestBox.Visible = !GameScene.Game.QuestBox.Visible; DXButton MailButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 97, Parent = this, Location = new Point(806, 23), Hint = "邮件 [,]" }; MailButton.MouseClick += (o, e) => GameScene.Game.MailBox.Visible = !GameScene.Game.MailBox.Visible; NewMailIcon = new DXImageControl { LibraryFile = LibraryFile.GameInter, Index = 240, Parent = MailButton, IsControl = false, Location = new Point(2, 2), Visible = false, }; AvailableQuestIcon = new DXImageControl { LibraryFile = LibraryFile.GameInter, Index = 240, Parent = QuestButton, IsControl = false, Location = new Point(2, 2), Visible = false, }; AvailableQuestIcon.VisibleChanged += (o, e) => { if (AvailableQuestIcon.Visible) { CompletedQuestIcon.Location = new Point(2, QuestButton.Size.Height - CompletedQuestIcon.Size.Height); } else { CompletedQuestIcon.Location = new Point(2, 2); } }; CompletedQuestIcon = new DXImageControl { LibraryFile = LibraryFile.GameInter, Index = 241, Parent = QuestButton, IsControl = false, Location = new Point(2, 2), Visible = false, }; DXButton BeltButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 107, Parent = this, Location = new Point(845, 23), Hint = "快捷栏 [Z]" }; BeltButton.MouseClick += (o, e) => GameScene.Game.BeltBox.Visible = !GameScene.Game.BeltBox.Visible; DXButton GroupButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 102, Parent = this, Location = new Point(884, 23), Hint = "组队 [P]" }; GroupButton.MouseClick += (o, e) => GameScene.Game.GroupBox.Visible = !GameScene.Game.GroupBox.Visible; DXButton ConfigButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 117, Parent = this, Location = new Point(923, 23), Hint = "设置 [O]" }; ConfigButton.MouseClick += (o, e) => GameScene.Game.ConfigBox.Visible = !GameScene.Game.ConfigBox.Visible; DXButton CashShopButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 122, Parent = this, Location = new Point(972, 16), Hint = "元宝商铺 [Y]" }; CashShopButton.MouseClick += (o, e) => { if (GameScene.Game.MarketPlaceBox.StoreTab.IsVisible) { GameScene.Game.MarketPlaceBox.Visible = false; } else { GameScene.Game.MarketPlaceBox.Visible = true; GameScene.Game.MarketPlaceBox.StoreTab.TabButton.InvokeMouseClick(); } }; DXLabel label = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "职业", Hint = "职业", }; label.Location = new Point(300 - label.Size.Width, 20); label = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "等级", Hint = "等级", }; label.Location = new Point(300 - label.Size.Width, 40); label = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "防御", }; label.Location = new Point(385 - label.Size.Width, 20); label = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "魔防", }; label.Location = new Point(470 - label.Size.Width, 20); label = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "攻击", }; label.Location = new Point(385 - label.Size.Width, 40); DXLabel MCLabelLabel = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "魔法", }; MCLabelLabel.Location = new Point(470 - MCLabelLabel.Size.Width, 40); DXLabel SCLabelLabel = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "道术", }; SCLabelLabel.Location = new Point(470 - SCLabelLabel.Size.Width, 40); label = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "准确", Hint = "准确", }; label.Location = new Point(567 - label.Size.Width, 20); label = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "敏捷", Hint = "敏捷", }; label.Location = new Point(567 - label.Size.Width, 40); ClassLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(300, 20), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; LevelLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(300, 40), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; ACLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(385, 20), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; MRLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(470, 20), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; DCLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(385, 40), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; MCLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(470, 40), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; MCLabel.VisibleChanged += (o, e) => MCLabelLabel.Visible = MCLabel.Visible; SCLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(470, 40), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; SCLabel.VisibleChanged += (o, e) => SCLabelLabel.Visible = SCLabel.Visible; AccuracyLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(567, 20), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; AgilityLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(567, 40), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; HealthLabel = new DXLabel { Parent = this, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; HealthLabel.SizeChanged += (o, e) => { HealthLabel.Location = new Point(HealthBar.Location.X + (HealthBar.Size.Width - HealthLabel.Size.Width) / 2, HealthBar.Location.Y + (HealthBar.Size.Height - HealthLabel.Size.Height) / 2); }; ManaLabel = new DXLabel { Parent = this, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; ManaLabel.SizeChanged += (o, e) => { ManaLabel.Location = new Point(ManaBar.Location.X + (ManaBar.Size.Width - ManaLabel.Size.Width) / 2, ManaBar.Location.Y + (ManaBar.Size.Height - ManaLabel.Size.Height) / 2); }; ExperienceLabel = new DXLabel { Parent = this, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; ExperienceLabel.SizeChanged += (o, e) => { ExperienceLabel.Location = new Point(ExperienceBar.Location.X + (ExperienceBar.Size.Width - ExperienceLabel.Size.Width) / 2, ExperienceBar.Location.Y + (ExperienceBar.Size.Height - ExperienceLabel.Size.Height) / 2); }; AttackModeLabel = new DXLabel { Parent = this, ForeColour = Color.Cyan, Outline = true, OutlineColour = Color.Black, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; AttackModeLabel.SizeChanged += (o, e) => { AttackModeLabel.Location = new Point(OtherBar.Location.X, OtherBar.Location.Y + (OtherBar.Size.Height - AttackModeLabel.Size.Height) / 2 - 2); }; PetModeLabel = new DXLabel { Parent = this, ForeColour = Color.Cyan, Outline = true, OutlineColour = Color.Black, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; PetModeLabel.SizeChanged += (o, e) => { PetModeLabel.Location = new Point(OtherBar.Location.X + OtherBar.Size.Width - PetModeLabel.Size.Width, OtherBar.Location.Y + (OtherBar.Size.Height - PetModeLabel.Size.Height) / 2 - 2); }; }
public static MirImage CropTransparent(Bitmap bmp) { int w = bmp.Width; int h = bmp.Height; Func <int, bool> allWhiteRow = row => { for (int i = 0; i < w; ++i) { if (bmp.GetPixel(i, row).A != 0) { return(false); } } return(true); }; Func <int, bool> allWhiteColumn = col => { for (int i = 0; i < h; ++i) { if (bmp.GetPixel(col, i).A != 0) { return(false); } } return(true); }; int topmost = 0; for (int row = 0; row < h; ++row) { if (allWhiteRow(row)) { topmost = row; } else { break; } } int bottommost = 0; for (int row = h - 1; row >= 0; --row) { if (allWhiteRow(row)) { bottommost = row; } else { break; } } int leftmost = 0, rightmost = 0; for (int col = 0; col < w; ++col) { if (allWhiteColumn(col)) { leftmost = col; } else { break; } } for (int col = w - 1; col >= 0; --col) { if (allWhiteColumn(col)) { rightmost = col; } else { break; } } if (rightmost == 0) { rightmost = w; // As reached left } if (bottommost == 0) { bottommost = h; // As reached top. } int croppedWidth = rightmost - leftmost; int croppedHeight = bottommost - topmost; if (croppedWidth == 0) // No border on left or right { leftmost = 0; croppedWidth = w; } if (croppedHeight == 0) // No border on top or bottom { topmost = 0; croppedHeight = h; } try { var target = new Bitmap(croppedWidth, croppedHeight); using (Graphics g = Graphics.FromImage(target)) { g.DrawImage(bmp, new RectangleF(0, 0, croppedWidth, croppedHeight), new RectangleF(leftmost, topmost, croppedWidth, croppedHeight), GraphicsUnit.Pixel); } MirImage Output = new MirImage { Image = target, X = leftmost, Y = topmost }; return(Output); } catch (Exception ex) { throw new Exception( string.Format("Values are topmost={0} btm={1} left={2} right={3} croppedWidth={4} croppedHeight={5}", topmost, bottommost, leftmost, rightmost, croppedWidth, croppedHeight), ex); } }
public InventoryDialog() { LibraryFile = LibraryFile.Interface; Index = 130; Movable = true; CloseButton = new DXButton { Parent = this, Index = 15, LibraryFile = LibraryFile.Interface, }; CloseButton.Location = new Point(DisplayArea.Width - CloseButton.Size.Width - 5, 5); CloseButton.MouseClick += (o, e) => Visible = false; TitleLabel = new DXLabel { Text = "Inventory", Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), Outline = true, OutlineColour = Color.Black, IsControl = false, }; TitleLabel.Location = new Point((DisplayArea.Width - TitleLabel.Size.Width) / 2, 8); Grid = new DXItemGrid { GridSize = new Size(6, 8), Parent = this, ItemGrid = GameScene.Game.Inventory, GridType = GridType.Inventory, Location = new Point(20, 39), GridPadding = 1, BackColour = Color.Empty, Border = false }; CEnvir.LibraryList.TryGetValue(LibraryFile.GameInter, out MirLibrary library); DXControl WeightBar = new DXControl { Parent = this, Location = new Point(53, 355), Size = library.GetSize(360), }; WeightBar.BeforeDraw += (o, e) => { if (library == null) { return; } if (MapObject.User.Stats[Stat.BagWeight] == 0) { return; } float percent = Math.Min(1, Math.Max(0, MapObject.User.BagWeight / (float)MapObject.User.Stats[Stat.BagWeight])); if (percent == 0) { return; } MirImage image = library.CreateImage(360, ImageType.Image); if (image == null) { return; } PresentTexture(image.Image, this, new Rectangle(WeightBar.DisplayArea.X, WeightBar.DisplayArea.Y, (int)(image.Width * percent), image.Height), Color.White, WeightBar); }; WeightLabel = new DXLabel { Parent = this, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; WeightLabel.SizeChanged += (o, e) => { WeightLabel.Location = new Point(WeightBar.Location.X + (WeightBar.Size.Width - WeightLabel.Size.Width) / 2, WeightBar.Location.Y - 1 + (WeightBar.Size.Height - WeightLabel.Size.Height) / 2); }; GoldTitle = new DXLabel { AutoSize = false, ForeColour = Color.Goldenrod, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.Left, Parent = this, Location = new Point(55, 381), Font = new Font(Config.FontName, CEnvir.FontSize(8F), FontStyle.Bold), Text = "Gold", Size = new Size(97, 20) }; GoldLabel = new DXLabel { AutoSize = false, ForeColour = Color.White, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.Right, Parent = this, Location = new Point(80, 381), Text = "0", Size = new Size(97, 20), Sound = SoundIndex.GoldPickUp }; GoldLabel.MouseClick += GoldLabel_MouseClick; GameGoldTitle = new DXLabel { AutoSize = false, ForeColour = Color.DarkOrange, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.Left, Parent = this, Location = new Point(55, 400), Font = new Font(Config.FontName, CEnvir.FontSize(8F), FontStyle.Bold), Text = "GG", Size = new Size(97, 20) }; GameGoldLabel = new DXLabel { AutoSize = false, ForeColour = Color.White, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.Right, Parent = this, Location = new Point(80, 400), Text = "0", Size = new Size(97, 20) }; SortButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 364, Parent = this, Location = new Point(180, 384), Hint = "Sort", Enabled = false }; TrashButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 358, Parent = this, Location = new Point(218, 384), Hint = "Trash", Enabled = false }; CurrencyLabel = new DXLabel { Parent = this, Location = new Point(8, 380), Hint = "Wallet [Ctrl + C]", Size = new Size(45, 40), Sound = SoundIndex.GoldPickUp }; CurrencyLabel.MouseClick += CurrencyLabel_MouseClick; }
public CharacterScene() { Background = new MirImageBrush { Index = 50, Library = LibraryType.Interface1c }; Widgets.Add(new MirImage { Id = "Header", Library = LibraryType.Interface1c, Index = 51 }); Widgets.Add(new MirImage { Id = "Footer", Library = LibraryType.Interface1c, Index = 52, Top = 3, VerticalAlignment = VerticalAlignment.Bottom }); Widgets.Add(new MirImage { Id = "Lights", Library = LibraryType.Interface1c, UseOffset = true, Blend = true }.WithAnimation(WidgetAnimation.Create() .WithCallback((s, e) => ((MirImage)s).Index = e) .From(2800).To(2816) .Elapse(TimeSpan.FromSeconds(2)) .WithLoop() )); Widgets.Add(new MirImage { Id = "Torches", Library = LibraryType.Interface1c, UseOffset = true, Blend = true, Left = 20, Top = 25 }.WithAnimation(WidgetAnimation.Create() .WithCallback((s, e) => ((MirImage)s).Index = e) .From(2900).Count(16) .Elapse(TimeSpan.FromSeconds(2)) .WithLoop() )); var player = new MirImage() { Top = 100, Left = 100, Library = LibraryType.Interface1c, Index = 200, UseOffset = true, }; Widgets.Add(player); var playerEffect = new MirImage() { Top = 100, Left = 100, Library = LibraryType.Interface1c, Index = 200, UseOffset = true, Blend = true }; Widgets.Add(playerEffect); player.WithAnimation(WidgetAnimation.Create() .WithCallback((s, e) => { player.Index = e; playerEffect.Index = e + 100; }) .From(240).Count(21) .Elapse(TimeSpan.FromSeconds(2)) .OnEnd((c) => { playerEffect.Enabled = false; player.WithAnimation(WidgetAnimation.Create() .WithCallback((s, e) => ((MirImage)s).Index = e) .From(300).Count(12) .Elapse(TimeSpan.FromSeconds(2)) .WithLoop()); }) ); //_characters = new CharacterSelectControl[4]; //for (short i = 0; i < _characters.Length; i++) //{ // Widgets.Add(_characters[i] = new CharacterSelectControl // { // Id = "Character_" + i, // Selected = i == 0, // Left = (short)(100 + (i * 210)), // Top = 0, // Visible = false, // }); // _characters[i].TouchUp += Character_Click; //} //var createCharacterButton = new MirButton() //{ // Text = "Create character", // Left = 300, // Top = -15, // Width = 100, // HorizontalAlignment = HorizontalAlignment.Center, // VerticalAlignment = VerticalAlignment.Bottom //}; //createCharacterButton.Click += CreateCharacterButton_Click; //Widgets.Add(createCharacterButton); //_characters[0].Visible = true; //_characters[0].Set(new Character //{ // Class = new MirClass { Id = 0, Name = "Warrior" }, // Gender = new MirGender { Id = 0, Name = "Male" }, // Level = 50, // Name = "Test", // Id = 1 //}); }