Skip to content

Commit

Permalink
Merge pull request #27 from bysxx/feature/HelpPage
Browse files Browse the repository at this point in the history
Feature/help page
  • Loading branch information
tjdvlf2880 authored Nov 26, 2023
2 parents d54a31a + 926c440 commit ec91d04
Show file tree
Hide file tree
Showing 14 changed files with 1,196 additions and 91 deletions.
809 changes: 809 additions & 0 deletions log

Large diffs are not rendered by default.

Empty file added log.lck
Empty file.
Binary file added res/Img/HardModeScreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/Img/MagazineDisplay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/Img/PlayScreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/Img/Reload.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions res/Resource
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"MoveSpeed" : "Sakuya.png",
"ShotSpeed" : "Sakuya.png"
},
"GuideImplements":{
"PlayScreen" : "PlayScreen.png",
"HardMode" : "HardModeScreen.png",
"RemaningMagazine" : "MagazineDisplay.png"
},

"BGM" : {
"MenuPage" : "B_Main_a.wav",
Expand Down
12 changes: 6 additions & 6 deletions src/EnginePrime/GameManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ public final class GameManager implements GManager {

public static Frame frame = null;
public static boolean running = true;
public static EngineTimer Et = EngineTimer.getInstance();
public static RenderManager Rm = RenderManager.getInstance();
public static InputManager Im = InputManager.getInstance();
public static SoundManager Sm = SoundManager.getInstance();
public final static EngineTimer Et = EngineTimer.getInstance();
public final static RenderManager Rm = RenderManager.getInstance();
public final static InputManager Im = InputManager.getInstance();
public final static SoundManager Sm = SoundManager.getInstance();
public static GameManager instance = null;
public static GManager CustomInstance = null;

public static boolean InstanceChanged = false;
public static Map<String, JSONObject> GlobalData = new HashMap<>();
public static ArrayList<Runnable> ExitCode = new ArrayList<>();
public final static Map<String, JSONObject> GlobalData = new HashMap<>();
public final static ArrayList<Runnable> ExitCode = new ArrayList<>();

private GameManager() {
};
Expand Down
1 change: 1 addition & 0 deletions src/GamePrime/Entry.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public void Initialize(){
JSONObject res = FileManager.LoadJsonObject("Resource");
gm.GlobalData.put("Resource", res);
Font font = gm.Rm.LoadFont("Font" + File.separator +res.get("Font"));
gm.Rm.CreateFont(font, "Small", 12.0f);
gm.Rm.CreateFont(font, "Regular", 14.0f);
gm.Rm.CreateFont(font, "Big", 24.0f);
GameManager.getInstance().SetInstance(new LoginPage());
Expand Down
11 changes: 10 additions & 1 deletion src/GamePrime/Page/EndPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class EndPage implements GManager{
JSONObject res = gm.GlobalData.get("Resource");
JSONObject PlayData;
SoundManager.PlayProp menuSoundProp;

public void Initialize(){
SelectIndex = 0;
PlayData = (JSONObject)gm.GlobalData.get("LocalData").get("PlayData");
Expand Down Expand Up @@ -139,6 +140,10 @@ public void drawCenteredBigString(final String string,final int height) {

public void drawClear() {
String titleString ;
int score = ((Number) PlayData.get("Point")).intValue();
int shot = ((Number) PlayData.get("ShotCount")).intValue() + ((Number) PlayData.get("ShotCount2")).intValue() ;
int shipsDestroyed = ((Number) PlayData.get("KillCount")).intValue() + ((Number) PlayData.get("KillCount2")).intValue();
double accuracy = ((double) shipsDestroyed / (double) shot) * 100;
if((boolean)PlayData.get("LevelClear")){
titleString = "LEVEL " + ((Number) PlayData.get("Level")).intValue() + " Clear";
}else{
Expand All @@ -148,7 +153,11 @@ public void drawClear() {
Graphics grpahics = gm.Rm.GetCurrentGraphic();
FontMetrics fontmatrix = gm.Rm.SetFont("Big");
grpahics.setColor(Color.GREEN);
drawCenteredBigString(titleString, gm.frame.getHeight() / 3 + fontmatrix.getHeight() * 2);
drawCenteredBigString(titleString, gm.frame.getHeight() / 6 + fontmatrix.getHeight() * 2);
drawCenteredRegularString("Your score: " + score, gm.frame.getHeight() / 3 + fontmatrix.getHeight() * 1);
drawCenteredRegularString("Your total shots: " + shot, gm.frame.getHeight() / 3 + fontmatrix.getHeight() * 2);
drawCenteredRegularString("Your destruction: " + shipsDestroyed, gm.frame.getHeight() / 3 + fontmatrix.getHeight() * 3);
drawCenteredRegularString("Your Accuracy " + (Math.round(accuracy*10) / 10.0) +"%", gm.frame.getHeight() / 3 + fontmatrix.getHeight() * 4);

String continueString = "Continue";
String exitString = "Exit";
Expand Down
135 changes: 71 additions & 64 deletions src/GamePrime/Page/GamePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,51 +199,51 @@ public void LateUpdate() {
};

private void drawHorizontalLine(int y) {
Graphics grpahics = gm.Rm.GetCurrentGraphic();
grpahics.drawLine(0, y, gm.frame.getWidth(), y);
grpahics.drawLine(0, y + 1, gm.frame.getWidth(), y + 1);
Graphics graphics = gm.Rm.GetCurrentGraphic();
graphics.drawLine(0, y, gm.frame.getWidth(), y);
graphics.drawLine(0, y + 1, gm.frame.getWidth(), y + 1);
}

private void DrawMenual() {
Graphics grpahics = gm.Rm.GetCurrentGraphic();
Graphics graphics = gm.Rm.GetCurrentGraphic();
int rectWidth = gm.frame.getWidth();
int rectHeight = gm.frame.getHeight() / 6;
grpahics.setColor(Color.BLACK);
grpahics.fillRect(0, gm.frame.getHeight() / 2 - gm.frame.getHeight() / 12 - 90,
graphics.setColor(Color.BLACK);
graphics.fillRect(0, gm.frame.getHeight() / 2 - gm.frame.getHeight() / 12 - 90,
rectWidth, rectHeight + 180);
grpahics.setColor(Color.CYAN);
graphics.setColor(Color.CYAN);
drawManualMenu();
drawHorizontalLine(gm.frame.getHeight() / 2 - gm.frame.getHeight() / 12 - 90);
drawHorizontalLine(gm.frame.getHeight() / 2 - gm.frame.getHeight() / 12 - 50);
drawHorizontalLine(gm.frame.getHeight() / 2 + gm.frame.getHeight() / 12 + 90);
}

private void drawManualMenu() {
Graphics grpahics = gm.Rm.GetCurrentGraphic();
Graphics graphics = gm.Rm.GetCurrentGraphic();
FontMetrics fontmatrix = gm.Rm.SetFont("Regular");
JSONArray key1 = (JSONArray) gm.GlobalData.get("Setting").get("KeySetting_1p");
JSONArray key2 = (JSONArray) gm.GlobalData.get("Setting").get("KeySetting_2p");

grpahics.drawString("Play manual", gm.frame.getWidth() / 2
graphics.drawString("Play manual", gm.frame.getWidth() / 2
- fontmatrix.stringWidth("Play manual") / 2, gm.frame.getHeight() / 2 - 105);
grpahics.drawString("Player1", gm.frame.getWidth() / 2 - 140, gm.frame.getHeight() / 2 - 60);
grpahics.drawString("Player2", gm.frame.getWidth() / 2 + 65, gm.frame.getHeight() / 2 - 60);
graphics.drawString("Player1", gm.frame.getWidth() / 2 - 140, gm.frame.getHeight() / 2 - 60);
graphics.drawString("Player2", gm.frame.getWidth() / 2 + 65, gm.frame.getHeight() / 2 - 60);

grpahics.setColor(Color.WHITE);
graphics.setColor(Color.WHITE);
int y = gm.frame.getHeight() / 2 - 30;
int x1 = gm.frame.getWidth() / 2 - 150; // player1_manual
int x2 = gm.frame.getWidth() / 2 - 50; // player1_setting
int x3 = gm.frame.getWidth() / 2 + 50; // player2
int x4 = gm.frame.getWidth() / 2 + 150; // player2_setting
for (int i = 0; i < KeyDefine.KeyFunc.length; i++) {
grpahics.drawString(KeyDefine.KeyFunc[i], x1 - fontmatrix.stringWidth(KeyDefine.KeyFunc[i]) / 2,
graphics.drawString(KeyDefine.KeyFunc[i], x1 - fontmatrix.stringWidth(KeyDefine.KeyFunc[i]) / 2,
y + 20 * i);
String key = KeyEvent.getKeyText(((Number) key1.get(i)).intValue());
grpahics.drawString(key, x2 - fontmatrix.stringWidth(key) / 2, y + 20 * i);
grpahics.drawString(KeyDefine.KeyFunc[i], x3 - fontmatrix.stringWidth(KeyDefine.KeyFunc[i]) / 2,
graphics.drawString(key, x2 - fontmatrix.stringWidth(key) / 2, y + 20 * i);
graphics.drawString(KeyDefine.KeyFunc[i], x3 - fontmatrix.stringWidth(KeyDefine.KeyFunc[i]) / 2,
y + 20 * i);
key = KeyEvent.getKeyText(((Number) key2.get(i)).intValue());
grpahics.drawString(key, x4 - fontmatrix.stringWidth(key) / 2, y + 20 * i);
graphics.drawString(key, x4 - fontmatrix.stringWidth(key) / 2, y + 20 * i);
}
}

Expand All @@ -257,21 +257,7 @@ private void Draw() {
} else if (((Number) PlayData.get("ScreenIndex")).intValue() == 1) {
DrawMenual();
} else if (((Number) PlayData.get("ScreenIndex")).intValue() == 2) {

Graphics grpahics = gm.Rm.GetCurrentGraphic();
int rectWidth = gm.frame.getWidth();
int rectHeight = gm.frame.getHeight() / 6;
grpahics.setColor(Color.BLACK);
grpahics.fillRect(0, gm.frame.getHeight() / 2 - gm.frame.getHeight() / 12 - 40, rectWidth, rectHeight + 40);

grpahics.setColor(Color.YELLOW);
FontMetrics fontmatrix = gm.Rm.SetFont("Regular");
grpahics.drawString("Quit", gm.frame.getWidth() / 2 - fontmatrix.stringWidth("Quit") / 2,
gm.frame.getHeight() / 2 - 10);

drawHorizontalLine(gm.frame.getHeight() / 2 - gm.frame.getHeight() / 12 - 40);
drawHorizontalLine(gm.frame.getHeight() / 2 - gm.frame.getHeight() / 12);
drawHorizontalLine(gm.frame.getHeight() / 2 + gm.frame.getHeight() / 12);
drawPause();
}
}

Expand All @@ -280,7 +266,7 @@ public void PreRender() {

public void LateRender() {
Draw();
DrawScore();
drawScore();
drawItems();

drawAmmo();
Expand All @@ -290,87 +276,108 @@ public void LateRender() {
};

void drawAmmo() {
Graphics grpahics = gm.Rm.GetCurrentGraphic();
grpahics.setColor(Color.WHITE);
Graphics graphics = gm.Rm.GetCurrentGraphic();
graphics.setColor(Color.WHITE);
FontMetrics fontmatrix = gm.Rm.SetFont("Regular");
if (HardMode) {
int bullet = ((Number) PlayData.get("Bullet1")).intValue();
int magazine = ((Number) PlayData.get("Magazine1")).intValue();
grpahics.drawString("Ammo : ", 200, 0);
grpahics.drawString(bullet + "/" + magazine, 300, fontmatrix.getHeight());
graphics.drawString("Ammo : ", 200, 0);
graphics.drawString(bullet + "/" + magazine, 300, fontmatrix.getHeight());

if (PlayMode == 1) {
bullet = ((Number) PlayData.get("Bullet2")).intValue();
magazine = ((Number) PlayData.get("Magazine2")).intValue();
grpahics.drawString("Ammo : ",
graphics.drawString("Ammo : ",
gm.frame.getWidth() / 4 - fontmatrix.stringWidth(bullet + "/" + magazine + "Ammo : "), 0);
grpahics.drawString(bullet + "/" + magazine, gm.frame.getWidth() / 4, fontmatrix.getHeight());
graphics.drawString(bullet + "/" + magazine, gm.frame.getWidth() / 4, fontmatrix.getHeight());
}

}
}

void drawItems() {
Graphics grpahics = gm.Rm.GetCurrentGraphic();
grpahics.setColor(Color.WHITE);
Graphics graphics = gm.Rm.GetCurrentGraphic();
graphics.setColor(Color.WHITE);
JSONArray item = (JSONArray) PlayData.get("ActiveItem");
grpahics.drawString(Integer.toString(item.size()), 205, gm.frame.getHeight() + 25);
graphics.drawString(Integer.toString(item.size()), 205, gm.frame.getHeight() + 25);
for (int i = 0; i < item.size(); i++) {
int index = ((Number) item.get(i)).intValue();
if (ItemDefine.ActiveItem[index] == "Ghost") {
grpahics.setColor(Color.CYAN);
graphics.setColor(Color.CYAN);
} else if (ItemDefine.ActiveItem[index] == "Auxiliary") {
grpahics.setColor(Color.green);
graphics.setColor(Color.green);
} else if (ItemDefine.ActiveItem[index] == "Bomb") {
grpahics.setColor(Color.red);
graphics.setColor(Color.red);
} else if (ItemDefine.ActiveItem[index] == "SpeedUp") {
grpahics.setColor(Color.YELLOW);
graphics.setColor(Color.YELLOW);
}
grpahics.drawRect(100 + 35 * i, gm.frame.getHeight() - 10, 5, 5);
graphics.drawRect(100 + 35 * i, gm.frame.getHeight() - 10, 5, 5);
}

item = (JSONArray) PlayData.get("ActiveItem2");
grpahics.drawString(Integer.toString(item.size()), 205, gm.frame.getHeight() + 25);
graphics.drawString(Integer.toString(item.size()), 205, gm.frame.getHeight() + 25);
for (int i = 0; i < item.size(); i++) {
int index = ((Number) item.get(i)).intValue();
if (ItemDefine.ActiveItem[index] == "Ghost") {
grpahics.setColor(Color.CYAN);
graphics.setColor(Color.CYAN);
} else if (ItemDefine.ActiveItem[index] == "Auxiliary") {
grpahics.setColor(Color.green);
graphics.setColor(Color.green);
} else if (ItemDefine.ActiveItem[index] == "Bomb") {
grpahics.setColor(Color.red);
graphics.setColor(Color.red);
} else if (ItemDefine.ActiveItem[index] == "SpeedUp") {
grpahics.setColor(Color.YELLOW);
graphics.setColor(Color.YELLOW);
}
grpahics.drawRect(gm.frame.getWidth() / 2 + 100 + 35 * i, gm.frame.getHeight() - 10, 5, 5);
graphics.drawRect(gm.frame.getWidth() / 2 + 100 + 35 * i, gm.frame.getHeight() - 10, 5, 5);
}
}

void drawPause() {
Graphics graphics = gm.Rm.GetCurrentGraphic();
int rectWidth = gm.frame.getWidth();
int rectHeight = gm.frame.getHeight() / 6;
String informationString = "Press Esc resume or space quit";
graphics.setColor(Color.BLACK);
graphics.fillRect(0, gm.frame.getHeight() / 2 - gm.frame.getHeight() / 12 - 40, rectWidth, rectHeight + 40);
graphics.setColor(Color.YELLOW);
FontMetrics fontmatrix = gm.Rm.SetFont("Regular");
graphics.drawString("Pause", gm.frame.getWidth() / 2 - fontmatrix.stringWidth("Pause") / 2,
gm.frame.getHeight() / 2 - 80);
graphics.drawString("Quit", gm.frame.getWidth() / 2 - fontmatrix.stringWidth("Quit") / 2,
gm.frame.getHeight() / 2 - 10);
graphics.setColor(Color.GRAY);
graphics.drawString(informationString, gm.frame.getWidth() / 2
- fontmatrix.stringWidth(informationString) / 2, gm.frame.getHeight() / 2 + fontmatrix.getHeight() / 10 + 20);
drawHorizontalLine(gm.frame.getHeight() / 2 - gm.frame.getHeight() / 12 - 40);
drawHorizontalLine(gm.frame.getHeight() / 2 - gm.frame.getHeight() / 12);
drawHorizontalLine(gm.frame.getHeight() / 2 + gm.frame.getHeight() / 12);
}

public void drawHorizontalLine(final int positionY, Color color) {
Graphics grpahics = gm.Rm.GetCurrentGraphic();
grpahics.setColor(color);
grpahics.drawLine(0, positionY, gm.frame.getWidth(), positionY);
grpahics.drawLine(0, positionY + 1, gm.frame.getWidth(), positionY + 1);
Graphics graphics = gm.Rm.GetCurrentGraphic();
graphics.setColor(color);
graphics.drawLine(0, positionY, gm.frame.getWidth(), positionY);
graphics.drawLine(0, positionY + 1, gm.frame.getWidth(), positionY + 1);
}

void drawLives() {
Graphics grpahics = gm.Rm.GetCurrentGraphic();
grpahics.setColor(Color.WHITE);
Graphics graphics = gm.Rm.GetCurrentGraphic();
graphics.setColor(Color.WHITE);
FontMetrics fontmatrix = gm.Rm.SetFont("Regular");
grpahics.drawString(Integer.toString(((Number) PlayData.get("Life")).intValue()), 20, 25);
graphics.drawString(Integer.toString(((Number) PlayData.get("Life")).intValue()), 20, 25);
if (PlayMode == 1) {
grpahics.drawString(Integer.toString(((Number) PlayData.get("Life2")).intValue()), 50, 25);
graphics.drawString(Integer.toString(((Number) PlayData.get("Life2")).intValue()), 50, 25);
}
}

public void Exit() {
};

void DrawScore() {
Graphics grpahics = gm.Rm.GetCurrentGraphic();
grpahics.setColor(Color.WHITE);
void drawScore() {
Graphics graphics = gm.Rm.GetCurrentGraphic();
graphics.setColor(Color.WHITE);
FontMetrics fontmatrix = gm.Rm.SetFont("Regular");
String scoreString = String.format("%04d", ((Number) PlayData.get("Point")).intValue());
grpahics.drawString(scoreString, gm.frame.getWidth() - 60, 25);
graphics.drawString(scoreString, gm.frame.getWidth() - 60, 25);
}
}
Loading

0 comments on commit ec91d04

Please sign in to comment.