⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frase.java

📁 j2me游戏引擎
💻 JAVA
字号:
/*        
        GAEM - Graphical Adventure Engine for Mobiles (version 0.1)
        Copyright (C) 2005 Victor Borrull
        
        This file is part of GAEM.
        GAEM is free software; you can redistribute it and/or modify it under the terms
        of the GNU General Public License as published by the Free Software Foundation; either
        version 2 of the License, or (at your option) any later version.
        GAEM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
        without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
        See the GNU General Public License for more details.
        You should have received a copy of the GNU General Public License along with this program;
        if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

import javax.microedition.lcdui.game.*;
import java.util.*;
import javax.microedition.lcdui.Font;
/**     Clase encargada de gestionar el sistema de mensajes del juego.<br>
*       {@link #setFrase(String, int) setFrase(String, int)} recibe las frases a displayar.<br>
*       {@link #anima() anima()} se llama con el loop principal, comprueba si ha pasado el tiempo de espera y 
*       cambia a la siguiente frase.<br>
*       String [] textos es el buffer donde se guardan las frases, hasta 4...<br>
*       !A馻dido sistema de prioridades. Si la frase ke entra tiene mayor prioridad, vacia el bufer.
*/
public class Frase {
	private boolean added = false;
	private long tiempo1 = 0;		//1a captura de tiempo
	private long tiempo2 = 0;		//2a.
	private int espera=1000;			//tiempo en ms que tarda en desaparecer el texto
        /**     Buffer de frases.*/
        private String [] textos = new String[5];
        private int total = 0;
        /**     Texto a retornar.*/
        private String retorno = "";
        /**     Fuente*/
        private Font fuente;
        /**     Longitud horizontal de la pantalla.*/
        private int anchoPantalla = 0;
        /**     Prioridades de cada una de las frases en el array.*/
        private int [] prioridad = new int[5];
        /**     Prioridad de la frase.*/
        public int TOTAL = 5;
        /**     Prioridad de la frase.*/
        public int ALTA = 4;
        /**     Prioridad de la frase.*/
        public int MEDIA = 3;
        /**     Prioridad de la frase.*/
        public int BAJA = 2;
        /**     Prioridad de la frase.*/
        public int MINIMA = 1;
        /**     Frase de error de uso predefinida.*/
        private String noUsable = "Both objects cannot be used together.";
        /**     Constructor que obtiene el ancho de pantalla y la fuente a utilizar.
        *       @param ancho Anchura en pixels de la pantalla.
        *       @param f Fuente a utilizar.
        */
        public Frase(int ancho, Font f) {
                fuente = f;
                anchoPantalla = ancho;
        }
        /**     Inicializa el buffer de frases, el de prioridades y el numero total.*/
        public void inicializa() {
                textos = new String[5];
                prioridad = new int[5];
                total = 0;
	}
        /**     Va rompiendo la frase en una primera mitad que quepa en la pantalla, y llama a {@link #setFrase(String, int) setFrase(String, int)} pasando<br>
        *       la primera mitad como par醡etro. Y as

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -