Пример #1
0
        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);
            }
        }
Пример #2
0
    public static void ShowPath( )
    {
        foreach (Object obj in Selection.objects)
        {
            var go = obj as GameObject;
            if (go == null)
            {
                continue;
            }

            Debug.Log(ObjectUtility.GetGameObjectPath(go));
        }
    }
Пример #3
0
    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();
    }
Пример #4
0
        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), ">();");
        }
Пример #5
0
    public void PrintAttachCode(CodeGenerator gen)
    {
        var path = ObjectUtility.GetGameObjectPath(_binder.gameObject, _window.Obj);

        gen.PrintLine("_", Name, " = trans.Find(\"", path, "\").GetComponent<", GetVarType(), ">();");
    }