예제 #1
0
        public void invoke(TriggerRangeEvent eventArgs)
        {
            // empieza el dialogo!
            if (!activated)
            {
                activated = true;
                //Program.GAME.Camera.Focus = (IFocusable)yae;
                //Program.GAME.Camera.resetCameraPosition();
                // begin dialog! a los coñazos again
                string text = "Yae: $n "
                    + "Sabia que vendrias... Goemon... $0 "
                    + "Goemon:  $n "
                    + "Yae... Se que las cosas no terminaron bien entre nosotros pero... "
                    + " $1 "
                    + "Silencio!!! "
                    + " $2 Goemon: $n "
                    + "Como podemos arreglar esto? $e "
                    + "Yae: $n "
                    + "Solo se podra resolver con la muerte... $e "
                    + "Yae: $n "
                    + "Es hora de la batalla!!!!";

                // parametros!!!
                DialogParameters[] pars = new DialogParameters[5];
                pars[0] = new DialogParameters(false);
                pars[0].BlockSeconds = 4;
                pars[0].IsAutoNextAfterBlock = true;

                pars[1] = new DialogParameters(false);
                pars[1].Scale = 4;

                pars[2] = new DialogParameters(false);
                DialogManager.Instance.beginDialog(text, pars);
            }
        }
예제 #2
0
        private void setupDialogBox(string text, ref DialogParameters param)
        {
            // para saber cuanto tomara el texto
            Vector2 size = font.MeasureString(text);
            Rectangle safeArea = currentProvider.SafeArea;

            dialogRectangle.X = safeArea.X;
            dialogRectangle.Y = safeArea.Y;

            // ahora a ver si el cuadro de texto es grande o se adapta al texto
            if (param.IsAdaptToText)
            {
                // margen por 2 para que se aplique de los dos lados
                dialogRectangle.Width = (int)size.X + (param.HorizontalMargin * 2);
                dialogRectangle.Height = (int)size.Y + (param.VerticalMargin * 2);
            }
            else
            {
                dialogRectangle.Width = safeArea.Width;
                dialogRectangle.Height = (fontHeight * param.MaxLines) + (param.VerticalMargin * 2);
            }
        }
예제 #3
0
 private void nextFragment()
 {
     // si hay mas plabras entonces se reinicia el cuadro de dialogo
     //para mostrar lo que venga
     textToDraw.Remove(0, textToDraw.Length);
     isWaitingInput = false;
     currentLine = 1;
     currentLineWidth = 0;
     isFastForward = false;
     isWordTested = false;
     isWordCompleted = false;
     // reconfigurar if
     if (reconfig)
     {
         currentDialogParameter = dialogParameters[paramNumber];
         reconfigForParameter();
         reconfig = false;
     }
 }
예제 #4
0
        public override void Update(GameTime gameTime)
        {
            //Si se presiona A y no hay delay se genera el ataque
            if (InputManager.isNewPressKeyOrButton(Keys.Escape, Buttons.Back))
            {
                Program.GAME.Exit();
            }

            if (!owner.getState(EntityState.Dead)) //Si no está muerto
            {
                //Si se presiona A y no hay delay se genera el ataque
                if (InputManager.isNewPressKeyOrButton(Keys.A, Buttons.X) && !this.owner.getState(util.EntityState.Attacking))
                {
                    EventManager.Instance.fireEvent(PhysicalAttackEvent.Create(this.owner));
                }

                if (InputManager.isCurPressKeyOrButton(Keys.S, Buttons.Y))
                {
                    EventManager.Instance.fireEvent(MoveEvent.Create(this, MoveEvent.MOVE_TYPE.ACTION));
                }

                if (!this.owner.getState(util.EntityState.Attacking)) //Si no está atacando
                {
                    if (InputManager.isCurPressKeyOrButton(Keys.Right, Buttons.LeftThumbstickRight))
                    {
                        if (owner.getState(EntityState.IsAvailable))
                        {
                            owner.changeState(EntityState.FacingRight, true, true);
                        }
                        owner.changeIntProperty(EntityProperty.HorizontalDirection, 1, true);
                        EventManager.Instance.fireEvent(MoveEvent.Create(this, MoveEvent.MOVE_TYPE.WALK));
                        owner.changeState(EntityState.Running, true, true);
                    }
                    else if (InputManager.isCurPressKeyOrButton(Keys.Left, Buttons.LeftThumbstickLeft))
                    {
                        if (owner.getState(EntityState.IsAvailable))
                        {
                            owner.changeState(EntityState.FacingRight, false, true);
                        }

                        owner.changeIntProperty(EntityProperty.HorizontalDirection, -1, true);
                        EventManager.Instance.fireEvent(MoveEvent.Create(this, MoveEvent.MOVE_TYPE.WALK));
                        owner.changeState(EntityState.Running, true, true);
                    }
                }
            }

            if (InputManager.isNewPressKeyOrButton(Keys.Z, Buttons.A))
            {
                EventManager.Instance.fireEvent(MoveEvent.Create(this, MoveEvent.MOVE_TYPE.JUMP));
            }
            if (InputManager.isCurPressKeyOrButton(Keys.Up, Buttons.RightThumbstickUp))
            {
                Program.GAME.Camera.moveY(-10);
            }
            if (InputManager.isCurPressKeyOrButton(Keys.Down, Buttons.RightThumbstickDown))
            {
                Program.GAME.Camera.moveY(10);
            }
            if(InputManager.isCurPressKeyOrButton(Keys.NumPad8, Buttons.RightThumbstickRight))
            {
                Program.GAME.Camera.zoomIn();
            }
            if (InputManager.isCurPressKeyOrButton(Keys.NumPad2, Buttons.RightThumbstickLeft))
            {
                Program.GAME.Camera.zoomOut();
            }
            // ahora para que regrese al zoom normal
            if (InputManager.isOldPressKeyOrButton(Keys.NumPad8, Buttons.RightThumbstickUp) || InputManager.isOldPressKeyOrButton(Keys.NumPad2, Buttons.RightThumbstickDown))
            {
                Program.GAME.Camera.resetZoom();
            }

            if(InputManager.isNewPress(Keys.D)){
                DialogParameters[] pars = new DialogParameters[5];
                pars[0] = new DialogParameters(false);
                pars[0].VerticalAlign = GameConstants.VerticalAlign.VerticalCenter;
                pars[0].HorizontalAlign = GameConstants.HorizontalAlign.Right;
                //pars[0].IsAdaptToText = true;
                pars[1] = new DialogParameters(false);

                //
                pars[2] = new DialogParameters(false);
                pars[2].VerticalAlign = GameConstants.VerticalAlign.FreeY;
                pars[2].HorizontalAlign = GameConstants.HorizontalAlign.FreeX;
                pars[2].IsAdaptToText = true;
                pars[2].FreeX = 130;
                pars[2].FreeY = 205;
                // bloqueo por 5 segundos
                pars[3] = new DialogParameters(false);
                pars[3].BlockSeconds = 3;
                // bloquea y continua automaticamente
                pars[4] = new DialogParameters(false);
                pars[4].VerticalAlign = GameConstants.VerticalAlign.VerticalCenter;
                pars[4].HorizontalAlign = GameConstants.HorizontalAlign.HorizontalCenter;
                pars[4].IsAdaptToText = true;
                pars[4].BlockSeconds = 2;
                pars[4].IsAutoNextAfterBlock = true;
                //pars[4].CustomAssetName = "teststage/goemonAvatar";
                pars[4].AvatarPixelsToShow = 160;
                DialogManager.Instance.beginDialog("string[] words = text.Split(' '); $e StringBuilder sb = new StringBuilder();  $0 float linewidth = 0f;  float maxLine = 250f;  //a bit smaller than the box so you can have some padding...etc $2 float spaceWidth = spriteFont.MeasureString().X; foreach (string word in words) Vector2 $3 size = spriteFont.MeasureString(word) if (linewidth + size.X < 250)   {     sb.Append(word);   linewidth += size.X + spaceWidth;   }    else   {     sb.Append( + word + ); $4    linewidth = size.X + spaceWidth;  } } return sb.ToString();", pars);
            }
        }
예제 #5
0
 public void beginDialog(string text, DialogParameters[] dialog)
 {
     this.dialogParameters = dialog;
     this.currentDialogParameter = new DialogParameters(false);// temporal!!!!!!!!
     reconfigForParameter();
     this.dialogText = Regex.Replace(text, @"\s+", " ");
     // separ por palabras y placeholders
     this.words = dialogText.Split(' ');
     // reset de indexes
     this.currentLineWidth = 0;
     this.currentWordIndex = 0;
     this.currentChar = 0;
     this.isWordTested = false;
     this.currentLine = 1;
     this.isReadyToMove = true;
     this.isFastForward = false;
     this.maxLines = currentDialogParameter.MaxLines;
     DialogRenderer.Instance.CurrentDialogProvider = this;
     ControlManager.Instance.addController(this);
 }