in Facebook.Unity/Codeless/CodelessCrawler.cs [145:199]
private static void GenChild (GameObject curObj, StringBuilder builder)
{
builder.AppendFormat (
@"{{""classname"":""{0}"",""childviews"":[",
curObj.name
);
int childCount = curObj.transform.childCount;
for (int i = 0; i < childCount; i++) {
if (null == curObj.GetComponent<Button> ()) {
GenChild (curObj.transform.GetChild (i).gameObject, builder);
builder.Append (",");
}
}
if (builder [builder.Length - 1] == ',') {
builder.Length--;
}
UnityEngine.Canvas canvasParent = curObj.GetComponentInParent<UnityEngine.Canvas> ();
string btntext = "";
if (null != curObj.GetComponent<Button> () && null != canvasParent) {
Rect rect = curObj.GetComponent<RectTransform> ().rect;
Vector2 position = getScreenCoordinate (curObj.transform.position, canvasParent.renderMode);
Text textComponent = curObj.GetComponent<Button> ().GetComponentInChildren<Text> ();
if (null != textComponent) {
btntext = "\"text\":\"" + textComponent.text + "\",";
}
builder.AppendFormat (
@"],{8}""classtypebitmask"":""{0}"",""tag"":""0"",""dimension"":{{""height"":{1},""width"":{2},""scrolly"":{3},""left"":{4},""top"":{5},""scrollx"":{6},""visibility"":{7}}}}}",
getClasstypeBitmaskButton (),
(int)rect.height,
(int)rect.width,
0,
(int)Math.Ceiling (position.x - (rect.width / 2)),//left
(int)Math.Ceiling ((Screen.height - position.y - (rect.height / 2))),
0,
getVisibility (curObj),
btntext
);
} else {
builder.AppendFormat (
@"],{8}""classtypebitmask"":""{0}"",""tag"":""0"",""dimension"":{{""height"":{1},""width"":{2},""scrolly"":{3},""left"":{4},""top"":{5},""scrollx"":{6},""visibility"":{7}}}}}",
getClasstypeBitmaskButton (),
0,
0,
0,
0,
0,
0,
getVisibility (curObj),
btntext
);
}
}