Beispiel #1
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            MyMessageBox message = new MyMessageBox();

            if (txtID.Text == "" || txtPassword.Text == "" || txtConfrim.Text == "" || txtPassword2.Text == "")
            {
                message.SetText = ("빈칸이 없도록 입력해 주세요.");
                message.ShowDialog();
            }

            if (txtID.Text != "" && txtPassword.Text != "" && txtConfrim.Text != "" && txtPassword2.Text != "")
            {
                if (txtPassword.Text == txtConfrim.Text)
                {
                    message.SetText = ("새로운 사용자를 등록 합니다.");
                    message.ShowDialog();
                    db_Insert();
                    MainWindow mainWindow = new MainWindow();
                    mainWindow.Show();
                    this.Close();
                }
                else
                {
                    message.SetText = ("패스워드를 확인해 주세요.");
                    message.ShowDialog();
                }
            }
        }
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            button1.IsEnabled = false;
            button2.IsEnabled = false;
            button3.IsEnabled = false;
            button4.IsEnabled = false;
            button5.IsEnabled = false;

            glistCount -= 10;
            try
            {
                if (glistCount < 0)
                {
                    MyMessageBox Error = new MyMessageBox();
                    Error.SetText = "처음 화면 입니다.";
                    Error.ShowDialog();
                    glistCount = 0;
                    b3         = false;
                    //버튼3 막기
                    throw new ExceptionError();
                }
                gameDeckRef();
            }
            catch (ExceptionError)
            {
                button1.IsEnabled = true;
                button2.IsEnabled = true;
                button3.IsEnabled = false;
                button4.IsEnabled = true;
                button5.IsEnabled = true;
            }
        }
Beispiel #3
0
        private void start_Click(object sender, RoutedEventArgs e)
        {
            MemberDataContext memContext = new MemberDataContext();
            Test         test            = new Test();
            MyMessageBox myMessageBox    = new MyMessageBox();
            //DB의 Mem.MemberCharacter의 Character 필드가 null일때 CreatedCharactor를 호출
            var queryMember = from cust in memContext.MemberCharacter
                              where cust.MemberName == UserID
                              select cust;

            foreach (var item in queryMember)
            {
                if (item.CharacterImage == null)
                {
                    //MessageBox.Show(UserID + "님은 현재 캐릭터가 없습니다.");
                    myMessageBox.SetText = UserID + "님은 현재 캐릭터가 없습니다.";
                    myMessageBox.ShowDialog();
                    CreatedCharactor mCreate = new CreatedCharactor(mainmenu);
                    mCreate.Show();
                    //MainMenu main = (MainMenu)this.Parent;
                    //main.Hide();
                    // 페이지 숨기기
                }
                else
                {
                    //MessageBox.Show(UserID + "님 게임을 시작 합니다.");
                    myMessageBox.SetText = UserID + "님 게임을 시작 합니다.";
                    //CreatedCharactor mCreate = new CreatedCharactor(mainmenu);
                    //mCreate.Show();
                    //StageSelect stageSel = new StageSelect(mainmenu);
                    //MainMenu.getInstance().frame.Content = stageSel;

                    myMessageBox.ShowDialog();
                    if (myMessageBox.DialogResult == true)
                    {
                        Stag_Select();
                    }
                }
                //게임으로 화면 전환하기
            }
        }
Beispiel #4
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            MyMessageBox message = new MyMessageBox();

            if ((textBox2.Text).CompareTo(ans) == 0)
            {
                message.SetText = ("정답");
                message.ShowDialog();
                timer.Stop();
                this.Close();
                SamGookStage1.Question = true;
            }
            else
            {
                message.SetText = "틀렸어요!";
                message.ShowDialog();
                timer.Stop();
                this.Close();
                SamGookStage1.Question = true;
            }
        }
Beispiel #5
0
        private void Stag_Select()
        {
            MemberDataContext mem          = new MemberDataContext();
            MyMessageBox      myMessageBox = new MyMessageBox();

            var innerJoinQuery = from Members in mem.Member
                                 join Information in mem.MemberGameInformation on Members.MemberName equals Information.MemberName
                                 where Information.MemberName == Player.getInstance().getID()
                                 select Information;

            //DB의 유저의 쫄 카드 정보 받아와서 Card객체 만들고 DeckList에 삽입
            foreach (var item in innerJoinQuery)
            {
                Stage = (int)item.GameStage;
                Phase = (int)item.GamePhase;
            }

            //MessageBox.Show("현재 "+ UserID + " 님의 게임 진행 상황은 Stage " + Stage + " - " + Phase + " 를 진행 중 입니다.");
            myMessageBox.SetText = "현재 " + UserID + " 님의 게임 진행 상황은 Stage " + Stage + " - " + Phase + " 를 \n진행 중 입니다.";
            myMessageBox.ShowDialog();

            SamGookStageSelect samgookStageSelect = new SamGookStageSelect();

            switch (Stage)
            {
            case 1:

                MainMenu.getInstance().frame.Navigate(samgookStageSelect);
                break;

            case 2:
                GoruelStageSelect goruelStageSelect = new GoruelStageSelect();
                MainMenu.getInstance().frame.Navigate(goruelStageSelect);
                break;

            case 3:
                ChosenStageSelect chosenStageSelect = new ChosenStageSelect();
                MainMenu.getInstance().frame.Navigate(chosenStageSelect);
                break;

            case 4:
                DarkageStageSelect darkageStageSelect = new DarkageStageSelect();
                MainMenu.getInstance().frame.Navigate(darkageStageSelect);
                break;

            default:
                MainMenu.getInstance().frame.Navigate(samgookStageSelect);
                break;
            }
        }
 private void play_Click(object sender, RoutedEventArgs e)
 {
     if (check == true)
     {
         myface_save();
         SamGookStageSelect stageSel = new SamGookStageSelect();
         MainMenu.getInstance().frame.Content = stageSel;
         this.Close();
     }
     else
     {
         MyMessageBox messagebox = new MyMessageBox();
         messagebox.SetText = ("얼굴을 만들어주세요.");
         messagebox.ShowDialog();
     }
 }
        private void webcam_Click(object sender, RoutedEventArgs e)
        {
            Camera MyWebCam = new Camera();
            FilterInfoCollection MyDevices = MyWebCam.MyCameraDevices;

            if (MyDevices.Count == 0)
            {
                MyMessageBox message = new MyMessageBox();
                message.SetText = "현재 PC에 연결된 Cam이 없습니다.";
                message.ShowDialog();
            }
            else
            {
                mWebcam = new Webcam(this);
                mWebcam.Show();
            }
        }
        void item2_Click(object sender, RoutedEventArgs e)
        {
            MyMessageBox myMessageBox = new MyMessageBox();

            for (int i = 0; i < gameCardDeckList.Count; i++)
            {
                if (gameCardDeckList[i].CardName.CompareTo(selectCanvas.Name) == 0)
                {
                    selectCardNumber       = gameCardDeckList[i].cardNumber;
                    gameDeckCardList_Index = i;
                    break;
                }
            }

            myMessageBox.SetText = "카드 리스트에서 카드를 선택하세요. \n선택된 카드를 게임 카드덱에 넣습니다.";
            UpdateCard           = true;
            myMessageBox.ShowDialog();
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            button1.IsEnabled = false;
            button2.IsEnabled = false;
            button3.IsEnabled = false;
            button4.IsEnabled = false;
            button5.IsEnabled = false;

            listCount -= 28;

            if (listCount < 0)
            {
                MyMessageBox Error = new MyMessageBox();
                Error.SetText = "처음 화면 입니다.";
                Error.ShowDialog();
                listCount = 0;
                b1        = false;
                //버튼1 막기
            }
            playDeckRef();
        }
        private void CardInfo()
        {
            CardDataContext card           = new CardDataContext();
            MyMessageBox    myMessageBox   = new MyMessageBox();
            var             innerJoinQuery = from Deck in card.HeroCard
                                             join Magic in card.HeroCardSkill on Deck.HeroCardName equals Magic.HeroCardName
                                             where Deck.HeroCardName == "동명왕"
                                             select Magic;
            String str = "";

            foreach (var item in innerJoinQuery)
            {
                str += item.HeroCardName;
                str += " ";
                str += item.SkillName;
                str += item.SkillPoint;
            }

            myMessageBox.SetText = str;
            myMessageBox.ShowDialog();
        }
Beispiel #11
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            var queryMember = from cust in mem.Member
                              where cust.MemberName == textBox2.Text
                              select cust;

            foreach (var item in queryMember)
            {
                if (item.MemberPassword == textBox1.Text)
                {
                    Test test = new Test();
                    test.SetText = "확인되었습니다. ";
                    test.SetText = "게임을 시작합니다.";
                    test.ShowDialog();
                    //MessageBox.Show("확인되었습니다. 게임을 시작 합니다.");
                    if (test.DialogResult == true)
                    {
                        maimenu = MainMenu.getInstance();
                        Menu menu = new Menu();
                        maimenu.Activate();

                        this.Close();
                        if (maimenu.ShowActivated == true)
                        {
                            UserID = textBox2.Text;
                            player.setID(UserID);
                            maimenu.UserID = UserID;
                            maimenu.Show();
                        }
                    }
                }
                else
                {
                    MyMessageBox message = new MyMessageBox();
                    message.SetText = "ID나 비밀번호를 다시 확인해 주세요.";
                    message.ShowDialog();
                }
            }
        }
Beispiel #12
0
        void timer_Tick(object sender, EventArgs e)
        {
            //label4.Content = "";
            // label4.Content = time.ToString();

            time++;

            if (time < 10)
            {
                //MessageBox.Show("하");
                //MessageBox.Show(AppDomain.CurrentDomain.BaseDirectory);
                string uri = AppDomain.CurrentDomain.BaseDirectory + time.ToString() + ".png";
                number_img.Source = new BitmapImage(new Uri(uri, UriKind.RelativeOrAbsolute));
            }
            else
            {
                MyMessageBox message = new MyMessageBox();
                message.SetText = "시간이 다 되었네요.";
                message.ShowDialog();
                timer.Stop();
                this.Close(); // 종료가 아닌 Window만 close 하기.
            }
        }
Beispiel #13
0
        private void db_Insert()
        {
            MemberDataContext memContext = new MemberDataContext();
            CardDataContext   card       = new CardDataContext();

            Member mem = new Member();

            mem.MemberName      = txtID.Text;
            mem.MemberPassword  = txtPassword.Text;
            mem.MemberPassword2 = txtPassword2.Text;

            memContext.Member.InsertOnSubmit(mem);
            try
            {
                memContext.SubmitChanges();
                card.Game_CardDeck(txtID.Text);
            }
            catch
            {
                MyMessageBox error = new MyMessageBox();
                error.SetText = "같은 아이디가 있습니다.";
                error.ShowDialog();
            }
        }
Beispiel #14
0
        private void userCard_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            selectCanvas = (Canvas)sender; // 클릭한놈으로 부터 canvas 연결
            int selectDeckCard = 0;

            try
            {
                if (UpdateCard == true)
                {
                    Test myDialog = new Test();

                    myDialog.SetText = "선택한 카드가 " + selectCanvas.Name + " 이 맞나요?";
                    myDialog.ShowDialog();

                    if (myDialog.DialogResult == true)
                    {
                        // Check
                        for (int i = 0; i < gameCardDeckList.Count; i++)
                        {
                            if (gameCardDeckList[i].CardName.CompareTo(selectCanvas.Name) == 0)
                            {
                                throw new ExceptionError();
                            }
                        }
                        // Update DataBase
                        for (int i = 0; i < playerCardDeckList.Count; i++)
                        {
                            if (playerCardDeckList[i].CardName.CompareTo(selectCanvas.Name) == 0)
                            {
                                selectDeckCard           = playerCardDeckList[i].cardNumber;
                                playerDeckCardList_Index = i;
                                break;
                            }
                        }
                        if (selectDeckCard == selectCardNumber)
                        {
                            throw new ExceptionError();
                        }
                        CardDataContext card = new CardDataContext();

                        var query =
                            from gameDeck in card.GameDeck
                            where gameDeck.MemberName == Player.getInstance().getID() && gameDeck.CardNumberID == selectCardNumber
                            select gameDeck;

                        foreach (var item in query)
                        {
                            item.CardNumberID = selectDeckCard;
                        }

                        try
                        {
                            card.SubmitChanges();
                            gameCardDeckList[gameDeckCardList_Index] = playerCardDeckList[playerDeckCardList_Index];
                            MyMessageBox myMessageBox = new MyMessageBox();
                            myMessageBox.SetText = "카드를 변경 하였어요.";
                            myMessageBox.ShowDialog();
                            gameDeckRef();
                        }
                        catch (Exception error)
                        {
                            MyMessageBox myMessageBoxError = new MyMessageBox();
                            myMessageBoxError.SetText = error.ToString();
                            myMessageBoxError.ShowDialog();
                        }
                    }
                    UpdateCard       = false;
                    selectCardNumber = 0;
                }
            }
            catch (ExceptionError)
            {
                MyMessageBox myMessageBoxError = new MyMessageBox();
                myMessageBoxError.SetText = "선택된 카드가 중복 되었네요. 다른 카드를 선택해 주세요.";
                myMessageBoxError.ShowDialog();
            }
        }
Beispiel #15
0
        void timer_Tick(object sender, EventArgs e)
        {
            time++;

            try
            {
                if (time <= 1 || time <= 14)
                {
                    int    i               = time - 1;
                    Card   card            = new Card();
                    Canvas playerSubCanvas = new Canvas();

                    card = playerCardDeckList[listCount];

                    playerSubCanvas.Name = card.CardName;

                    if (card.CardName == null)
                    {
                        throw new ExceptionError();
                    }

                    playerSubCanvas.Background = new ImageBrush(new BitmapImage(new Uri(card.CardName + ".png", UriKind.Relative)));
                    TextBlock hp         = new TextBlock();
                    TextBlock dam        = new TextBlock();
                    TextBlock skill      = new TextBlock();
                    TextBlock col        = new TextBlock();
                    TextBlock row        = new TextBlock();
                    TextBlock skillLine1 = new TextBlock();
                    TextBlock skillLine2 = new TextBlock();
                    TextBlock skillLine3 = new TextBlock();

                    hp.Name    = "hp";
                    dam.Name   = "dam";
                    skill.Name = "skill";
                    col.Name   = "index";
                    row.Name   = "gridName";

                    hp.Text         = card.CardHP.ToString();
                    dam.Text        = card.CardDam.ToString();
                    col.Text        = "0";
                    row.Text        = i.ToString();
                    skillLine1.Text = card.skill1 + ": 공격력 업";
                    skillLine2.Text = card.skill2 + ": 체력 업";
                    skillLine3.Text = card.skill3 + ": 턴 업";

                    hp.FontSize   = 10;
                    hp.Foreground = Brushes.Red;
                    hp.FontWeight = FontWeights.Bold;

                    dam.FontSize   = 10;
                    dam.Foreground = Brushes.Red;
                    dam.FontWeight = FontWeights.Bold;

                    skillLine1.FontSize   = 8;
                    skillLine1.Foreground = Brushes.Blue;
                    skillLine1.FontWeight = FontWeights.Bold;

                    skillLine2.FontSize   = 8;
                    skillLine2.Foreground = Brushes.Blue;
                    skillLine2.FontWeight = FontWeights.Bold;

                    skillLine3.FontSize   = 8;
                    skillLine3.Foreground = Brushes.Blue;
                    skillLine3.FontWeight = FontWeights.Bold;

                    playerBackCanvasList[i] = playerSubCanvas;

                    Canvas.SetLeft(hp, 65);
                    Canvas.SetBottom(hp, 37);

                    Canvas.SetLeft(dam, 22);
                    Canvas.SetBottom(dam, 36);

                    Canvas.SetLeft(skillLine1, 10);
                    Canvas.SetBottom(skillLine1, 26);

                    Canvas.SetLeft(skillLine2, 10);
                    Canvas.SetBottom(skillLine2, 17);

                    Canvas.SetLeft(skillLine3, 10);
                    Canvas.SetBottom(skillLine3, 8);

                    playerSubCanvas.Children.Add(hp);
                    playerSubCanvas.Children.Add(dam);
                    playerSubCanvas.Children.Add(skill);
                    playerSubCanvas.Children.Add(col);
                    playerSubCanvas.Children.Add(row);
                    playerSubCanvas.Children.Add(skillLine1);
                    playerSubCanvas.Children.Add(skillLine2);
                    playerSubCanvas.Children.Add(skillLine3);

                    playerSubCanvas.Width  = 100;
                    playerSubCanvas.Height = 150;

                    Canvas.SetTop(playerSubCanvas, 1000 - 150);
                    Canvas.SetLeft(playerSubCanvas, 1400 - 100);


                    Deck_Canvas.Children.Add(playerSubCanvas);
                    string targetGridName = "Me" + i;
                    //mvAni.Invoke(playerSubCanvas, (Grid)Play_Stage.FindName(targetGridName), i);
                    moveAnimation(playerSubCanvas, (Grid)Deck_Canvas.FindName(targetGridName), i);

                    //moveAnimation(playerSubCanvas, Me, i);
                    playerSubCanvas.MouseLeftButtonDown  += new MouseButtonEventHandler(userCard_MouseLeftButtonDown);
                    playerSubCanvas.MouseRightButtonDown += new MouseButtonEventHandler(Card_MouseLeftButtonDown);
                    ++listCount;

                    if (listCount >= playerCardDeckList.Count)
                    {
                        MyMessageBox messagebox = new MyMessageBox();
                        messagebox.SetText = "더이상 카드가 없어요.";
                        messagebox.ShowDialog();
                        //listCount = 0;
                        b2 = false;
                        b1 = true;
                        timer.Stop();
                        time = 0;
                        throw new ExceptionError();
                    }
                }
                else
                {
                    timer.Stop();
                    time = 0;
                    if (gtimeInit == true)
                    {
                        initMyDeck();
                        setGameDeckCard();
                        gtimeInit = false;
                    }
                    if (b1 == true)
                    {
                        button1.IsEnabled = true;
                    }
                    else
                    {
                        button1.IsEnabled = false;
                        b1 = true;
                    }
                    if (b2 == true)
                    {
                        button2.IsEnabled = true;
                    }
                    else
                    {
                        button2.IsEnabled = false;
                        b2 = true;
                    }
                    if (b3 == true)
                    {
                        button3.IsEnabled = true;
                    }
                    else
                    {
                        button3.IsEnabled = false;
                        b3 = true;
                    }
                    if (b4 == true)
                    {
                        button4.IsEnabled = true;
                    }
                    else
                    {
                        button4.IsEnabled = false;
                        b4 = true;
                    }
                    if (b5 == true)
                    {
                        button5.IsEnabled = true;
                    }
                    else
                    {
                        button5.IsEnabled = false;
                        b5 = true;
                    }
                }
            }
            catch (ExceptionError)
            {
                timer.Stop();
                time = 0;
                button2.IsEnabled = false;
                if (gtimeInit == true)
                {
                    initMyDeck();
                    setGameDeckCard();
                    gtimeInit = false;
                }
                if (b1 == true)
                {
                    button1.IsEnabled = true;
                }
                else
                {
                    button1.IsEnabled = false;
                    b1 = true;
                }
                if (b2 == true)
                {
                    button2.IsEnabled = true;
                }
                else
                {
                    button2.IsEnabled = false;
                    b2 = true;
                }
                if (b3 == true)
                {
                    button3.IsEnabled = true;
                }
                else
                {
                    button3.IsEnabled = false;
                    b3 = true;
                }
                if (b4 == true)
                {
                    button4.IsEnabled = true;
                }
                else
                {
                    button4.IsEnabled = false;
                    b4 = true;
                }
                if (b5 == true)
                {
                    button5.IsEnabled = true;
                }
                else
                {
                    button5.IsEnabled = false;
                    b5 = true;
                }
            }
        }