package com.usc.option;
import java.awt.Dimension;
import java.awt.Toolkit;
import com.usc.base.Bgm.BaseBgm;
import com.usc.base.JFrame.BaseWindow;
/**
* @author 作者:Sky_in_night
* @date 创建时间:2018年2月15日 下午6:29:44
* @ProjectName 项目名称:HappyNewYear
* @FileName 文件名称:com.usc.option.OptionClass.java
*
*/
public class OptionClass {
// 获得桌面的大小
private static Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
// 获得桌面宽度
private static int width = (int) screensize.getWidth();
// 获得桌面高度
private static int height = (int) screensize.getHeight();
// 尾部提名
private static String Name = "――刘可舟";
// 背景音乐地址
private static String bgm = "data/bgm/001.wav";
// 音乐总时长
private static int allTime = 34000;
// 每一个文字窗体的大小
private static final int WIINDOSIZE = 60;
/**
* 用来显示文本的函数
*
* @param coluns
* 每一行的字数
* @param content
* 要显示的文本
*/
public static void showText(String content) {
// 用来减少字体显示所需要拖慢进程的时间
int instanceTime = (content.length() + Name.length()) / 3;
// 每个字间隔显示的时间
int time = allTime / (content.length() + Name.length()) - instanceTime;
// 判断是否参数非法
time = time > 0 ? time : 1;
// 每行文字的个数
int coluns = width / 60;
// 换行的次数
int swap = 0;
// 总共的行数
int rows = content.length() / coluns + (content.length() % coluns >= 1 ? 1 : 0);
// 初始的横坐标
int initX = width / 2 - coluns * WIINDOSIZE / 2;
// 初始的纵坐标
int initY = height / 2 - rows * WIINDOSIZE / 2;
// 播放背景音乐
new Thread() {
public void run() {
BaseBgm.PlayStart(bgm);
System.exit(0);
};
}.start();
// 输出文本内容
for (int i = 0; i < content.length(); i++) {
new BaseWindow(WIINDOSIZE, WIINDOSIZE, initX + (i % coluns) * WIINDOSIZE, initY + swap * WIINDOSIZE,
content.substring(i, i + 1), i * time);
if ((i + 1) % coluns == 0)
swap++;
}
// 输出提名
for (int i = 0; i < Name.length(); i++) {
new BaseWindow(WIINDOSIZE, WIINDOSIZE, initX + (coluns - Name.length() + i) * WIINDOSIZE,
initY + rows * WIINDOSIZE, Name.substring(i, i + 1), (i + content.length()) * time);
}
}
}
最近下载更多
阿远远 LV8
2019年12月12日
simple丶余心 LV21
2019年10月30日
dengss LV11
2019年5月10日
ZKsrw丶 LV4
2018年10月28日
caiyingwenwang LV18
2018年8月16日
陌上花开AAA LV4
2018年7月11日
Dvvvv123qwe LV6
2018年7月3日
hongdalao LV1
2018年5月4日
1165343269 LV1
2018年4月21日
yangbiao LV5
2018年4月13日

最近浏览