Ejemplo n.º 1
0
    public static UGUIProcessor CreateProcessor(CodeStrategy strategy, CodeStrategy rootStrategy = null)
    {
        var processor = new UGUIProcessor();

        processor.Strategy     = strategy;
        processor.RootStrategy = rootStrategy;
        return(processor);
    }
Ejemplo n.º 2
0
    public bool SingleProcess(Transform transform, string orderStr, GenClassInfo classInfo)
    {
        CodeStrategy strategy = null;

        if (classInfo == rootClassInfo)
        {
            strategy = RootStrategy;
        }
        else
        {
            strategy = Strategy;
        }

        var typeStrs = GetTypeStrs(transform.gameObject.name);
        var order    = TransformRecurser.GetOrder(orderStr);

        if (typeStrs == null)
        {
            return(true);
        }

        bool continueRecurse = true;

        foreach (var typeStr in typeStrs)
        {
            var type = GetNodeType(typeStr);
            if (type == null)
            {
                throw new Exception("检查程序出错");
            }

            var data = CreateProcessData(classInfo, transform);
            data.NodeTypeStr   = typeStr;
            data.Nodetype      = type;
            data.Orders        = order;
            data.ComponentName = type.FullName;

            Debug.Log(data.ComponentName);

            strategy.Process(data);
        }

        return(continueRecurse);
    }