本文整理汇总了C#中CelestialBody.is_leaf方法的典型用法代码示例。如果您正苦于以下问题:C# CelestialBody.is_leaf方法的具体用法?C# CelestialBody.is_leaf怎么用?C# CelestialBody.is_leaf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CelestialBody
的用法示例。
在下文中一共展示了CelestialBody.is_leaf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderSubtree
private void RenderSubtree(CelestialBody celestial, int depth) {
// Horizontal offset between a node and its children.
const int offset = 20;
UnityEngine.GUILayout.BeginHorizontal();
if (!celestial.is_root()) {
UnityEngine.GUILayout.Label(
"",
UnityEngine.GUILayout.Width(offset * (depth - 1)));
string button_text;
if (celestial.is_leaf()) {
button_text = "";
} else if (expanded_[celestial]) {
button_text = "-";
} else {
button_text = "+";
}
if (UnityEngine.GUILayout.Button(button_text,
UnityEngine.GUILayout.Width(offset))) {
Shrink();
expanded_[celestial] = !expanded_[celestial];
}
}
if (UnityEngine.GUILayout.Toggle(selected_celestial_ == celestial,
celestial.name)) {
if (selected_celestial_ != celestial) {
selected_celestial_ = celestial;
on_change_(FrameParameters());
}
}
UnityEngine.GUILayout.EndHorizontal();
if (celestial.is_root() || (!celestial.is_leaf() && expanded_[celestial])) {
foreach (CelestialBody child in celestial.orbitingBodies) {
RenderSubtree(child, depth + 1);
}
}
}