Newer
Older
CactusServer / src / main / java / fight3D / Ranking2Container.java
y-ota on 10 May 2018 3 KB 初うp
  1. package fight3D;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Font;
  5. import java.awt.GraphicsConfiguration;
  6.  
  7. import framework.RWT.RWTContainer;
  8. import framework.RWT.RWTLabel;
  9. import framework.RWT.RWTLine;
  10. import framework.RWT.RWTVirtualController;
  11. import framework.RWT.RWTVirtualKey;
  12.  
  13.  
  14. public class Ranking2Container extends RWTContainer {
  15. private static final long serialVersionUID = 7397968207139488409L;
  16. private Game game;
  17. public Ranking2Container(Game g) {
  18. game = g;
  19. }
  20. public void build(GraphicsConfiguration gc) {
  21. // 初期化
  22. removeAll();
  23. int character[] = game.getCharacter();
  24. int rank[] = game.getRank();
  25. int tp[] = game.getTp();
  26. int Defeat[] = game.getDefeat();
  27. int Defeated[] = game.getDefeated();
  28. RWTLabel laa = new RWTLabel();
  29. laa.setRelativePosition(0.5f,0.1f,RWTLabel.DRAW_CENTER);
  30. laa.setString("゚*☆結果発表~~詳細~~☆*゚");
  31. laa.setColor(Color.PINK);
  32. Font fa = new Font("",Font.PLAIN,35);
  33. laa.setFont(fa);
  34. addWidget(laa);
  35.  
  36. RWTLine liw1 = new RWTLine();
  37. liw1.setRelativePosition(0.09f, 0.18f, 0.91f, 0.18f);
  38. liw1.setColor(Color.CYAN);
  39. addWidget(liw1);
  40.  
  41. drawRow(0.25f, "【順位】", "【名前】", "【詳細】");
  42. //1位表示
  43. int i;
  44. for(i=0 ; i<rank.length; i++) {
  45. if(rank[i]==1) break;
  46. }
  47. drawRow(0.35f, "☆1位☆",
  48. CharacterManager.getInstance().getCharacter(character[i]).getName(),
  49. "[TP:"+String.valueOf(tp[i])+"] [倒した数:"+String.valueOf(Defeat[i])+"] [倒された数:"+String.valueOf(Defeated[i])+"]");
  50.  
  51. //2位表示
  52. for(i=0 ; i<rank.length; i++) {
  53. if(rank[i]==2) break;
  54. }
  55. drawRow(0.45f, "*2位*",
  56. CharacterManager.getInstance().getCharacter(character[i]).getName(),
  57. "[TP:"+String.valueOf(tp[i])+"] [倒した数:"+String.valueOf(Defeat[i])+"] [倒された数:"+String.valueOf(Defeated[i])+"]");
  58. RWTLabel lab = new RWTLabel();
  59. lab.setRelativePosition(0.93f,0.98f,RWTLabel.DRAW_CENTER);
  60. lab.setString("【OK】");
  61. lab.setColor(Color.RED);
  62. Font fb = new Font("",Font.PLAIN,30);
  63. lab.setFont(fb);
  64. addWidget(lab);
  65. repaint();
  66. }
  67. public void keyPressed(RWTVirtualKey k){
  68. }
  69. public void keyReleased(RWTVirtualKey k){
  70. if(k.getVirtualKey() == RWTVirtualController.BUTTON_A){
  71. game.goNextGameState();
  72. }
  73. }
  74. public void keyTyped(RWTVirtualKey k){
  75. }
  76.  
  77. private void drawRow(float hight, String rank, String name, String data) {
  78. RWTLabel la1 = new RWTLabel();
  79. la1.setRelativePosition(0.17f,hight,RWTLabel.DRAW_CENTER);
  80. la1.setString(rank);
  81. la1.setColor(Color.WHITE);
  82. Font f1 = new Font("",Font.PLAIN,13);
  83. la1.setFont(f1);
  84. addWidget(la1);
  85. RWTLabel la2 = new RWTLabel();
  86. la2.setRelativePosition(0.35f,hight,RWTLabel.DRAW_CENTER);
  87. la2.setString(name);
  88. la2.setColor(Color.WHITE);
  89. la2.setFont(f1);
  90. addWidget(la2);
  91. RWTLabel la3 = new RWTLabel();
  92. la3.setRelativePosition(0.48f,hight);
  93. la3.setString(data);
  94. la3.setColor(Color.WHITE);
  95. // Font f3 = new Font("",Font.PLAIN,13);
  96. la3.setFont(f1);
  97. addWidget(la3);
  98. //横線
  99. RWTLine liw = new RWTLine();
  100. liw.setRelativePosition(0.09f, hight+0.03f, 0.91f, hight+0.03f);
  101. liw.setColor(Color.CYAN);
  102. addWidget(liw);
  103. //縦線
  104. RWTLine lih1 = new RWTLine();
  105. lih1.setRelativePosition(0.09f, hight-0.07f, 0.09f, hight+0.03f);
  106. lih1.setColor(Color.YELLOW);
  107. addWidget(lih1);
  108. RWTLine lih2 = new RWTLine();
  109. lih2.setRelativePosition(0.24f, hight-0.07f, 0.24f, hight+0.03f);
  110. lih2.setColor(Color.YELLOW);
  111. addWidget(lih2);
  112. RWTLine lih3 = new RWTLine();
  113. lih3.setRelativePosition(0.46f, hight-0.07f, 0.46f, hight+0.03f);
  114. lih3.setColor(Color.YELLOW);
  115. addWidget(lih3);
  116. RWTLine lih4 = new RWTLine();
  117. lih4.setRelativePosition(0.91f, hight-0.07f, 0.91f, hight+0.03f);
  118. lih4.setColor(Color.YELLOW);
  119. addWidget(lih4);
  120.  
  121. }
  122. }