Skip to content

Commit

Permalink
实现选择生涯背景
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuangxiongBubu authored and chenshuangxiongBubu committed May 10, 2024
1 parent 0644e2f commit b98dbf4
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/main/java/yalong/site/ClientStarter.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public void loadFrameData() {
for (ChampionBO bo : AppCache.allChampion) {
FrameInnerCache.pickBox.addItem(new ItemBO(String.valueOf(bo.getId()), bo.getName()));
FrameInnerCache.banBox.addItem(new ItemBO(String.valueOf(bo.getId()), bo.getName()));
FrameInnerCache.careerBackgroundBox.addItem(new ItemBO(String.valueOf(bo.getId()), bo.getName()));
}
log.info("添加到面板下拉框完成");
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/yalong/site/cache/FrameCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public class FrameCache {

public static Integer banChampionId = null;

public static Integer careerChampionId = null;

public static Integer careerSkinChampionId = null;

public static boolean sendScore = true;

public static boolean communicate = true;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/yalong/site/cache/FrameInnerCache.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package yalong.site.cache;

import yalong.site.frame.panel.client.BanBox;
import yalong.site.frame.panel.client.PickBox;
import yalong.site.frame.panel.client.PickSkinBox;
import yalong.site.frame.panel.client.*;
import yalong.site.frame.panel.result.ResultTextPane;

/**
Expand All @@ -14,6 +12,8 @@ public class FrameInnerCache {
public static BanBox banBox;
public static PickBox pickBox;
public static PickSkinBox pickSkinBox;
public static CareerBackgroundBox careerBackgroundBox;
public static CareerBackgroundSkinBox careerBackgroundSkinBox;
public static ResultTextPane resultTextPane;

}
4 changes: 4 additions & 0 deletions src/main/java/yalong/site/frame/panel/client/ClientPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public static ClientPanel builder() {
clientPanel.add(pickBox.getComp(), pickBox.getConstraints());
ComponentBO pickSkinBox = PickSkinBox.builder();
clientPanel.add(pickSkinBox.getComp(), pickSkinBox.getConstraints());
ComponentBO careerBox = CareerBackgroundBox.builder();
clientPanel.add(careerBox.getComp(), careerBox.getConstraints());
ComponentBO careerSkinBox = CareerBackgroundSkinBox.builder();
clientPanel.add(careerSkinBox.getComp(), careerSkinBox.getConstraints());
return clientPanel;

}
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/yalong/site/services/lcu/LinkLeagueClientApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,24 @@ public List<SkinBO> getChromasSkinByChampionId(int championId) throws IOExceptio
return arrayList.stream().distinct().collect(Collectors.toList());
}

/**
* 获取某个英雄的所有皮肤id名字
*
* @param championId 英雄id
*/
public List<SkinBO> getSkinByChampionId(int championId) throws IOException {
String resp = requestLcuUtil.doGet("/lol-game-data/assets/v1/champions/" + championId + ".json");
ArrayList<SkinBO> arrayList = new ArrayList<>();
JSONArray skins = JSON.parseObject(resp).getJSONArray("skins");
for (int i = 0; i < skins.size(); i++) {
JSONObject jsonObject = skins.getJSONObject(i);
Integer id = jsonObject.getInteger("id");
String name = jsonObject.getString("name");
arrayList.add(new SkinBO(id, name));
}
return arrayList.stream().distinct().collect(Collectors.toList());
}

/**
* 查询当前选定的英雄所有可用的炫彩皮肤
*/
Expand Down

0 comments on commit b98dbf4

Please sign in to comment.