예제 #1
0
        private void Show_Click(object sender, RoutedEventArgs e)
        {
            //コントローラーを入れる場所を作る
            mogurahole targetbutton = Mogura1_1;


            // 押されたボタンの名前を取得
            String buttonName = ((Button)sender).Name;

            // 押されたボタンによって、対象のイメージコントローラーを切り替える
            if (buttonName == "Show1")
            {
                targetbutton = Mogura1_1;
            }
            else if (buttonName == "Show2")
            {
                targetbutton = Mogura1_2;
            }
            else if (buttonName == "Show3")
            {
                targetbutton = Mogura1_3;
            }
            else if (buttonName == "Show4")
            {
                targetbutton = Mogura2_1;
            }
            else
            {
                targetbutton = Mogura1_1;
            }



            // クリック時のイベントを設定
            targetbutton.AttackEvent = () =>
            {
                Mogura_Click();
                count1++;
                if (PlayerNumber == 1)
                {
                    this.DataContext = new { Name1 = "プレイヤー1", Name2 = "プレイヤー2", Score1 = count1, Score2 = count2 }
                }
                ;
                else if (PlayerNumber == 2)
                {
                    this.DataContext = new { Name1 = "プレイヤー2", Name2 = "プレイヤー1", Score1 = count1, Score2 = count2 }
                }
                ;
                // Application.Propertiesに設定しておく。
                PN number = new PN()
                {
                    playernumber = PlayerNumber
                };
                PN C1 = new PN()
                {
                    c1 = count1
                };
                PN C2 = new PN()
                {
                    c2 = count2
                };
                Application.Current.Properties["Number"] = number;
                Application.Current.Properties["C1"]     = C1;
                Application.Current.Properties["C2"]     = C2;
            };

            // モグラを表示
            targetbutton.ShowMogura();
        }
예제 #2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 9 "..\..\Play_page.xaml"
                ((game_p.Play_page)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Page_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.Mogura1_1 = ((game_p.mogurahole)(target));
                return;

            case 3:
                this.Mogura1_2 = ((game_p.mogurahole)(target));
                return;

            case 4:
                this.Mogura1_3 = ((game_p.mogurahole)(target));
                return;

            case 5:
                this.Mogura1_4 = ((game_p.mogurahole)(target));
                return;

            case 6:
                this.Mogura1_5 = ((game_p.mogurahole)(target));
                return;

            case 7:
                this.Mogura1_6 = ((game_p.mogurahole)(target));
                return;

            case 8:
                this.Mogura2_1 = ((game_p.mogurahole)(target));
                return;

            case 9:
                this.Mogura2_2 = ((game_p.mogurahole)(target));
                return;

            case 10:
                this.Mogura2_3 = ((game_p.mogurahole)(target));
                return;

            case 11:
                this.Mogura2_4 = ((game_p.mogurahole)(target));
                return;

            case 12:
                this.Mogura2_5 = ((game_p.mogurahole)(target));
                return;

            case 13:
                this.Mogura2_6 = ((game_p.mogurahole)(target));
                return;

            case 14:
                this.Mogura3_1 = ((game_p.mogurahole)(target));
                return;

            case 15:
                this.Mogura3_2 = ((game_p.mogurahole)(target));
                return;

            case 16:
                this.Mogura3_3 = ((game_p.mogurahole)(target));
                return;

            case 17:
                this.Mogura3_4 = ((game_p.mogurahole)(target));
                return;

            case 18:
                this.Mogura3_5 = ((game_p.mogurahole)(target));
                return;

            case 19:
                this.Mogura3_6 = ((game_p.mogurahole)(target));
                return;

            case 20:
                this.Mogura4_1 = ((game_p.mogurahole)(target));
                return;

            case 21:
                this.Mogura4_2 = ((game_p.mogurahole)(target));
                return;

            case 22:
                this.Mogura4_3 = ((game_p.mogurahole)(target));
                return;

            case 23:
                this.Mogura4_4 = ((game_p.mogurahole)(target));
                return;

            case 24:
                this.Mogura4_5 = ((game_p.mogurahole)(target));
                return;

            case 25:
                this.Mogura4_6 = ((game_p.mogurahole)(target));
                return;
            }
            this._contentLoaded = true;
        }