Skip to content

Commit 1d8d26a

Browse files
committed
test: 测试文件更新
1 parent acbd8c1 commit 1d8d26a

7 files changed

+2840
-321
lines changed

Diff for: Test/Todo.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
一、王者图鉴
2+
补全最新的皮肤
3+
更多的文字渐变,更多的边框渐变,更多的背景渐变,如道具背景,更多的阴影,更多的光晕,更多的切换动画
4+
5+
二、未来
6+
记得在可领取的地方加小红点,并且在顶部播放横幅,由于手机端顶部放不下,则需要折叠起来

Diff for: Test/index.html

+1-73
Original file line numberDiff line numberDiff line change
@@ -1,73 +1 @@
1-
<script>
2-
// 计算抽中新英雄的概率
3-
// 计算抽中新英雄的概率
4-
function calculateProbability(obtainedHeroesSize) {
5-
// 使用平方根函数调整概率增长曲线
6-
const factor = Math.sqrt(obtainedHeroesSize) / Math.sqrt(50);
7-
const probability = 0.01 + 0.49 * factor;
8-
return probability > 0.5 ? 0.5 : probability;
9-
}
10-
11-
// 抽奖函数,抽中后返回抽中英雄的ID
12-
function drawHero(allHeroes, obtainedHeroes) {
13-
// 转换obtainedHeroes为Set对象以优化搜索效率
14-
const obtainedHeroesSet = new Set(obtainedHeroes);
15-
16-
// 如果已经抽中所有英雄,返回null
17-
if (obtainedHeroesSet.size >= allHeroes.length) {
18-
return null;
19-
}
20-
21-
// 计算当前的抽奖概率
22-
const probability = calculateProbability(obtainedHeroesSet.size);
23-
const randomNumber = Math.random(); // 随机数在0到1之间
24-
let drawnHeroId;
25-
26-
if (randomNumber <= probability) {
27-
// 成功抽中新英雄的情况
28-
let newHeroPool = allHeroes.filter((heroId) => !obtainedHeroesSet.has(heroId));
29-
let randomIndex = Math.floor(Math.random() * newHeroPool.length);
30-
drawnHeroId = newHeroPool[randomIndex];
31-
} else {
32-
// 抽中已有英雄的情况
33-
let randomIndex = Math.floor(Math.random() * allHeroes.length);
34-
drawnHeroId = allHeroes[randomIndex];
35-
// 如果恰好抽中新英雄,则返回
36-
if (!obtainedHeroesSet.has(drawnHeroId)) {
37-
return drawnHeroId;
38-
}
39-
}
40-
41-
return drawnHeroId;
42-
}
43-
// 示例
44-
const allHeroes = [
45-
107, 109, 115, 120, 136, 146, 105, 110, 116, 127, 139, 148, 106, 112, 117, 133, 156, 108, 113,
46-
118, 129, 134, 150, 166, 111, 114, 119, 130, 135, 144, 152, 142, 128, 124, 168, 167, 121, 141,
47-
123, 154, 169, 171, 170, 153, 162, 131, 175, 173, 149, 157, 174, 140, 184, 126, 183, 132, 163,
48-
177, 178, 186, 180, 190, 192, 191, 187, 182, 189, 193, 196, 195, 194, 198, 179, 501, 199, 176,
49-
502, 197, 503, 504, 125, 510, 137, 509, 508, 312, 507, 513, 515, 511, 529, 505, 506, 522, 518,
50-
523, 525, 524, 531, 527, 533, 536, 528, 537, 155, 538, 540, 542, 534, 548, 521, 544, 545, 564,
51-
514, 159,
52-
];
53-
//额外道具
54-
const obtainedHeroes = localStorage.getItem("obtainedHeroes")
55-
? JSON.parse(localStorage.getItem("obtainedHeroes"))
56-
: [];
57-
58-
// 抽奖操作
59-
const newHeroId = drawHero(allHeroes, obtainedHeroes);
60-
if (newHeroId !== null) {
61-
if (obtainedHeroes.includes(newHeroId)) {
62-
console.warn("抽到相同的");
63-
} else {
64-
console.log("抽到了:", newHeroId);
65-
}
66-
obtainedHeroes.push(newHeroId); // 更新已抽中英雄列表
67-
localStorage.setItem("obtainedHeroes", JSON.stringify(obtainedHeroes));
68-
} else {
69-
console.error("抽完了");
70-
}
71-
72-
console.log(JSON.parse(JSON.stringify(obtainedHeroes, null, 2)));
73-
</script>
1+
<h1>独立开发者:</h1> <div class='content'> <a target='_blank' href='https://github.com/lengyibai'> <div class='user'> <img src='https://files.lyb.im/wzry-material/image/lyb.png' class='head-img' alt='' /> <div class='name'>冷弋白(lengyibai)</div> </div> </a> </div> <h1>Github仓库:</h1> <div class='content'> <p> <a target='_blank' href='https://github.com/lengyibai/wzry' class='link iconfont wzry-mark-github' ><span class='link__name'>王者图鉴</span></a > </p> </div> <h1>注意:</h1> <div class='content'> <p>请勿将项目内的游戏素材用于商业用途</p> <p>本站用户数据存在本地不与服务器交互</p> <p>对于开发者而言此项目仅供交流与学习</p> </div> <h1>友情赞助:</h1> <div class='content'> <a target='_blank' href='https://lucent.blog'> <div class='user'> <img src='https://files.lyb.im/wzry-material/image/ddm.png' class='head-img' alt='' /> <div class='name'>呆呆木(服务器及域名)</div> </div> </a> </div>

Diff for: Test/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const a = {
2+
a: 1,
3+
};
4+
5+
const b = (() => a)();
6+
7+
b.a = 2;
8+
9+
console.log(a);

Diff for: Test/useActivityDialog.ts

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { API_USER } from "@/api/modules/user";
2+
import { Util } from "@/utils";
3+
4+
const activity_list = {
5+
211: {
6+
key: "activity211Info",
7+
eventName: "sign-in",
8+
show() {
9+
Util.$Bus.emit("sign-in");
10+
},
11+
},
12+
212: {
13+
key: "activity212Info",
14+
eventName: "month-week-card",
15+
show() {
16+
Util.$Bus.emit("month-week-card");
17+
},
18+
},
19+
} as const;
20+
21+
/** 每个活动关闭时调用钩子,显示下一个活动 */
22+
let _resolve: (value: void) => void;
23+
24+
/** @description 非活动海报弹窗 */
25+
const useCustomActivity = () => {
26+
const simulateActivity = async (id: number, activityFn: () => Promise<any>) => {
27+
let status = false;
28+
const res = await activityFn();
29+
status = res.data.data[activity_list[id].key].status;
30+
if (status) {
31+
Util.$Bus.emit(activity_list[id].eventName);
32+
await new Promise((resolve) => (_resolve = resolve));
33+
}
34+
};
35+
const ExposeMethods = {
36+
/** @description 开始显示活动弹窗 */
37+
async runActivities() {
38+
await simulateActivity(211, API_USER.SignInInfo);
39+
await simulateActivity(212, API_USER.WeekMonthCardInfo);
40+
},
41+
42+
/** @description 活动被关闭时调用 */
43+
closeActivity() {
44+
_resolve?.();
45+
},
46+
47+
/** @description 退出登录是强制关闭活动 */
48+
closeAll() {
49+
_resolve?.();
50+
Util.$Bus.emit("close-all-activity");
51+
},
52+
};
53+
return { ...ExposeMethods };
54+
};
55+
export { useCustomActivity };

Diff for: Test/王者图鉴抽奖系统.md

-93
This file was deleted.

0 commit comments

Comments
 (0)