示例#1
0
        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();
        }