Example #1
0
        public Namyong(Brush[] imgs, ILwin.ShowScreen screen, int xpos, int ypos, int dir)
        {
            Random rnd = new Random();

            namyongBr = imgs;
            this.screen = screen;

            this.dir = dir;
            this.ypos = ypos;
            this.xpos = xpos;

            speedTerm = Constants.NAMYONG_SPEED;

            balloon = new Balloon(Constants.IS_NAMYONG, screen);
            balloon.showBalloon(dir, xpos, ypos);

            //생성
            namyongRec = new System.Windows.Shapes.Rectangle();
            namyongRec.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            namyongRec.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            namyongRec.Width = Constants.NAYONG_WIDTH;
            namyongRec.Height = Constants.NAYONG_HEIGHT;
            namyongRec.Fill = namyongBr[dir];
            namyongRec.Margin = new Thickness(xpos, ypos, 0, 0);
            screen.sp.Children.Add(namyongRec);

            isGettingKeyword = false;
            isJumping = false;
            isComputingRAM = false;
        }
Example #2
0
        public Daddy(Brush[] imgs, ILwin.ShowScreen screen, int xpos, int ypos, int dir)
        {
            Random rnd = new Random();

            daddyBr = imgs;
            this.screen = screen;

            this.dir = dir;
            this.ypos = ypos;
            this.xpos = xpos;

            this.speedTerm = Constants.DADDY_SPEED;

            balloon = new Balloon(Constants.IS_DADDY, screen);
            balloon.showBalloon(dir, xpos, ypos);


            //생성
            daddyRec = new System.Windows.Shapes.Rectangle();
            daddyRec.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            daddyRec.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            daddyRec.Width = Constants.DADDY_WIDTH;
            daddyRec.Height = Constants.DADDY_HEIGHT;
            daddyRec.Fill = daddyBr[dir];
            daddyRec.Margin = new Thickness(xpos, ypos, 0, 0);
            screen.sp.Children.Add(daddyRec);

            isGettingKeyword = false;
            isJumping = false;
            isComputingCPU = false;
        }
Example #3
0
        //말풍선 메시지 내부의 스레드
        public static void setMSG(Balloon thisballoon, ILwin.MainWindow thisWin)
        {
            //5초 후, 메세지를 닫아버린다.
            Thread.Sleep(5000);

            thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
            {
                thisballoon.textbox.Visibility = Visibility.Hidden;
                thisballoon.rec.Visibility = Visibility.Hidden;
                thisballoon.textbox.Text = "";
            }));

            thisballoon.isShowing = false;
        }
Example #4
0
        //서브 스레드에서 호출하는 말풍선 메시지 함수
        public static void setMSGsub(ILwin.MainWindow thisWin, Balloon thisballoon, string text)
        {
            //만일 말풍선이 켜져있던 상태라면
            if (thisballoon.isShowing)
            {
                thisballoon.showing.Abort();                    //일단 그 스레드를 종료한다.

                thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        thisballoon.rec.Visibility = Visibility.Hidden;         //그리고 말풍선을 모두 닫아버린다.
                        thisballoon.textbox.Visibility = Visibility.Hidden;
                        thisballoon.textbox.Text = "";
                    }));
                thisballoon.isShowing = false;
            }

            thisballoon.isShowing = true;
            thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        thisballoon.rec.Visibility = Visibility.Visible;
                        thisballoon.textbox.Visibility = Visibility.Visible;
                        thisballoon.textbox.Text = text;

                        //말풍선 내용이 response 창에도 나오도록 하자
                        thisWin.getTextboxReference().printMSG(thisWin.responseMsgs, ((thisballoon.TALKER == Constants.IS_NAMYONG) ? "남용이 : " : "아버지 : ") + text);
                        thisWin.responseMsgs.ScrollToEnd();
                    }));

            thisballoon.showing = new Thread(() => setMSG(thisballoon, thisballoon.screen.getMWinReference()));
            thisballoon.showing.Start();
        }
Example #5
0
        //sayKeyword에서 실행되는 스레드.
        public static void sayKeywordThr(Namyong namyong, Balloon balloon)
        {
            //가져올 검색어들. 2개 정도만 가져온다.
            List<string> keywords = new List<string>();

            Thread thrkeyword = new Thread(() => HTMLhandler.getHotKeyword(Constants.IS_NAMYONG, keywords));
            thrkeyword.Start();

            //기다리자
            thrkeyword.Join();

            namyong.isGettingKeyword = false;

            Balloon.setMSGsub(namyong.screen.getMWinReference(), balloon, "아까 전까지 뜨고 있던 키워드는 '" + keywords.ElementAt(0) + "', '" + keywords.ElementAt(1) + "' 라고 합니다.");
        }
Example #6
0
        //sayKeyword
        public void sayKeyword(Balloon balloon)
        {
            if (isGettingKeyword)
            {
                thrtalk.Abort();
                isGettingKeyword = false;
            }

            isGettingKeyword = true;
            thrtalk = new Thread(() => sayKeywordThr(this, balloon));
            thrtalk.Start();
        }
Example #7
0
        //sayKeyword에서 실행되는 스레드.
        public static void sayKeywordThr(Daddy daddy, Balloon balloon)
        {
            //가져올 검색어들. 2개 정도만 가져온다.
            List<string> keywords = new List<string>();

            Thread thrkeyword = new Thread(() => HTMLhandler.getHotKeyword(Constants.IS_DADDY, keywords));
            thrkeyword.Start();

            //기다리자
            thrkeyword.Join();

            daddy.isGettingKeyword = false;

            Balloon.setMSGsub(daddy.screen.getMWinReference(), balloon, "지금 막 뜨고있는 키워드가 뭔지 아노? '" + keywords.ElementAt(0) + "', '" + keywords.ElementAt(1) + "' 라 안 카드나.");
        }