把好友放进云界面主菜单
云界面的主菜单 plugins/CloudUI/screens/main.yml 有一格「公告」默认没有用途,把它改成「好友」。
第 1 步:改按钮的动作
找到 notice: 这一段,把 click 改成打开好友画面:
notice:
type: button
image: main/tile_s.png
hover: main/tile_s_hover.png
x: 1512
y: 347
hit: [1516, 351, 156, 103]
click:
left: ['open: starfriend']
motion: {x: 160, delay: 1}
starfriend 是好友画面的 ID。
第 2 步:改格子上的字
同一个文件里 notice-tag、notice-name、notice-desc 三段的 text 改成:
notice-tag:
text: 'F R I E N D'
notice-name:
text: '好 友'
notice-desc:
text: '%starfriend_online% 位好友在线'
只改 text 这一行,其他的键保持原样。%starfriend_online% 需要 PlaceholderAPI。
第 3 步:加未读红点
照着 mail-badge、mail-count 复制两段,放在 notice-desc 后面:
notice-badge:
type: image
image: main/mail_badge.png
state: '%starfriend_has_unread%'
states: {'false': ''}
x: 1652
y: 327
motion: {x: 160, delay: 1}
notice-count:
type: text
text: '%starfriend_unread_badge%'
font: text
size: 16
color: '#FFFFFF'
align: center
x: 1672
y: 340
motion: {x: 160, delay: 1}
没有未读时红点和数字都不显示。
第 4 步:重载并测试
/cui reload
打开主菜单,那一格变成「好友」,点一下打开好友画面。让别的账号给你留一条言,红点就出现。
会踩的坑
你的主菜单改过位置时,notice 的 x、y 可能不一样。红点的位置是格子的 x 加 140、y 减 20,数字是 x 加 160、y 减 7,照你的格子算。
%starfriend_has_unread% 只看留言。想让好友申请也算进数字,把 notice-count 的文字换成 %starfriend_notice_badge%(未读加申请),红点图片仍然只在有未读留言时出现。