private void Worldmap_Visible(object sender, RoutedEventArgs e) { UIWorldMap wnd = sender as UIWorldMap; wnd.Left = (int)Math.Max(0, (this.Width - wnd.Width) / 2); wnd.Top = (int)Math.Max(0, (this.Height - wnd.Height) / 2); if (!wnd.IsDataLoaded) { wnd.LoadWzResource(); } else { wnd.JumpToCurrentMap(); } }
private void InitializeComponents() { Style style = RootStyle.CreateRootStyle(); style.TargetType = this.GetType(); this.Style = style; this.Background = null; var minimap = new UIMinimap2(); minimap.Parent = this; this.Minimap = minimap; this.Windows.Add(minimap); var worldmap = new UIWorldMap(); worldmap.Parent = this; worldmap.Visibility = Visibility.Collapsed; worldmap.Visible += Worldmap_Visible; this.WorldMap = worldmap; this.Windows.Add(worldmap); var topBar = new UITopBar(); topBar.Parent = this; topBar.IsOnTop = false; topBar.SetBinding(UITopBar.WidthProperty, new Binding(UIRoot.WidthProperty) { Source = this }); topBar.SetBinding(UITopBar.PaddingLeftProperty, new Binding(Window.WidthProperty) { Source = minimap }); topBar.SetBinding(UITopBar.IsShortModeProperty, new Binding(Window.VisibilityProperty) { Source = minimap, Converter = UIHelper.CreateConverter((Visibility o) => o == Visibility.Visible) }); this.TopBar = topBar; this.Windows.Add(topBar); }
private void InitializeComponents() { Style style = RootStyle.CreateRootStyle(); style.TargetType = this.GetType(); this.Style = style; this.Background = null; var minimap = new UIMinimap2(); minimap.Parent = this; this.Minimap = minimap; this.Windows.Add(minimap); var worldmap = new UIWorldMap(); worldmap.Parent = this; worldmap.Hide(); worldmap.Visible += Worldmap_Visible; this.WorldMap = worldmap; this.Windows.Add(worldmap); var topBar = new UITopBar(); topBar.Parent = this; topBar.IsOnTop = false; topBar.SetBinding(UITopBar.WidthProperty, new Binding(UIRoot.WidthProperty) { Source = this }); topBar.SetBinding(UITopBar.PaddingLeftProperty, new Binding(Window.WidthProperty) { Source = minimap }); topBar.SetBinding(UITopBar.IsShortModeProperty, new Binding(Window.VisibilityProperty) { Source = minimap, Converter = UIHelper.CreateConverter((Visibility o) => o == Visibility.Visible) }); this.TopBar = topBar; this.Windows.Add(topBar); var chatBox = new UIChatBox(); chatBox.Parent = this; chatBox.SetBinding(UIChatBox.TopProperty, new Binding(HeightProperty) { Source = this, Converter = UIHelper.CreateConverter((float height) => height - chatBox.Height) }); this.ChatBox = chatBox; this.Windows.Add(chatBox); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtOK4_normal_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtOK4_mouseOver_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtOK4_pressed_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtOK4_disabled_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtNo3_normal_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtNo3_mouseOver_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtNo3_pressed_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtNo3_disabled_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtCancel4_normal_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtCancel4_mouseOver_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtCancel4_pressed_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtCancel4_disabled_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtClose3_normal_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtClose3_mouseOver_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtClose3_pressed_0)); ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtClose3_disabled_0)); this.Resources[CommonResourceKeys.MessageBoxWindowStyleKey] = MessageBoxStyle.CreateMessageBoxStyle(); }