Beispiel #1
0
        //박스가 날아다니기 시작할 것이다.
        public static void startmoving(Daddy daddy, ILwin.MainWindow thisWin)
        {
            int daddyLoc_x = 0;
            daddy.status = 0;


            while (true)
            {
                //현재 margin left 값을 가져온다
                thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    daddyLoc_x = (int)daddy.daddyRec.Margin.Left;
                }));

                Thread.Sleep(daddy.speedTerm);

                daddy.status = (daddy.status == 1) ? 0 : 1;

                thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    daddy.daddyRec.Fill = daddy.daddyBr[(2 * daddy.dir) + daddy.status];
                }));

                if (daddy.dir == LEFT)
                {
                    //왼쪽 벽에 다다르면
                    if (daddyLoc_x <= 0)
                    {
                        //방향은 오른쪽으로 바뀌고, 그림도 바뀌어야지.
                        daddy.dir = RIGHT;

                        //말풍선도 오른쪽으로 바뀌고, 말풍선 위치도 바뀐다.
                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            daddy.balloon.rec.Background = daddy.balloon.ballBr[RIGHT];
                            daddy.balloon.rec.Margin = new Thickness(daddy.daddyRec.Margin.Left - Constants.DADDY_BALLOON_RIGHT_DIST, daddy.daddyRec.Margin.Top, 0, 0);
                        }));
                    }

                    //그렇지 않다면 계속 왼쪽으로 이동
                    else
                    {

                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            daddy.daddyRec.Margin = new Thickness(daddy.daddyRec.Margin.Left - 2, daddy.daddyRec.Margin.Top,
                                daddy.daddyRec.Margin.Right, daddy.daddyRec.Margin.Bottom);

                            daddy.balloon.rec.Margin = new Thickness(daddy.balloon.rec.Margin.Left - 2, daddy.daddyRec.Margin.Top,
                                daddy.balloon.rec.Margin.Right, daddy.balloon.rec.Margin.Bottom);
                        }));
                    }
                }



                else if (daddy.dir == RIGHT)
                {
                    //왼쪽 벽에 다다르면
                    if (daddyLoc_x >= 640)
                    {
                        daddy.dir = LEFT;

                        //말풍선도 왼쪽으로 바뀌고, 말풍선 위치도 바뀐다.
                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            daddy.balloon.rec.Background = daddy.balloon.ballBr[LEFT];
                            daddy.balloon.rec.Margin = new Thickness(daddy.daddyRec.Margin.Left + Constants.DADDY_BALLOON_LEFT_DIST, daddy.daddyRec.Margin.Top, 0, 0);
                        }));
                    }

                    //그렇지 않다면 계속 왼쪽으로 이동
                    else
                    {

                        thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                        {
                            daddy.daddyRec.Margin = new Thickness(daddy.daddyRec.Margin.Left + 2, daddy.daddyRec.Margin.Top,
                                daddy.daddyRec.Margin.Right, daddy.daddyRec.Margin.Bottom);

                            daddy.balloon.rec.Margin = new Thickness(daddy.balloon.rec.Margin.Left + 2, daddy.daddyRec.Margin.Top,
                                daddy.balloon.rec.Margin.Right, daddy.balloon.rec.Margin.Bottom);

                        }));
                    }
                }


            }


        }
Beispiel #2
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) + "' 라 안 카드나.");
        }
Beispiel #3
0
        //위 sayaboutCom에서 작동할 스레드
        public static void sayaboutComThread(ShowScreen screen, Daddy daddy)
        {
            //WMIhandler에 있는 RAM 계산 함수를 작동시켜서 정보를 얻고, 그 스레드를 기다리자
            Thread thrCPUWMI = new Thread(() => WMIhandler.getCPUdata(screen.getMWinReference().getDatasReference()));
            thrCPUWMI.Start();

            thrCPUWMI.Join();
            screen.getMWinReference().Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
            {
                daddy.balloon.setMSG("CPU 사용량 : " + screen.getMWinReference().getDatasReference().getCPUusage() + ", IL CPU 사용량 : "
                    + screen.getMWinReference().getDatasReference().getMyProcessCPU());
                daddy.isComputingCPU = false;
            }));
        }
Beispiel #4
0
        //박스가 날아다니기 시작할 것이다.
        public static void startjumping(Daddy daddy, ILwin.MainWindow thisWin)
        {
            //점프를 수행한다.

            int jumpY;

            for (jumpY = 0; jumpY < 50; jumpY++ )
            {
                thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    daddy.daddyRec.Margin = new Thickness(daddy.daddyRec.Margin.Left, (daddy.ypos - jumpY*3), 0, 0);
                }));

                Thread.Sleep(5);
            }

            Thread.Sleep(600);

            for (; jumpY > 0; jumpY --)
            {
                thisWin.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    daddy.daddyRec.Margin = new Thickness(daddy.daddyRec.Margin.Left, (daddy.ypos - jumpY*3), 0, 0);
                }));

                Thread.Sleep(5);
            }


            //점프가 끝났음을 알린다.
            daddy.isJumping = false;
                
        }