Exemplo n.º 1
0
 public override void BeginDraw(CustomSpriteBatch g)
 {
     //Left Character.
     if (LeftCharacter != null)
     {
         LeftCharacter.BeginDraw(g);
     }
     //Right character.
     if (RightCharacter != null)
     {
         RightCharacter.BeginDraw(g);
     }
 }
Exemplo n.º 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));
            }
        }
Exemplo n.º 3
0
        private void ServerStart() //내가 서버일경우
        {
            byte[]    getByte = new byte[1024];
            byte[]    setByte = new byte[1024];
            const int sPort   = 23456;

            string    stringbyte = null;
            IPAddress serverIP   = IPAddress.Parse("25.53.5.184");

            Console.WriteLine("asdfasdf");
            IPEndPoint serverEndPoint = new IPEndPoint(serverIP, sPort);

            try
            {
                Server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                Server.Bind(serverEndPoint);
                Server.Listen(10);
                Client = Server.Accept();

                if (Client.Connected)
                {
                    labelClient.Invoke((MethodInvoker) delegate()
                    {
                        labelClient.Visible = false;
                    });


                    while (true)
                    {
                        Client.Receive(getByte, 0, getByte.Length, SocketFlags.None);
                        stringbyte = Encoding.UTF7.GetString(getByte);
                        if (stringbyte != String.Empty)
                        {
                            int getValueLength = 0;
                            getValueLength = byteArrayDefrag(getByte);
                            stringbyte     = Encoding.UTF7.GetString(getByte, 0, getValueLength + 1);
                            string[] result = stringbyte.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]);
                            RightCharacter.Invoke((MethodInvoker) delegate()
                            {
                                RightCharacter.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;
                            });

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


                            #endregion

                            string sendData = LeftCharacter.Location.X + "$" + LeftCharacter.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;;
                            byte[] setsendData = Encoding.UTF7.GetBytes(sendData);
                            Client.Send(setsendData, 0, setsendData.Length, SocketFlags.None);
                        }
                        getByte = new byte[1024];
                        setByte = new byte[1024];
                    }
                }
            }
            catch (System.Net.Sockets.SocketException socketEx)
            {
                Console.WriteLine("[Error]:{0}", socketEx.Message);
            }
            catch (System.Exception commonEx)
            {
                Console.WriteLine("[Error]:{0}", commonEx.Message);
            }
            finally
            {
            }
        }