コード例 #1
0
        public LayoutWindow()
        {
            InitializeComponent();

            // 現在のレイアウトをいったん保存しておく
            vLayoutControl.SaveLayout(9, MainWindow.dic);
            // そのレイアウトをローカルに取り込む
            layoutDic = vLayoutControl.LoadLayout(9);

            // 色の設定
            colorChanged = DataContext as ColorChanged;
        }
コード例 #2
0
        public void SetLayout()
        {
            if ( dic != null )
            {
                dic.Clear();
            }
            dic = vLayoutControl.LoadLayout(Properties.Settings.Default.Layout);

            dic["AnalogStick0"].DownAction += new EventHandler<vGamePadEventArgs>(AnalogStickDown);
            dic["AnalogStick0"].MoveAction += new EventHandler<vGamePadEventArgs>(AnalogStickMove);
            dic["AnalogStick0"].UpAction += new EventHandler<vGamePadEventArgs>(AnalogStickUp);

            dic["AnalogStick1"].DownAction += new EventHandler<vGamePadEventArgs>(AnalogStickDown);
            dic["AnalogStick1"].MoveAction += new EventHandler<vGamePadEventArgs>(AnalogStickMove);
            dic["AnalogStick1"].UpAction += new EventHandler<vGamePadEventArgs>(AnalogStickUp);

            dic["Button01"].DownAction += new EventHandler<vGamePadEventArgs>(BarrageDown);
            dic["Button01"].UpAction += new EventHandler<vGamePadEventArgs>(BarrageUp);

            dic["Button02"].DownAction += new EventHandler<vGamePadEventArgs>(BarrageDown);
            dic["Button02"].UpAction += new EventHandler<vGamePadEventArgs>(BarrageUp);

            dic["Button03"].DownAction += new EventHandler<vGamePadEventArgs>(BarrageDown);
            dic["Button03"].UpAction += new EventHandler<vGamePadEventArgs>(BarrageUp);

            dic["Button04"].DownAction += new EventHandler<vGamePadEventArgs>(BarrageDown);
            dic["Button04"].UpAction += new EventHandler<vGamePadEventArgs>(BarrageUp);

            dic["Button05"].DownAction += new EventHandler<vGamePadEventArgs>(ButtonDown);
            dic["Button05"].UpAction += new EventHandler<vGamePadEventArgs>(ButtonUp);

            dic["Button06"].DownAction += new EventHandler<vGamePadEventArgs>(ButtonDown);
            dic["Button06"].UpAction += new EventHandler<vGamePadEventArgs>(ButtonUp);

            dic["Button07"].DownAction += new EventHandler<vGamePadEventArgs>(ButtonDown);
            dic["Button07"].UpAction += new EventHandler<vGamePadEventArgs>(ButtonUp);

            dic["Button08"].DownAction += new EventHandler<vGamePadEventArgs>(ButtonDown);
            dic["Button08"].UpAction += new EventHandler<vGamePadEventArgs>(ButtonUp);

            dic["Button09"].DownAction += new EventHandler<vGamePadEventArgs>(ButtonDown);
            dic["Button09"].UpAction += new EventHandler<vGamePadEventArgs>(ButtonUp);

            dic["Button10"].DownAction += new EventHandler<vGamePadEventArgs>(ButtonDown);
            dic["Button10"].UpAction += new EventHandler<vGamePadEventArgs>(ButtonUp);

            dic["Button11"].DownAction += new EventHandler<vGamePadEventArgs>(ButtonDown);
            dic["Button11"].UpAction += new EventHandler<vGamePadEventArgs>(ButtonUp);

            dic["Button12"].DownAction += new EventHandler<vGamePadEventArgs>(ButtonDown);
            dic["Button12"].UpAction += new EventHandler<vGamePadEventArgs>(ButtonUp);

            dic["Button_UP"].DownAction += new EventHandler<vGamePadEventArgs>(CrossDown);
            dic["Button_UP"].UpAction += new EventHandler<vGamePadEventArgs>(CrossUp);

            dic["Button_DOWN"].DownAction += new EventHandler<vGamePadEventArgs>(CrossDown);
            dic["Button_DOWN"].UpAction += new EventHandler<vGamePadEventArgs>(CrossUp);

            dic["Button_LEFT"].DownAction += new EventHandler<vGamePadEventArgs>(CrossDown);
            dic["Button_LEFT"].UpAction += new EventHandler<vGamePadEventArgs>(CrossUp);

            dic["Button_RIGHT"].DownAction += new EventHandler<vGamePadEventArgs>(CrossDown);
            dic["Button_RIGHT"].UpAction += new EventHandler<vGamePadEventArgs>(CrossUp);

            dic["Keyboard"].DownAction += new EventHandler<vGamePadEventArgs>(DefaultDown);
            dic["Keyboard"].UpAction += new EventHandler<vGamePadEventArgs>(KeyboardUp);

            dic["Crop"].DownAction += new EventHandler<vGamePadEventArgs>(DefaultDown);
            dic["Crop"].UpAction += new EventHandler<vGamePadEventArgs>(CropUp);

            dic["Config"].DownAction += new EventHandler<vGamePadEventArgs>(DefaultDown);
            dic["Config"].UpAction += new EventHandler<vGamePadEventArgs>(ConfigUp);

            dic["Exit"].DownAction += new EventHandler<vGamePadEventArgs>(DefaultDown);
            dic["Exit"].UpAction += new EventHandler<vGamePadEventArgs>(ExitUp);

            dic["Home"].DownAction += new EventHandler<vGamePadEventArgs>(HomeDown);
            dic["Home"].MoveAction += new EventHandler<vGamePadEventArgs>(HomeMove);
            dic["Home"].UpAction += new EventHandler<vGamePadEventArgs>(HomeUp);

            // とりあええずここに配置
            foreach (UIElement ui in vGamePadCanvas.Children)
            {
                foreach (string key in dic.Keys)
                {
                    if (ui.Uid == key)
                    {
                        var button = dic[key];

                        button.Width = (double)ui.GetValue(WidthProperty);
                        button.Height = (double)ui.GetValue(HeightProperty);

                        if (button.Top != double.MaxValue)
                        {
                            ui.ClearValue(Canvas.BottomProperty);
                            ui.SetValue(Canvas.TopProperty, button.Top);
                        }
                        else if (button.Bottom != double.MaxValue)
                        {
                            ui.ClearValue(Canvas.TopProperty);
                            ui.SetValue(Canvas.BottomProperty, button.Bottom);
                        }

                        if (button.Left != double.MaxValue)
                        {
                            ui.ClearValue(Canvas.RightProperty);
                            ui.SetValue(Canvas.LeftProperty, button.Left);
                        }
                        else if (button.Right != double.MaxValue)
                        {
                            ui.ClearValue(Canvas.LeftProperty);
                            ui.SetValue(Canvas.RightProperty, button.Right);
                        }
                        ui.SetValue(Canvas.VisibilityProperty, button.Visible);
                        break;
                    }
                }
            }
        }
コード例 #3
0
 private void Reset_Click(object sender, RoutedEventArgs e)
 {
     PlayButtonSound.Play();
     var dialog = new DialogWindow.DialogWindow(
         Properties.Resources.LayoutWindowResetTitle,
         Properties.Resources.LayoutWindowResetMessage,
         DialogWindow.DialogWindow.DialogStyle.OKCANCEL);
     var result = dialog.ShowDialog();
     if (result == true)
     {
         layoutDic = vLayoutControl.LoadLayout(9);
         SetButtonLayout();
     }
 }
コード例 #4
0
 private void Load_Click(object sender, RoutedEventArgs e)
 {
     PlayButtonSound.Play();
     var dialog = new DialogWindow.DialogWindow(
         Properties.Resources.LayoutWindowLoadTitle,
         Properties.Resources.LayoutWindowLoadMessage,
         DialogWindow.DialogWindow.DialogStyle.ORIGINAL);
     if (!vLayoutControl.LayoutFileExists(1))
         dialog.Botton1.IsEnabled = false;
     if (!vLayoutControl.LayoutFileExists(2))
         dialog.Botton2.IsEnabled = false;
     var result = dialog.ShowDialog();
     var ret = dialog.result;
     switch (ret)
     {
         case 1:
         case 2:
             layoutDic = vLayoutControl.LoadLayout((int)ret);
             // 現在のレイアウトをいったん保存しておく
             vLayoutControl.SaveLayout(9, layoutDic);
             SetButtonLayout();
             break;
         default:
             break;
     }
 }