コード例 #1
0
 public override void BeginDraw(CustomSpriteBatch g)
 {
     //Left Character.
     if (LeftCharacter != null)
     {
         LeftCharacter.BeginDraw(g);
     }
     //Right character.
     if (RightCharacter != null)
     {
         RightCharacter.BeginDraw(g);
     }
 }
コード例 #2
0
        public override void Update(GameTime gameTime)
        {
            if (IsPaused || CurrentDialog == null)
            {
                return;
            }

            //Left Character.
            if (LeftCharacter != null)
            {
                if (LeftCharacter.IsAnimated)
                {
                    LeftCharacter.Update(gameTime);
                }
            }
            //Right character.
            if (RightCharacter != null)
            {
                if (RightCharacter.IsAnimated)
                {
                    RightCharacter.Update(gameTime);
                }
            }

            //Skip the visual novel.
            if (InputHelper.InputSkipPressed())
            {//If at the last scene.
                if (TimelineIndex == Timeline.Count)
                {
                    if (OnVisualNovelEnded != null)
                    {
                        OnVisualNovelEnded();
                    }

                    //Skip to the next screen.
                    RemoveScreen(this);
                    Content.Unload();
                }
                else
                {//Move the the next waypoint.
                    IncrementTimeline();
                }
            }
            if (InputHelper.InputUpPressed())
            {
                DialogChoice -= DialogChoice > 0 ? 1 : 0;
                if (DialogChoice <= DialogChoiceMinIndex)
                {
                    DialogChoiceMinIndex = DialogChoice;
                }
            }
            else if (InputHelper.InputDownPressed())
            {
                DialogChoice += DialogChoice < CurrentDialog.ListNextDialog.Count - 1 ? 1 : 0;
                if (DialogChoice - MaxDialogChoice >= DialogChoiceMinIndex)
                {
                    DialogChoiceMinIndex = DialogChoice - MaxDialogChoice + 1;
                }
            }
            if (InputHelper.InputConfirmPressed())
            {
                if (CurrentDialog.CutsceneAfter != null)
                {
                    PushScreen(CurrentDialog.CutsceneAfter);
                }

                if (TimelineIndex < Timeline.Count)
                {
                    //If there is no dialog linked to the CurrentDialog.
                    if (CurrentDialog.ListNextDialog.Count == 0)
                    {
                        IncrementTimeline();
                        if (TimelineIndex >= Timeline.Count)
                        {
                            if (OnVisualNovelEnded != null)
                            {
                                OnVisualNovelEnded();
                            }

                            RemoveScreen(this);
                        }
                    }
                    else
                    {
                        //If ListNextDialog.Count is not 0, it means there were linked dialogs, so change the current dialog to the one chosen.
                        CurrentDialog = ListDialog[CurrentDialog.ListNextDialog[DialogChoice]];
                        OnNewFrame();
                    }
                }

                if (CurrentDialog.CutsceneBefore != null)
                {
                    PushScreen(CurrentDialog.CutsceneBefore);
                }
            }
            else if (InputHelper.InputCancelPressed())
            {//Show/Hide the sumary.
                PushScreen(new ExtraMenu(this, fntFinlanderFont, TimelineIndexMax));
            }
        }
コード例 #3
0
        private void ClientStart()//내가 클라이언트일 경우
        {
            byte[]    getByte = new byte[1024];
            byte[]    setByte = new byte[1024];
            const int sPort   = 23456;

            string sendstring = null;
            string getstring  = null;

            IPAddress  serverIP       = IPAddress.Parse("25.53.5.184");
            IPEndPoint serverEndPoint = new IPEndPoint(serverIP, sPort);

            Console.WriteLine("asdfsad");
            socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);


            socket.Connect(serverEndPoint);
            if (socket.Connected)
            {
                Console.WriteLine("Connected");
                labelClient.Invoke((MethodInvoker) delegate()
                {
                    labelClient.Visible = false;
                });
            }

            while (true)
            {
                sendstring = RightCharacter.Location.X + "$" + RightCharacter.Location.Y + "$" + leftHPBar.Value + "$" + rightHPBar.Value + "$" +
                             "4" + "$" + "5" + "$" + "6" + "$" + "7" + "$" + "8" + "$" + "9" + "$" + "10" + "$" + "11" + "$" + Q_A_Image.Location.X
                             + "$" + Q_A_Image.Location.Y + "$" + Q_A_Image.Visible + "$" + "15" + "$" + "16" + "$" + "17" + "$" + "18" + "$" + "19" + "$"
                             + "$" + "20" + "$" + "21" + "$" + "22" + "$" + "23" + "$" + "24" + "$" + "25" + "$" + "26" + "$" + leftHPBar.Maximum + "$" +
                             rightHPBar.Maximum;
                if (sendstring != String.Empty)
                {
                    int getValueLength = 0;
                    setByte = Encoding.UTF7.GetBytes(sendstring);
                    socket.Send(setByte, 0, setByte.Length, SocketFlags.None);
                    socket.Receive(getByte, 0, getByte.Length, SocketFlags.None);
                    getValueLength = byteArrayDefrag(getByte);
                    getstring      = Encoding.UTF7.GetString(getByte, 0, getValueLength + 1);
                    string[] result = getstring.Split(new char[] { '$' });

                    #region Receive Result

                    /*
                     * Thread 에서 Form 접근할 시
                     * .Invoke((MethodInvoker)delegate ()
                     * {
                     *  //할거
                     * });
                     */


                    //상대 위치 이동하여 이동
                    Point lc = new Point();
                    lc.X = Convert.ToInt32(result[0]);
                    lc.Y = Convert.ToInt32(result[1]);
                    LeftCharacter.Invoke((MethodInvoker) delegate()
                    {
                        LeftCharacter.Location = lc;
                    });

                    //상대 Q스킬 이미지 위치 및 Visible
                    bool v = Convert.ToBoolean(result[14]);
                    Enemy_Q_A_Image.Invoke((MethodInvoker) delegate()
                    {
                        //할거
                        Enemy_Q_A_Image.Visible = v;
                    });
                    Point eqai = new Point();
                    eqai.X = Convert.ToInt32(result[12]);
                    eqai.Y = Convert.ToInt32(result[13]);
                    Enemy_Q_A_Image.Invoke((MethodInvoker) delegate()
                    {
                        //할거
                        Enemy_Q_A_Image.Location = eqai;
                    });

                    //상대 체력 동기화
                    leftHPBar.Invoke((MethodInvoker) delegate()
                    {
                        //할거
                        rightHPBar.Maximum = Convert.ToInt32(result[27]);
                        leftHPBar.Value    = Convert.ToInt32(result[3]);
                    });

                    #endregion
                }
                getByte = new byte[1024];

                Thread.Sleep(10);
            }
        }