亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? castleinfinity.java

?? good project for programmer,,
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
////////////////////////CastleInfinity Lux Map Generator//Generates maps for Lux in the style of Castle Lux SI//Greg McGlynn//////////////////////package org.mcglynns.lux;import com.sillysoft.lux.*;import java.util.*;import java.io.*;import java.awt.*;import java.awt.geom.*;import java.awt.image.*;import javax.imageio.*;public class CastleInfinity implements LuxMapGenerator, ImageObserver {  //used in making names  static char[] consonants = new char[]{'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm',                                        'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'z'};  static char[] vowels = new char[]{'a', 'e', 'i', 'o', 'u'};  static int numConsonants = consonants.length;  static int numVowels = vowels.length;  Random rand;  int width, height;  //how big the hexagons are:  double hexRad = 32;  Vector countryPolygons;  Vector connections;  Polygon[][] castles;  Vector[][] castleConnections;  Polygon[] castleCenters;  Vector bridgePolygons;  Vector bridgeConnections;  Vector allPolygons;  int numCastles;  String[] castleNames;  String[] countrysideNames;  String choice;  int seed;  MapLoader m;  PrintWriter out;  //theme:  BufferedImage background;  BufferedImage foreground;  Graphics2D backG, foreG;  BufferedImage siForeground = null;  //get the foreground from Castle Lux SI, from which we get building images  private void loadSIForeground() {    try {      File support = new File(m.getMapGeneratorPath()).getParentFile();      String siForegroundPath = support.getPath() + File.separator + "Themes" + File.separator +                                "Castle Lux SI" + File.separator + "overground.png";      siForeground = ImageIO.read(new File(siForegroundPath));    } catch(Exception e) {      e.printStackTrace();    }  }  //Lux calls this when it needs a map, write out the xml and theme for a new map  public boolean generate(PrintWriter pw, String theChoice, int theSeed, MapLoader loader) {    m = loader;    out = pw;    choice = theChoice;    seed = theSeed;    if(siForeground == null) {      loadSIForeground();    }    rand = new Random(seed);    countryPolygons = new Vector();;    connections = new Vector();    bridgePolygons = new Vector();    bridgeConnections = new Vector();    allPolygons = new Vector();    if(choice == CHOICE_SMALL) {      width = 591;      height = 485;      numCastles = 4;    } else if(choice == CHOICE_NORMAL) {      width = 785;      height = 625;      numCastles = 6;    } else if(choice == CHOICE_BIG) {      width = 1062;      height = 765;      numCastles = 10;    }    castles = new Polygon[numCastles][4];    castleConnections = new Vector[numCastles][4];    castleNames = new String[numCastles];    countrysideNames = new String[numCastles];    //get new theme images    background = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);    foreground = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);    backG = (Graphics2D)background.getGraphics();    foreG = (Graphics2D)foreground.getGraphics();    backG.setRenderingHint(RenderingHints.KEY_ANTIALIASING,  RenderingHints.VALUE_ANTIALIAS_ON);    foreG.setRenderingHint(RenderingHints.KEY_ANTIALIASING,  RenderingHints.VALUE_ANTIALIAS_ON);    backG.setColor(new Color(0, 0, 173));    backG.fillRect(0, 0, width, height);    //create a map-spanning grid of hexagons    makeHexagonalGrid();    //chocse hexagons for castle locations    pickCastleCenters();    //name and create each castle    for(int i = 0; i < numCastles; i += 1) {      castleNames[i] = makeCastleName();      countrysideNames[i] = makeCountrysideName(castleNames[i].substring(0, castleNames[i].length() - 7));      makeCastleAround(castleCenters[i], i);    }    //make borders between countryside continents    makeCountrysideBorders();    //bring all polygons into one vector so we know ids.    allPolygons = new Vector();    for(int i = 0; i < countryPolygons.size(); i += 1) {      allPolygons.add(countryPolygons.get(i));    }    for(int i = 0; i < numCastles; i += 1) {      for(int j = 0; j < 4; j += 1) {        allPolygons.add(castles[i][j]);      }    }    for(int i = 0; i < bridgePolygons.size(); i += 1) {      allPolygons.add(bridgePolygons.get(i));    }    //now we have all the data we need to write the xml file    //write the header...    out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +              "<luxboard>\n" +              "<version>1.0</version>\n" +              "<width>" + width + "</width>\n" +              "<height>" + height + "</height>\n" +              "<theme>" + choice+seed + "</theme>\n" +              "<author>CastleInfinity Generator (by Greg McGlynn)</author>\n" +              "<email>greg@mcglynns.org</email>\n" +              "<webpage>www.sillysoft.net</webpage>\n" +              "<title>" + choice + " #" + seed + "</title>\n" +              "<description>This map was made by the CastleInfinity LuxMapGenerator. Type: " + choice + "seed: " + seed + "</description>\n");    writeHexagons(); //the countryside    writeCastles(); //the castles    writeBridges(); //the bridges    out.write("</luxboard>"); //done the xml    out.flush();    //create and write out the theme    doTheme();    return true;  }  //make a grid of hexagons that spans the map. the grid needs to be flush with the sides of the map  private void makeHexagonalGrid() {    //make the hexagons...    for(double x = hexRad; x <= width-hexRad; x += Math.sqrt(3)*hexRad) {      for(double y = hexRad-hexRad/3; y <= height-hexRad+hexRad/3; y += hexRad*3) {        countryPolygons.add(hexagonAround(new Point((int)x, (int)y)));      }    }    for(double x = hexRad+Math.sqrt(3)/2*hexRad; x <= width-hexRad; x += Math.sqrt(3)*hexRad) {      for(double y = 5*hexRad/2-hexRad/3; y <= height-hexRad+hexRad/3; y += hexRad*3) {        countryPolygons.add(hexagonAround(new Point((int)x, (int)y)));      }    }    //connect the ones that touch    for(int i = 0; i < countryPolygons.size(); i += 1) {      connections.add(new Vector());      for(int j = 0; j < countryPolygons.size(); j += 1) {        if(i != j && dist(polygonCenter((Polygon)countryPolygons.get(i)),                          polygonCenter((Polygon)countryPolygons.get(j))) < hexRad*1.9) {          ((Vector)connections.get(i)).add((Polygon)countryPolygons.get(j));        }      }    }    //make hexagons flush with sides of map    for(int h = 0; h < countryPolygons.size(); h += 1) {      Polygon p = (Polygon)countryPolygons.get(h);      Point center = polygonCenter(p);      if(center.x > hexRad*Math.sqrt(3)*2/3 && center.x < hexRad*Math.sqrt(3)*4/3) { //left        p.xpoints = new int[8];        p.ypoints = new int[8];        p.npoints = 8;        for(int i = 0; i < 3; i += 1) {          p.xpoints[i] = center.x + (int)((hexRad-1)*Math.cos(Math.PI/6 + i*Math.PI/3));          p.ypoints[i] = center.y + (int)((hexRad-1)*Math.sin(Math.PI/6 + i*Math.PI/3));        }        p.xpoints[3] = 5;        p.ypoints[3] = p.ypoints[1];        for(int i = 3; i < 6; i += 1) {          p.xpoints[i+2] = center.x + (int)((hexRad-1)*Math.cos(Math.PI/6 + i*Math.PI/3));          p.ypoints[i+2] = center.y + (int)((hexRad-1)*Math.sin(Math.PI/6 + i*Math.PI/3));        }        p.xpoints[4] = 5;        p.ypoints[4] = p.ypoints[6];      }      if(center.x > width - (hexRad*Math.sqrt(3)*4/3) && center.x < width - (hexRad*Math.sqrt(3)*2/3)) { //right        p.xpoints = new int[8];        p.ypoints = new int[8];        p.npoints = 8;        for(int i = 0; i < 6; i += 1) {          p.xpoints[i] = center.x + (int)((hexRad-1)*Math.cos(Math.PI/6 + i*Math.PI/3));          p.ypoints[i] = center.y + (int)((hexRad-1)*Math.sin(Math.PI/6 + i*Math.PI/3));        }        p.xpoints[6] = width-7;        p.ypoints[6] = p.ypoints[4];        p.xpoints[7] = width-7;        p.ypoints[7] = p.ypoints[1];      }      if(center.y < hexRad*1.5) { //bottom        for(int j = 0; j < p.npoints; j += 1) {           if(p.ypoints[j] < center.y) {             p.ypoints[j] = 0;           }        }      }      if(center.y > height - hexRad*1.5) { //top        for(int j = 0; j < p.npoints; j += 1) {          if(p.ypoints[j] > center.y) {            p.ypoints[j]  = height;          }        }      }    }  }  //pick <numCastles> hexagons to be the centers of castles.   //castles must be a certain distance from the side of the map and from each other  private void pickCastleCenters() {    Polygon ret[] = new Polygon[numCastles];    loop1:    while(true) {      loop2:      for(int i = 0; i < numCastles; i += 1) {        loop3:        for(int j = 0; j < 15; j += 1) {          int index;          while(!canBeCastleCenter(index = rand.nextInt(countryPolygons.size())));          ret[i] = (Polygon)countryPolygons.get(index);          for(int k = 0; k < i; k += 1) {            if(dist(polygonCenter(ret[i]), polygonCenter(ret[k])) < 240) {              continue loop3;            }          }          continue loop2;        }        continue loop1;      }      break;    }    for(int i = 0; i < numCastles; i += 1) {      removeHexagon(ret[i]);    }    castleCenters = ret;  }  static final int cOR = 45; //castleOutRadius  static final int cIR = 30; //castleInRadius  static final double[] castleAngles = new double[]{0, Math.PI/4, Math.PI/2, Math.PI/2, Math.PI/4, 0};  static final double[] castleRadii = new double[]{cOR-2, Math.sqrt(2)*(cOR-2), cOR-2, cIR, Math.sqrt(2)*cIR, cIR};  //make the polygons and connections of a castle centered on Polygon p  private void makeCastleAround(Polygon p, int castleIndex) {    Point c = polygonCenter(p);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜婷婷国产麻豆精品| 欧美午夜精品一区| 972aa.com艺术欧美| 在线精品亚洲一区二区不卡| 欧美久久一二三四区| 欧美一区二区三区视频在线| 久久综合九色综合欧美98| 国产精品日日摸夜夜摸av| 亚洲男人都懂的| 日本中文字幕不卡| 国产精品一区二区免费不卡| 91美女片黄在线观看91美女| 91精品国产全国免费观看| 久久久影视传媒| 亚洲二区视频在线| 国产在线精品免费| 在线视频国内一区二区| 欧美大胆人体bbbb| 亚洲精品第1页| 国产日韩欧美在线一区| 国精品**一区二区三区在线蜜桃| 亚洲综合小说图片| 亚洲免费在线播放| 韩国成人精品a∨在线观看| 91亚洲精品久久久蜜桃| 51精品视频一区二区三区| 国产视频一区在线观看| 亚洲国产精品久久久男人的天堂| 韩国v欧美v亚洲v日本v| 欧美在线观看视频一区二区三区| 久久蜜桃一区二区| 亚洲国产日日夜夜| 高清不卡一区二区在线| 6080午夜不卡| 成人免费一区二区三区视频| 看电视剧不卡顿的网站| 色网综合在线观看| 欧美精品一区二区三区视频| 亚洲成a天堂v人片| a在线欧美一区| 亚洲精品一区二区三区蜜桃下载 | 亚洲风情在线资源站| 国产盗摄视频一区二区三区| 欧美精品日韩精品| 亚洲欧美成人一区二区三区| 日本特黄久久久高潮| 91啪九色porn原创视频在线观看| 26uuu国产在线精品一区二区| 亚洲综合激情网| 成人av在线一区二区| 欧美成人一区二区三区片免费| 一区二区三区蜜桃| 972aa.com艺术欧美| 久久免费视频一区| 看国产成人h片视频| 欧美精品日韩一区| 亚洲大型综合色站| 99免费精品在线| 国产精品视频一区二区三区不卡| 九九九精品视频| 91精品国产综合久久国产大片 | 色综合视频在线观看| 国产日韩欧美亚洲| 精品国免费一区二区三区| 高清在线成人网| 国精产品一区一区三区mba桃花| 欧美极品aⅴ影院| 成人黄色小视频| 亚洲最大成人网4388xx| 蜜桃视频一区二区| 欧美视频完全免费看| 亚洲靠逼com| 99久久99久久精品免费观看| 久久久国产精品不卡| 精品系列免费在线观看| 91精品国产综合久久香蕉麻豆| 亚洲一二三四区不卡| 欧美综合久久久| 亚洲一区二区三区不卡国产欧美| 国产成人高清视频| 久久综合色婷婷| 国内一区二区在线| 久久青草欧美一区二区三区| 国产精品资源在线看| 精品99999| 国产精品一区二区三区网站| 久久精品亚洲一区二区三区浴池| 国产美女视频一区| 欧美一激情一区二区三区| 欧美日韩精品二区第二页| av在线不卡免费看| 91天堂素人约啪| 久久99精品久久久| 亚洲私人黄色宅男| 久久女同精品一区二区| 欧美人伦禁忌dvd放荡欲情| 久99久精品视频免费观看| 中文字幕亚洲一区二区va在线| 日韩一区二区三区观看| 一本久道久久综合中文字幕| 国产精品996| 色综合久久中文综合久久97| 夜夜嗨av一区二区三区| 在线观看国产日韩| 蜜桃视频在线一区| 91精品国产一区二区三区香蕉| 美女国产一区二区三区| 国产人妖乱国产精品人妖| 99国产麻豆精品| 久久99精品久久久久久动态图| 久久久99精品免费观看| 91麻豆国产精品久久| 亚洲在线视频网站| 日韩精品中午字幕| jvid福利写真一区二区三区| 樱花影视一区二区| 欧美不卡一区二区三区四区| 丁香婷婷深情五月亚洲| 玉足女爽爽91| 日韩欧美久久一区| 美女视频第一区二区三区免费观看网站| 麻豆成人av在线| 欧洲一区二区av| 天天综合色天天| 国产精品欧美经典| 欧美日韩一区二区三区不卡| 精彩视频一区二区三区| 亚洲视频小说图片| 欧美一区二区三区在线看| 粉嫩一区二区三区性色av| 午夜精品久久久久久久蜜桃app| 日韩欧美国产三级| 99在线精品免费| 麻豆精品久久精品色综合| 18欧美亚洲精品| 91精品国产综合久久久蜜臀图片| 成人av在线影院| 亚洲在线中文字幕| 91黄色免费网站| 狠狠色狠狠色综合系列| 亚洲线精品一区二区三区| 久久精品夜色噜噜亚洲a∨| 欧美日韩一区二区欧美激情| 男女男精品网站| 亚洲黄色av一区| 日本一区二区三区久久久久久久久不 | 欧美tk丨vk视频| 国产精品亚洲专一区二区三区| 欧美日韩二区三区| 亚洲特黄一级片| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 国产高清不卡一区二区| 亚洲猫色日本管| 国产日韩欧美高清| 91精品国产综合久久精品图片| 91免费国产视频网站| 成人午夜私人影院| 精品无人码麻豆乱码1区2区| 天天操天天色综合| 亚洲激情欧美激情| 国产精品视频一区二区三区不卡| 欧美精品一区二区三| 91精品免费观看| 欧美日韩一区二区三区在线 | 最新国产の精品合集bt伙计| 欧美精品一区男女天堂| 91精品国产综合久久精品app | 国产日韩欧美a| 欧美mv和日韩mv国产网站| 91精品国产综合久久小美女 | 捆绑调教一区二区三区| 亚洲欧美偷拍卡通变态| 国产女主播一区| 久久久不卡网国产精品二区| 337p粉嫩大胆噜噜噜噜噜91av| 日韩一区二区中文字幕| 911国产精品| 91精品国产综合久久久久久漫画| 欧美日韩精品一二三区| 欧美综合视频在线观看| 在线精品国精品国产尤物884a| 97久久超碰国产精品| 欧美精品99久久久**| 欧美色精品天天在线观看视频| 在线视频亚洲一区| 色94色欧美sute亚洲13| 色综合久久综合| 顶级嫩模精品视频在线看| 床上的激情91.| 国产传媒一区在线| 国产精品88888| 成人av网站免费观看| 99久久伊人网影院| 91原创在线视频| 91豆麻精品91久久久久久| 精品视频在线视频| 欧美精品在线一区二区| 欧美一区二区三区在线电影| 日韩免费在线观看| 久久嫩草精品久久久久|