Пример #1
0
        //设置背景拉伸方式
        private void Se_ComboBox_Background_Stretch_SelectionChanged(Object sender, SelectionChangedEventArgs e)
        {
            string bg = RegeditRW.RegReadString("Background");

            if (MWInit == true)
            {
                if (bg == "")
                {
                    Se_BG_Alpha_Text.Foreground = Brushes.Silver;
                    Se_BG_Alpha.IsEnabled       = false;
                }
                else
                {
                    Se_BG_Alpha_Text.Foreground = Brushes.Black;
                    try
                    {
                        var brush = new ImageBrush();
                        brush.ImageSource = new BitmapImage(new Uri(bg));
                        brush.Stretch     = (Stretch)Se_ComboBox_Background_Stretch.SelectedIndex;
                        UI_BackGroundBorder.Background = brush;
                        RegeditRW.RegWrite("BackgroundStretch", Se_ComboBox_Background_Stretch.SelectedIndex + 1);
                    }
                    catch
                    {
                        Visi.VisiCol(true, UI_BackGroundBorder);
                    }
                }
            }
        }
Пример #2
0
 //清除背景方法
 private void ClearBackground()
 {
     Visi.VisiCol(true, UI_BackGroundBorder);
     Se_BG_Alpha_Text.Foreground = Brushes.Silver;
     Se_BG_Alpha.IsEnabled       = false;
     RegeditRW.RegWrite("Background", "");
 }
Пример #3
0
        private void DediButtomPanelVisibility(string obj)
        {
            DediButtomPanelVisibilityInitialize();
            switch (obj)
            {
            case "Setting":
                Visi.VisiCol(false, DediSetting);
                break;

            case "BaseSet":
                Visi.VisiCol(false, DediBaseSet);
                break;

            case "EditWorld":

                break;

            case "Mod":

                break;

            case "Rollback":

                break;

            case "Blacklist":

                break;
            }
        }
Пример #4
0
 //右侧面板初始化
 private void RightPanelVisibilityInitialize()
 {
     foreach (UIElement vControl in RightGrid.Children)
     {
         Visi.VisiCol(true, vControl);
     }
 }
Пример #5
0
        //左侧菜单开关
        private void Sidebar_Menu_Click(object sender, RoutedEventArgs e)
        {
            var    MainWindowWidth = mainWindow.ActualWidth;
            double MainGridWidth   = MainGrid.ActualWidth;

            if (LeftMenuState == 0)
            {
                Visi.VisiCol(false, UI_Version);
                Animation.Anim(LCWidth, 50, 150, WidthProperty);
                Animation.Anim(LeftCanvas, 50, 150, WidthProperty);
                Animation.Anim(LeftWrapPanel, 50, 150, WidthProperty);
                LCWidth.Width       = new GridLength(150);
                LeftCanvas.Width    = 150;
                LeftWrapPanel.Width = 150;
                LeftMenuState       = 1;
            }
            else
            {
                Visi.VisiCol(true, UI_Version);
                Animation.Anim(LCWidth, 150, 50, WidthProperty);
                Animation.Anim(LeftCanvas, 150, 50, WidthProperty);
                Animation.Anim(LeftWrapPanel, 150, 50, WidthProperty);
                LCWidth.Width       = new GridLength(50);
                LeftCanvas.Width    = 50;
                LeftWrapPanel.Width = 50;
                LeftMenuState       = 0;
            }
        }
Пример #6
0
 private void DediButtomPanelVisibilityInitialize()
 {
     foreach (UIElement vControl in DediButtomBG.Children)
     {
         Visi.VisiCol(true, vControl);
     }
     Visi.VisiCol(false, DediButtomBorder_h1, DediButtomBorder_h2, DediButtomBorder_v1, DediButtomBorder_v4);
 }
Пример #7
0
 //还原按钮
 private void UI_btn_normal_Click(object sender, RoutedEventArgs e)
 {
     Visi.VisiCol(false, UI_btn_maximized);
     Visi.VisiCol(true, UI_btn_normal);
     Left   = rcnormal.Left;
     Top    = rcnormal.Top;
     Width  = rcnormal.Width;
     Height = rcnormal.Height;
     //WindowState = WindowState.Normal;
 }
Пример #8
0
 //设置清除按钮可见性
 private void UI_search_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (UI_search.Text != "")
     {
         Visi.VisiCol(false, UI_search_clear);
     }
     else
     {
         Visi.VisiCol(true, UI_search_clear);
     }
 }
 //重置
 private void button_CS_Reset_Click(object sender, RoutedEventArgs e)
 {
     Button_CS_Food_1_Click(null, null);
     Button_CS_Food_2_Click(null, null);
     Button_CS_Food_3_Click(null, null);
     Button_CS_Food_4_Click(null, null);
     Image_CS_Food_Result.Source = null;
     TextBlock_CS_FoodName.Text  = "";
     CrockPotList.Clear();
     CrockPotListIndex   = -1;
     CrockPotMaxPriority = -128;
     Visi.VisiCol(true, button_CS_Switch_Left, button_CS_Switch_Right);
 }
Пример #10
0
        Rect rcnormal;//窗口位置
        //最大化按钮
        private void UI_btn_maximized_Click(object sender, RoutedEventArgs e)
        {
            Visi.VisiCol(true, UI_btn_maximized);
            Visi.VisiCol(false, UI_btn_normal);
            rcnormal = new Rect(Left, Top, Width, Height);//保存下当前位置与大小
            Left     = 0;
            Top      = 0;
            Rect rc = SystemParameters.WorkArea;

            Width  = rc.Width;
            Height = rc.Height;
            //WindowState = WindowState.Maximized;
        }
Пример #11
0
        //设置背景方法
        public void SetBackground()
        {
            var OFD = new Microsoft.Win32.OpenFileDialog()
            {
                FileName   = "",                                                                    //默认文件名
                DefaultExt = ".png",                                                                // 默认文件扩展名
                Filter     = "图像文件 (*.bmp;*.gif;*.jpg;*.jpeg;*.png)|*.bmp;*.gif;*.jpg;*.jpeg;*.png" //文件扩展名过滤器
            };
            bool?result = OFD.ShowDialog();                                                         //显示打开文件对话框

            Visi.VisiCol(false, UI_BackGroundBorder);
            try
            {
                string PictruePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\JiHuangBaiKeCSharp\Background\"; //设置文件夹位置
                if ((Directory.Exists(PictruePath)) == false)                                                                               //若文件夹不存在
                {
                    Directory.CreateDirectory(PictruePath);
                }
                var filename = Path.GetFileName(OFD.FileName); //设置文件名
                try
                {
                    File.Copy(OFD.FileName, PictruePath + filename, true);
                }
                catch (Exception) { }
                var brush = new ImageBrush()
                {
                    ImageSource = new BitmapImage(new Uri(PictruePath + filename))
                };
                UI_BackGroundBorder.Background = brush;
                Se_BG_Alpha_Text.Foreground    = Brushes.Black;
                Se_BG_Alpha.IsEnabled          = true;
                RegeditRW.RegWrite("Background", PictruePath + filename);
            }
            catch (Exception)
            {
                MessageBox.Show("没有选择正确的图片");
            }
        }
Пример #12
0
        private void DediButtomPanelInitalize()
        {
            string[] GameVersion = new string[] { "Steam", "TGP", "游侠" };
            DediSettingGameVersionSelect.Init(GameVersion);

            DediButtomPanelVisibilityInitialize();
            string[] NoYes     = new string[] { "否", "是" };
            string[] Gamemode  = new string[] { "生存", "荒野", "无尽" };
            string[] MaxPlayer = new string[64];
            for (int i = 1; i <= 64; i++)
            {
                MaxPlayer[i - 1] = i.ToString();
            }
            string[] Offline = new string[] { "在线", "离线" };
            DediBaseSetGrouponlySelect.Init(NoYes);
            DediBaseSetGroupadminsSelect.Init(NoYes);
            DediBaseSetGamemodeSelect.Init(Gamemode);
            DediBaseSetPvpSelect.Init(NoYes);
            DediBaseSetMaxPlayerSelect.Init(MaxPlayer, 5);
            DediBaseOfflineSelect.Init(Offline);
            Visi.VisiCol(false, DediBaseSet);
            DediBaseSetRangeInitalize();
        }
Пример #13
0
        private void DediIntention_Click(string Intention)
        {
            DediButtomPanelVisibilityInitialize();
            Visi.VisiCol(false, DediBaseSet);
            switch (Intention)
            {
            case "social":
                DediBaseSetIntentionButton.Content = "交际";
                break;

            case "cooperative":
                DediBaseSetIntentionButton.Content = "合作";
                break;

            case "competitive":
                DediBaseSetIntentionButton.Content = "竞争";
                break;

            case "madness":
                DediBaseSetIntentionButton.Content = "疯狂";
                break;
            }
        }
Пример #14
0
 private void DediBaseSetRangeInitalize()
 {
     Visi.VisiCol(true, DediBaseSetGroupid, DediBaseSetGrouponly, DediBaseSetGroupadmins);
 }
Пример #15
0
 private void DediBaseSetIntentionButton_Click(object sender, RoutedEventArgs e)
 {
     DediButtomPanelVisibilityInitialize();
     Visi.VisiCol(false, DediIntention);
 }
Пример #16
0
 //清除按钮
 private void UI_search_clear_Click(object sender, RoutedEventArgs e)
 {
     UI_search.Text = "";
     Visi.VisiCol(true, UI_search_clear);
 }
Пример #17
0
 private void DediBaseSetRangeSteamgroup_Click(object sender, RoutedEventArgs e)
 {
     Visi.VisiCol(false, DediBaseSetGroupid, DediBaseSetGrouponly, DediBaseSetGroupadmins);
 }
Пример #18
0
        // 右侧面板可视化设置
        // obj可选值:
        // 主页:Welcome
        // 人物:Character
        // 食物:Food
        // 科技:Science
        // 模拟:Cooking_Simulator
        // 生物:Animal
        // 自然:Natural
        // 物品:Goods
        // 设置:Setting
        private void RightPanelVisibility(string obj)
        {
            RightPanelVisibilityInitialize();
            switch (obj)
            {
            //欢迎界面
            case "Welcome":
                Visi.VisiCol(false, RightGrid_Welcome);
                Visi.VisiCol(true, RightGrid_Setting, RightGrid, RightGrid_Dedicated_Server);
                break;

            //设置界面
            case "Setting":
                Visi.VisiCol(false, RightGrid_Setting);
                Visi.VisiCol(true, RightGrid_Welcome, RightGrid, RightGrid_Dedicated_Server);
                break;

            //服务器界面
            case "DedicatedServer":
                Visi.VisiCol(false, RightGrid_Dedicated_Server);
                Visi.VisiCol(true, RightGrid_Welcome, RightGrid, RightGrid_Setting);
                break;

            //内容界面
            default:
                //隐藏欢迎/设置界面
                Visi.VisiCol(true, RightGrid_Welcome);
                Visi.VisiCol(true, RightGrid_Dedicated_Server);
                Visi.VisiCol(true, RightGrid_Setting);
                //显示右侧内容Grid容器/分割器
                Visi.VisiCol(false, RightGrid);
                Visi.VisiCol(false, UI_Splitter);
                switch (obj)
                {
                case "Character":
                    Visi.VisiCol(false, ScrollViewer_Left_Character, ScrollViewer_Right_Character);
                    SLWidth.MinWidth = 320;
                    SLWidth.Width    = new GridLength(320);
                    break;

                case "Food":
                    Visi.VisiCol(false, ScrollViewer_Left_Food, ScrollViewer_Right_Food);
                    SLWidth.MinWidth = 220;
                    SLWidth.Width    = new GridLength(220);
                    break;

                case "Science":
                    Visi.VisiCol(false, ScrollViewer_Left_Science, ScrollViewer_Right_Science);
                    SLWidth.MinWidth = 220;
                    SLWidth.Width    = new GridLength(220);
                    break;

                case "Cooking_Simulator":
                    Visi.VisiCol(false, ScrollViewer_Left_Cooking_Simulator, ScrollViewer_Right_Cooking_Simulator);
                    SLWidth.MinWidth = 220;
                    SLWidth.Width    = new GridLength(220);
                    break;

                case "Animal":
                    Visi.VisiCol(false, ScrollViewer_Left_Animal, ScrollViewer_Right_Animal);
                    SLWidth.MinWidth = 220;
                    SLWidth.Width    = new GridLength(220);
                    break;

                case "Natural":
                    Visi.VisiCol(false, ScrollViewer_Left_Natural, ScrollViewer_Right_Natural);
                    SLWidth.MinWidth = 220;
                    SLWidth.Width    = new GridLength(220);
                    break;

                case "Goods":
                    Visi.VisiCol(false, ScrollViewer_Left_Goods, ScrollViewer_Right_Goods);
                    SLWidth.MinWidth = 220;
                    SLWidth.Width    = new GridLength(220);
                    break;
                }
                break;
            }
        }
Пример #19
0
        //MainWindow构造函数
        public MainWindow()
        {
            #region "读取注册表(必须在初始化之前读取)"
            //背景图片
            string bg        = RegeditRW.RegReadString("Background");
            double bgStretch = RegeditRW.RegRead("BackgroundStretch");
            //透明度
            double bgAlpha      = RegeditRW.RegRead("BGAlpha");
            double bgPanelAlpha = RegeditRW.RegRead("BGPanelAlpha");
            double windowAlpha  = RegeditRW.RegRead("WindowAlpha");
            //窗口大小
            double mainWindowHeight = RegeditRW.RegRead("MainWindowHeight");
            double mainWindowWidth  = RegeditRW.RegRead("MainWindowWidth");
            //字体
            string mainWindowFont = RegeditRW.RegReadString("MainWindowFont");
            //设置菜单
            double winTopmost = RegeditRW.RegRead("Topmost");
            //游戏版本
            double gameVersion = RegeditRW.RegRead("GameVersion");
            #endregion
            //初始化
            InitializeComponent();
            //窗口缩放
            SourceInitialized += delegate(object sender, EventArgs e) { _HwndSource = PresentationSource.FromVisual((Visual)sender) as HwndSource; };
            MouseMove         += new System.Windows.Input.MouseEventHandler(Window_MouseMove);
            //mainWindow初始化标志
            MWInit = true;
            #region "读取设置"
            //设置字体
            if (mainWindowFont == "" || mainWindowFont == null)
            {
                RegeditRW.RegWrite("MainWindowFont", "微软雅黑");
                mainWindowFont = "微软雅黑";
            }
            mainWindow.FontFamily = new FontFamily(mainWindowFont);
            //版本初始化
            UI_Version.Text = "v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
            //窗口可视化计时器
            VisiTimer.Enabled  = true;
            VisiTimer.Interval = 200;
            VisiTimer.Tick    += new EventHandler(VisiTimerEvent);
            VisiTimer.Start();
            //设置光标资源字典路径
            cursorDictionary.Source = new Uri("Dictionary/CursorDictionary.xaml", UriKind.Relative);
            //显示窗口
            MWVisivility = true;
            //右侧面板Visibility属性初始化
            RightPanelVisibility("Welcome");

            //窗口置顶
            if (winTopmost == 1)
            {
                Se_button_Topmost_Click(null, null);
            }
            //设置背景
            if (bg == "")
            {
                Se_BG_Alpha_Text.Foreground = Brushes.Silver;
                Se_BG_Alpha.IsEnabled       = false;
            }
            else
            {
                Se_BG_Alpha_Text.Foreground = Brushes.Black;
                try
                {
                    var brush = new ImageBrush()
                    {
                        ImageSource = new BitmapImage(new Uri(bg))
                    };
                    UI_BackGroundBorder.Background = brush;
                }
                catch
                {
                    Visi.VisiCol(true, UI_BackGroundBorder);
                }
            }
            //设置背景拉伸方式
            if (bgStretch == 0)
            {
                bgStretch = 2;
            }
            Se_ComboBox_Background_Stretch.SelectedIndex = (int)bgStretch - 1;
            //设置背景透明度
            if (bgAlpha == 0)
            {
                bgAlpha = 101;
            }
            Se_BG_Alpha.Value           = bgAlpha - 1;
            Se_BG_Alpha_Text.Text       = "背景不透明度:" + (int)Se_BG_Alpha.Value + "%";
            UI_BackGroundBorder.Opacity = (bgAlpha - 1) / 100;
            //设置面板透明度
            if (bgPanelAlpha == 0)
            {
                bgPanelAlpha = 61;
            }
            Se_Panel_Alpha.Value         = bgPanelAlpha - 1;
            Se_Panel_Alpha_Text.Text     = "面板不透明度:" + (int)Se_Panel_Alpha.Value + "%";
            RightGrid.Background.Opacity = (bgPanelAlpha - 1) / 100;
            //设置窗口透明度
            if (windowAlpha == 0)
            {
                windowAlpha = 101;
            }
            Se_Window_Alpha.Value     = windowAlpha - 1;
            Se_Window_Alpha_Text.Text = "窗口不透明度:" + (int)Se_Window_Alpha.Value + "%";
            Opacity = (windowAlpha - 1) / 100;
            //设置高度和宽度
            Width  = mainWindowWidth;
            Height = mainWindowHeight;
            //设置游戏版本
            UI_gameversion.SelectedIndex = (int)gameVersion;
            #endregion
        }