コード例 #1
0
ファイル: Button_g.cs プロジェクト: gaozhou/Delight
        public Button(View parent, View layoutParent = null, string id = null, Template template = null, bool deferInitialization = false) :
            base(parent, layoutParent, id, template ?? ButtonTemplates.Default, deferInitialization)
        {
            if (deferInitialization)
            {
                return;
            }

            // constructing Label (Label)
            Label = new Label(this, this, "Label", LabelTemplate);

            // binding <Label Offset="{TextOffset}">
            Bindings.Add(new Binding(new List <BindingPath> {
                new BindingPath(new List <string> {
                    "TextOffset"
                }, new List <Func <object> > {
                    () => this
                })
            }, new BindingPath(new List <string> {
                "Label", "Offset"
            }, new List <Func <object> > {
                () => this, () => Label
            }), () => Label.Offset = TextOffset, () => { }, false));

            // binding <Label IsActive="{DisplayLabel}">
            Bindings.Add(new Binding(new List <BindingPath> {
                new BindingPath(new List <string> {
                    "DisplayLabel"
                }, new List <Func <object> > {
                    () => this
                })
            }, new BindingPath(new List <string> {
                "Label", "IsActive"
            }, new List <Func <object> > {
                () => this, () => Label
            }), () => Label.IsActive = DisplayLabel, () => { }, false));
            this.StateAnimations.Clear();
            var stateAnimation0 = new StateAnimation(AnyStateName, "Highlighted");

            stateAnimation0.Add(new Animator <UnityEngine.Color>(this, 0.05f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.BackgroundColor = x, () => this.BackgroundColor, () => Button.BackgroundColorProperty.NotifyPropertyChanged(this), Button.BackgroundColorProperty, AnyStateName, "Highlighted"));
            stateAnimation0.Add(new Animator <UnityEngine.Color>(this, 0.05f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.FontColor       = x, () => this.FontColor, () => Button.FontColorProperty.NotifyPropertyChanged(this), Button.FontColorProperty, AnyStateName, "Highlighted"));
            this.StateAnimations.Add(stateAnimation0);
            var stateAnimation1 = new StateAnimation("Highlighted", DefaultStateName);

            stateAnimation1.Add(new Animator <UnityEngine.Color>(this, 0.5f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.BackgroundColor = x, () => this.BackgroundColor, () => Button.BackgroundColorProperty.NotifyPropertyChanged(this), Button.BackgroundColorProperty, "Highlighted", DefaultStateName));
            stateAnimation1.Add(new Animator <UnityEngine.Color>(this, 0.5f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.FontColor       = x, () => this.FontColor, () => Button.FontColorProperty.NotifyPropertyChanged(this), Button.FontColorProperty, "Highlighted", DefaultStateName));
            this.StateAnimations.Add(stateAnimation1);
            Click.RegisterHandler(this, "ButtonMouseClick");
            MouseEnter.RegisterHandler(this, "ButtonMouseEnter");
            MouseExit.RegisterHandler(this, "ButtonMouseExit");
            MouseDown.RegisterHandler(this, "ButtonMouseDown");
            MouseUp.RegisterHandler(this, "ButtonMouseUp");
            this.AfterInitializeInternal();
        }
コード例 #2
0
        public NavigatorExample(View parent, View layoutParent = null, string id = null, Template template = null, bool deferInitialization = false) :
            base(parent, layoutParent, id, template ?? NavigatorExampleTemplates.Default, deferInitialization)
        {
            if (deferInitialization)
            {
                return;
            }

            // constructing Navigator (Navigator1)
            Navigator1 = new Navigator(this, this, "Navigator1", Navigator1Template);
            Region1    = new Region(this, Navigator1.Content, "Region1", Region1Template);
            Navigator1.Path.SetValue(Region1, "/");
            Region1.StateAnimations.Clear();
            var region1StateAnimation1 = new StateAnimation("Closed", DefaultStateName);

            region1StateAnimation1.Add(new Animator <Delight.ElementMargin>(Region1, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.ElementMarginValueConverter.Interpolator, x => Region1.Offset = x, () => Region1.Offset, () => Region.OffsetProperty.NotifyPropertyChanged(Region1), Region.OffsetProperty, "Closed", DefaultStateName));
            region1StateAnimation1.Add(new Animator <UnityEngine.Vector3>(Region1, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.Vector3ValueConverter.Interpolator, x => Region1.Scale          = x, () => Region1.Scale, () => Region.ScaleProperty.NotifyPropertyChanged(Region1), Region.ScaleProperty, "Closed", DefaultStateName));
            Region1.StateAnimations.Add(region1StateAnimation1);
            var region1StateAnimation2 = new StateAnimation(DefaultStateName, "Pushed");

            region1StateAnimation2.Add(new Animator <Delight.ElementMargin>(Region1, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.ElementMarginValueConverter.Interpolator, x => Region1.Offset = x, () => Region1.Offset, () => Region.OffsetProperty.NotifyPropertyChanged(Region1), Region.OffsetProperty, DefaultStateName, "Pushed"));
            region1StateAnimation2.Add(new Animator <UnityEngine.Vector3>(Region1, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.Vector3ValueConverter.Interpolator, x => Region1.Scale          = x, () => Region1.Scale, () => Region.ScaleProperty.NotifyPropertyChanged(Region1), Region.ScaleProperty, DefaultStateName, "Pushed"));
            Region1.StateAnimations.Add(region1StateAnimation2);
            var region1StateAnimation3 = new StateAnimation("Pushed", DefaultStateName);

            region1StateAnimation3.Add(new Animator <Delight.ElementMargin>(Region1, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.ElementMarginValueConverter.Interpolator, x => Region1.Offset = x, () => Region1.Offset, () => Region.OffsetProperty.NotifyPropertyChanged(Region1), Region.OffsetProperty, "Pushed", DefaultStateName));
            region1StateAnimation3.Add(new Animator <UnityEngine.Vector3>(Region1, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.Vector3ValueConverter.Interpolator, x => Region1.Scale          = x, () => Region1.Scale, () => Region.ScaleProperty.NotifyPropertyChanged(Region1), Region.ScaleProperty, "Pushed", DefaultStateName));
            Region1.StateAnimations.Add(region1StateAnimation3);
            var region1StateAnimation4 = new StateAnimation(DefaultStateName, "Closed");

            region1StateAnimation4.Add(new Animator <Delight.ElementMargin>(Region1, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.ElementMarginValueConverter.Interpolator, x => Region1.Offset = x, () => Region1.Offset, () => Region.OffsetProperty.NotifyPropertyChanged(Region1), Region.OffsetProperty, DefaultStateName, "Closed"));
            region1StateAnimation4.Add(new Animator <UnityEngine.Vector3>(Region1, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.Vector3ValueConverter.Interpolator, x => Region1.Scale          = x, () => Region1.Scale, () => Region.ScaleProperty.NotifyPropertyChanged(Region1), Region.ScaleProperty, DefaultStateName, "Closed"));
            Region1.StateAnimations.Add(region1StateAnimation4);
            Label1  = new Label(this, Region1.Content, "Label1", Label1Template);
            Region2 = new Region(this, Navigator1.Content, "Region2", Region2Template);
            Navigator1.Path.SetValue(Region2, "/test");
            Region2.StateAnimations.Clear();
            var region2StateAnimation1 = new StateAnimation("Closed", DefaultStateName);

            region2StateAnimation1.Add(new Animator <Delight.ElementMargin>(Region2, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.ElementMarginValueConverter.Interpolator, x => Region2.Offset = x, () => Region2.Offset, () => Region.OffsetProperty.NotifyPropertyChanged(Region2), Region.OffsetProperty, "Closed", DefaultStateName));
            region2StateAnimation1.Add(new Animator <UnityEngine.Vector3>(Region2, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.Vector3ValueConverter.Interpolator, x => Region2.Scale          = x, () => Region2.Scale, () => Region.ScaleProperty.NotifyPropertyChanged(Region2), Region.ScaleProperty, "Closed", DefaultStateName));
            Region2.StateAnimations.Add(region2StateAnimation1);
            var region2StateAnimation2 = new StateAnimation(DefaultStateName, "Pushed");

            region2StateAnimation2.Add(new Animator <Delight.ElementMargin>(Region2, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.ElementMarginValueConverter.Interpolator, x => Region2.Offset = x, () => Region2.Offset, () => Region.OffsetProperty.NotifyPropertyChanged(Region2), Region.OffsetProperty, DefaultStateName, "Pushed"));
            region2StateAnimation2.Add(new Animator <UnityEngine.Vector3>(Region2, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.Vector3ValueConverter.Interpolator, x => Region2.Scale          = x, () => Region2.Scale, () => Region.ScaleProperty.NotifyPropertyChanged(Region2), Region.ScaleProperty, DefaultStateName, "Pushed"));
            Region2.StateAnimations.Add(region2StateAnimation2);
            var region2StateAnimation3 = new StateAnimation("Pushed", DefaultStateName);

            region2StateAnimation3.Add(new Animator <Delight.ElementMargin>(Region2, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.ElementMarginValueConverter.Interpolator, x => Region2.Offset = x, () => Region2.Offset, () => Region.OffsetProperty.NotifyPropertyChanged(Region2), Region.OffsetProperty, "Pushed", DefaultStateName));
            region2StateAnimation3.Add(new Animator <UnityEngine.Vector3>(Region2, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.Vector3ValueConverter.Interpolator, x => Region2.Scale          = x, () => Region2.Scale, () => Region.ScaleProperty.NotifyPropertyChanged(Region2), Region.ScaleProperty, "Pushed", DefaultStateName));
            Region2.StateAnimations.Add(region2StateAnimation3);
            var region2StateAnimation4 = new StateAnimation(DefaultStateName, "Closed");

            region2StateAnimation4.Add(new Animator <Delight.ElementMargin>(Region2, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.ElementMarginValueConverter.Interpolator, x => Region2.Offset = x, () => Region2.Offset, () => Region.OffsetProperty.NotifyPropertyChanged(Region2), Region.OffsetProperty, DefaultStateName, "Closed"));
            region2StateAnimation4.Add(new Animator <UnityEngine.Vector3>(Region2, 0.85f, 0f, false, false, 0f, false, EasingFunctions.Get("QuadraticEaseOut"), Delight.Vector3ValueConverter.Interpolator, x => Region2.Scale          = x, () => Region2.Scale, () => Region.ScaleProperty.NotifyPropertyChanged(Region2), Region.ScaleProperty, DefaultStateName, "Closed"));
            Region2.StateAnimations.Add(region2StateAnimation4);
            Label2 = new Label(this, Region2.Content, "Label2", Label2Template);

            // constructing Group (Group1)
            Group1  = new Group(this, this, "Group1", Group1Template);
            Button1 = new Button(this, Group1.Content, "Button1", Button1Template);
            Button1.Click.RegisterHandler(this, "OpenRoot");
            Button2 = new Button(this, Group1.Content, "Button2", Button2Template);
            Button2.Click.RegisterHandler(this, "OpenTest");
            Button3 = new Button(this, Group1.Content, "Button3", Button3Template);
            Button3.Click.RegisterHandler(this, "Pop");
            this.AfterInitializeInternal();
        }