MCBBS Wiki欢迎您共同参与编辑!在参与编辑之前请先阅读Wiki方针

如果在编辑的过程中遇到了什么问题,可以去讨论板提问。

为了您能够无阻碍地参与编辑 未验证/绑定过邮箱的用户,请尽快绑定/验证

MCBBS Wiki GitHub群组已上线!

您可以在回声洞中发表吐槽!

服务器状态监控。点击进入

本站由MCBBS用户自行搭建,与MCBBS及东银河系漫游指南(北京)科技有限公司没有从属关系。点此了解 MCBBS Wiki 不是什么>>

FancyMenu Wiki/自定义Visibility Requirements:修订间差异

跳到导航 跳到搜索
第45行: 第45行:
}
}
</syntaxhighlight>
</syntaxhighlight>
isRequirementMet()
==== isRequirementMet() ====
这是你的 Requirements 的最重要的方法。
这是你的 Requirements 的最重要的方法。
这里用于返回是否满足在此要求中检查的条件。
这里用于返回是否满足在此要求中检查的条件。
这个方法以 Requirements 的值为参数,但因为这个 Requirements 没有值,所以参数为空。
这个方法以 Requirements 的值为参数,但因为这个 Requirements 没有值,所以参数为空。
<syntaxhighlight lang="java">
//Here you return if the requirement is met (using the given requirement value if the requirement has one).
//Here you return if the requirement is met (using the given requirement value if the requirement has one).
//在这里返回是否满足 Requirements (如果 Requirements 有值则返回 Requirements 的值)
//在这里返回是否满足 Requirements (如果 Requirements 有值则返回 Requirements 的值)
第61行: 第64行:


}
}
复制代码
</syntaxhighlight>
==== getDisplayName() ====
这个方法返回 Requirements 的显示名。


getDisplayName()
这个方法返回 Requirements 的显示名。
这个显示名会在布局编辑器的Visibility Requirements选项显示。
这个显示名会在布局编辑器的Visibility Requirements选项显示。
<syntaxhighlight lang="java">
//This is the display name of the requirement.
//This is the display name of the requirement.
//这个是 Requirements 的显示名。
//这个是 Requirements 的显示名。
第74行: 第78行:
     return "Example Requirement [No Value]";
     return "Example Requirement [No Value]";
}
}
复制代码
</syntaxhighlight>
==== getDescription() ====
返回 Requirements 的描述。


getDescription()
返回 Requirements 的描述。
当把鼠标悬停在切换 Requirements 按钮上时,该描述会作为工具提示显示。
当把鼠标悬停在切换 Requirements 按钮上时,该描述会作为工具提示显示。
<syntaxhighlight lang="java">
//This is the description of the requirement.
//This is the description of the requirement.
//这里是 Requirements 的描述
//这里是 Requirements 的描述
第89行: 第94行:
     return l;
     return l;
}
}
复制代码
</syntaxhighlight>
==== getValueDisplayName() ====
这个方法返回值的显示名。


getValueDisplayName()
这个方法返回值的显示名。
因为咱的 Requirements 不用值,返回空即可。
因为咱的 Requirements 不用值,返回空即可。
<syntaxhighlight lang="java">
//Since this requirement has no value, just return NULL here.
//Since this requirement has no value, just return NULL here.
//因为 Requirements 没有值,只需要在这里返回null。
//因为 Requirements 没有值,只需要在这里返回null。
第100行: 第106行:
     return null;
     return null;
}
}
复制代码
</syntaxhighlight>
==== getValuePreset() ====
返回自动设置到值输入文本字段的内容。


getValuePreset()
这个 Requirements 没有值输入字段,所以我们返回<code>null</code>。
返回自动设置到值输入文本字段的内容。
<syntaxhighlight lang="java">
这个 Requirements 没有值输入字段,所以我们返回null。
//No value, so just return NULL.
//No value, so just return NULL.
//没有值,返回null。
//没有值,返回null。
第111行: 第118行:
     return null;
     return null;
}
}
复制代码
</syntaxhighlight>
==== getValueInputFieldFilter() ====
该方法返回一个字符过滤器,该过滤器用来检查用户可以在数值输入文本字段中允许输入的字符。


getValueInputFieldFilter()
没值,回null。
该方法返回一个字符过滤器,该过滤器用来检查用户可以在数值输入文本字段中允许输入的字符。
<syntaxhighlight lang="java">
妹纸,回null。
//You know the drill. No value = return NULL.
//You know the drill. No value = return NULL.
//没值 = 返回null(毁灭吧,我累了 *发动地鸣)
//没值 = 返回null(毁灭吧,我累了 *发动地鸣)
第122行: 第130行:
     return null;
     return null;
}
}
2.2.9. Full Example Class
</syntaxhighlight>
This is a full working VisibilityRequirement example.
==== 完整示例 ====
这个是完整的VisibilityRequirement样例。
这个是完整的VisibilityRequirement样例。
<syntaxhighlight lang="java">
package de.keksuccino.fancymenu.api.visibilityrequirements.example;
package de.keksuccino.fancymenu.api.visibilityrequirements.example;


第205行: 第214行:


}
}
复制代码
</syntaxhighlight>
==== 注册Visibility Requirement ====
到这你几乎完成了。(译者:我也是 *冰箱里拿一瓶啤酒)


注册Visibility Requirement
现在你只需要在游戏加载时将你的<code>VisibilityRequirement</code>注册到<code>VisibilityRequirementRegistry</code>。
到这你几乎完成了。(译者:我也是 *冰箱里拿一瓶啤酒)
<syntaxhighlight lang="java">
现在你只需要在游戏加载时将你的VisibilityRequirement注册到VisibilityRequirementRegistry。
package de.keksuccino.fancymenu;
package de.keksuccino.fancymenu;


第231行: 第241行:


}
}
复制代码
</syntaxhighlight>


=== 创建带值的Requirement ===
=== 创建带值的Requirement ===
维护员、​界面管理员、​巡查员、​监督员、​小部件编辑者
3,469

个编辑

我们提供服务需要使用Cookie。您使用我们的服务,即表示您同意我们使用Cookie。

导航菜单