示例#1
0
    private void FadeTransition(float v)
    {
        Color c = m_Img.color;

        c.a         = v;
        m_Img.color = c;
        OnColorChange.Invoke(c);
    }
        public static void Initialize()
        {
            var descriptors = new Dictionary <string, ResourceBindingParserHandler.ResourceDescriptor>();
            ICollection <KeyValuePair <string, ResourceBindingParserHandler.ResourceDescriptor> > collection = descriptors;

            collection.Add(CreateDescriptor(nameof(Color), (context, i) => new Color(ColorHandler?.Invoke(context, i) ?? context.GetColor(i))));
            collection.Add(CreateDescriptor(nameof(Drawable), null));
            collection.Add(CreateDescriptor(nameof(Dimen), (context, i) => context.Resources.GetDimension(i)));
            collection.Add(CreateDescriptor(nameof(Bool), (context, i) => context.Resources.GetBoolean(i)));
            collection.Add(CreateDescriptor(nameof(Id), (context, i) => i));
            collection.Add(CreateDescriptor(nameof(Integer), (context, i) => context.Resources.GetInteger(i)));
            collection.Add(CreateDescriptor(nameof(String), (context, i) => context.GetString(i)));
            var handler = new ResourceBindingParserHandler(descriptors);

            BindingServiceProvider.BindingProvider.Parser.Handlers.Add(handler);
        }