static void IterateDataContext(DataContext rootctx, Transform trans, ref List <DataContext> ctxList) { var childContext = trans.GetComponent <DataContext>(); if (childContext != null) { if (CheckDuplicateName(ctxList, childContext.Name)) { throw new Exception("重名" + childContext.Name); } if (childContext.Type == WidgetType.Unknown) { var path = ObjectUtility.GetGameObjectPath(childContext.gameObject, rootctx.gameObject); throw new Exception("类型未设置:" + path); } ctxList.Add(childContext); } foreach (Transform childTrans in trans) { IterateDataContext(rootctx, childTrans, ref ctxList); } }
public static void ShowPath( ) { foreach (Object obj in Selection.objects) { var go = obj as GameObject; if (go == null) { continue; } Debug.Log(ObjectUtility.GetGameObjectPath(go)); } }
public void PrintButtonClickImplementCode(CodeGenerator gen) { if (_binder.Type != CodeGenObjectType.GenAsButton) { return; } var path = ObjectUtility.GetGameObjectPath(_binder.gameObject, _window.Obj); gen.PrintLine("// Button @ ", path); gen.PrintLine("void ", ButtonCallbackName, "( )"); gen.PrintLine("{"); gen.PrintLine(); gen.PrintLine("}"); gen.PrintLine(); }
public static void FindWidgetlAssignToVar(CodeGenerator gen, DataContext rootContext, DataContext widgetContext) { var path = ObjectUtility.GetGameObjectPath(widgetContext.gameObject, rootContext.gameObject); gen.PrintLine(WidgetVariable(widgetContext), " = trans.Find(\"", path, "\").GetComponent<", WidgetTypeName(widgetContext), ">();"); }
public void PrintAttachCode(CodeGenerator gen) { var path = ObjectUtility.GetGameObjectPath(_binder.gameObject, _window.Obj); gen.PrintLine("_", Name, " = trans.Find(\"", path, "\").GetComponent<", GetVarType(), ">();"); }