コード例 #1
0
        private static void BoxTypeOnChangeValue(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            if (e != null)
            {
                List <string> boxItems = new List <string>();
                CharacterView instance = source as CharacterView;
                String        boxType  = (string)e.NewValue;

                if (instance._actor != null &&
                    String.IsNullOrEmpty(boxType) == false &&
                    String.IsNullOrEmpty(instance.Animation) == false &&
                    String.IsNullOrEmpty(instance.Frame) == false)
                {
                    bool hasBoxType = Enum.TryParse(boxType.ToUpper().Replace("ATTACK", "HIT").Replace(" ", "_"), true, out instance._selectedBoxType);

                    if (hasBoxType)
                    {
                        for (int i = 0; i < instance._actor.GetCurrentBoxes(instance._selectedBoxType).Count; i++)
                        {
                            boxItems.Add(Convert.ToString(i + 1));
                        }
                    }
                }

                instance.BoxItems = boxItems;
            }
        }
コード例 #2
0
        private static void AnimationOnChangeValue(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            if (e != null)
            {
                CharacterView instance = source as CharacterView;
                instance._frameOffset  = new Position();
                instance._spriteOffset = new Position();
                instance._frames       = new List <string>();
                instance._shadowOffset = new Position();

                if (instance._actor != null &&
                    instance.ENABLE_ANIMATION_CHECK == true)
                {
                    String animation = (string)e.NewValue;

                    if (string.IsNullOrEmpty(animation) == false)
                    {
                        Animation.State state;
                        bool            hasState = Enum.TryParse(animation, true, out state);

                        if (instance._actor != null)
                        {
                            if (hasState && instance._actor.HasSprite(state))
                            {
                                instance._actor.SetAnimationState(state);

                                for (int i = 0; i < instance._actor.GetCurrentSprite().GetFrames(); i++)
                                {
                                    instance._frames.Add(Convert.ToString(i + 1));
                                }

                                instance._frameOffset.X = (int)Math.Round(instance._actor.GetCurrentSprite().GetCurrentFrameOffSet().X);
                                instance._frameOffset.Y = (int)Math.Round(instance._actor.GetCurrentSprite().GetCurrentFrameOffSet().Y);

                                instance._spriteOffset.X = (int)Math.Round(instance._actor.GetCurrentSprite().GetSpriteOffSet().X);
                                instance._spriteOffset.Y = (int)Math.Round(instance._actor.GetCurrentSprite().GetSpriteOffSet().Y);

                                instance._shadowOffset.X = (int)instance._actor.GetCurrentSprite().GetShadowOffsetX();
                                instance._shadowOffset.Y = (int)instance._actor.GetCurrentSprite().GetShadowOffsetY();
                            }
                            else
                            {
                                instance._frames.Clear();
                                MessageBox.Show("Cannot find state: " + animation);
                            }
                        }
                    }
                }

                if (instance.ENABLE_ANIMATION_CHECK == false)
                {
                    instance.ENABLE_ANIMATION_CHECK = true;
                }

                instance.Frames       = instance._frames;
                instance.FrameOffset  = instance._frameOffset;
                instance.SpriteOffset = instance._spriteOffset;
                instance.ShadowOffset = instance._shadowOffset;
            }
        }
コード例 #3
0
        private static void BoxItemOnChangeValue(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            if (e != null)
            {
                CharacterView instance = source as CharacterView;
                String        boxItem  = (string)e.NewValue;

                instance._selectedRectItem = new BoundingBox();

                if (instance._actor != null &&
                    String.IsNullOrEmpty(boxItem) == false &&
                    String.IsNullOrEmpty(instance.Animation) == false &&
                    String.IsNullOrEmpty(instance.Frame) == false &&
                    String.IsNullOrEmpty(instance.SelectedBoxType) == false)
                {
                    instance._selectedBoundingBox = instance._actor.GetCurrentBoxes(instance._selectedBoxType)[Convert.ToInt32(boxItem) - 1];
                    instance._selectedRectItem.X  = (int)Math.Round(instance._selectedBoundingBox.GetBaseOffset().X);
                    instance._selectedRectItem.Y  = (int)Math.Round(instance._selectedBoundingBox.GetBaseOffset().Y);

                    instance._selectedRectItem.Width  = instance._selectedBoundingBox.GetBaseRect().Width;
                    instance._selectedRectItem.Height = instance._selectedBoundingBox.GetBaseRect().Height;

                    instance._selectedBoundingBox.SetVisibility(1.0f);
                    instance._actor.GetBodyBox().SetVisibility(0.4f);
                    instance._actor.GetBoundsBox().SetVisibility(0.4f);
                    instance._actor.GetDepthBox().SetVisibility(0.4f);

                    for (int i = 0; i < instance._actor.GetAllFrameBoxes().Count; i++)
                    {
                        CLNS.BoundingBox box = instance._actor.GetAllFrameBoxes()[i];

                        if (box != instance._selectedBoundingBox)
                        {
                            box.SetVisibility(0.4f);
                        }
                    }
                }
                else
                {
                    if (instance._actor != null)
                    {
                        instance._actor.GetBodyBox().SetVisibility(1.0f);
                        instance._actor.GetBoundsBox().SetVisibility(1.0f);
                        instance._actor.GetDepthBox().SetVisibility(1.0f);

                        for (int i = 0; i < instance._actor.GetAllFrameBoxes().Count; i++)
                        {
                            CLNS.BoundingBox box = instance._actor.GetAllFrameBoxes()[i];
                            box.SetVisibility(1.0f);
                        }
                    }
                }

                instance.SelectedRectItem = instance._selectedRectItem;
            }
        }
コード例 #4
0
        private static void ShowBoundsBoxesOnChangeValue(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            if (e != null)
            {
                CharacterView instance  = source as CharacterView;
                bool          showBoxes = (bool)e.NewValue;

                if (showBoxes == true)
                {
                    GameManager.GetInstance().GetRenderManager().ShowBoundsBoxes();
                }
                else
                {
                    GameManager.GetInstance().GetRenderManager().HideBoundsBoxes();
                }
            }
        }
コード例 #5
0
        private static void FrameOnChangeValue(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            if (e != null)
            {
                CharacterView instance = source as CharacterView;
                String        frame    = (string)e.NewValue;

                instance._frameOffset  = new Position();
                instance._spriteOffset = new Position();
                instance._shadowOffset = new Position();

                if (instance._actor != null &&
                    String.IsNullOrEmpty(frame) == false)
                {
                    instance._actor.GetCurrentSprite().SetCurrentFrame(Convert.ToInt32(frame));

                    instance._frameOffset.X = (int)Math.Round(instance._actor.GetCurrentSprite().GetCurrentFrameOffSet().X);
                    instance._frameOffset.Y = (int)Math.Round(instance._actor.GetCurrentSprite().GetCurrentFrameOffSet().Y);

                    instance._spriteOffset.X = (int)Math.Round(instance._actor.GetCurrentSprite().GetSpriteOffSet().X);
                    instance._spriteOffset.Y = (int)Math.Round(instance._actor.GetCurrentSprite().GetSpriteOffSet().Y);

                    instance._shadowOffset.X = (int)instance._actor.GetCurrentSprite().GetShadowOffsetX();
                    instance._shadowOffset.Y = (int)instance._actor.GetCurrentSprite().GetShadowOffsetY();
                }

                List <string> boxItems = new List <string>();

                if (instance._actor != null &&
                    String.IsNullOrEmpty(instance.SelectedBoxType) == false &&
                    String.IsNullOrEmpty(instance.Animation) == false &&
                    String.IsNullOrEmpty(instance.Frame) == false)
                {
                    for (int i = 0; i < instance._actor.GetCurrentBoxes(instance._selectedBoxType).Count; i++)
                    {
                        boxItems.Add(Convert.ToString(i + 1));
                    }
                }

                instance.BoxItems     = boxItems;
                instance.FrameOffset  = instance._frameOffset;
                instance.SpriteOffset = instance._spriteOffset;
                instance.ShadowOffset = instance._shadowOffset;
            }
        }
コード例 #6
0
        private static void ScaleOnChangeValue(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            if (e != null)
            {
                CharacterView instance = source as CharacterView;

                if (instance._actor != null)
                {
                    float sx = instance._actor.GetScale().X;
                    float sy = instance._actor.GetScale().Y;

                    float oldScale = (float)Math.Round((float)e.OldValue);
                    float newScale = (float)Math.Round((float)e.NewValue);

                    instance.CheckScale(newScale, oldScale);
                }
            }
        }
コード例 #7
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 10 "..\..\MainWindow.xaml"
                ((FusionEditor.MainWindow)(target)).ContentRendered += new System.EventHandler(this.Window_ContentRendered);

            #line default
            #line hidden
                return;

            case 2:
                this.characterView = ((FusionEditor.CharacterView)(target));
                return;

            case 3:
                this.scaleSlider = ((System.Windows.Controls.Slider)(target));
                return;

            case 4:
                this.actors = ((System.Windows.Controls.ComboBox)(target));

            #line 30 "..\..\MainWindow.xaml"
                this.actors.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.actors_SelectionChanged);

            #line default
            #line hidden
                return;

            case 5:
                this.animations = ((System.Windows.Controls.ComboBox)(target));

            #line 31 "..\..\MainWindow.xaml"
                this.animations.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.animations_SelectionChanged);

            #line default
            #line hidden
                return;

            case 6:
                this.frames = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 7:
                this.checkAttackBoxes = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 8:
                this.checkBodyBoxes = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 9:
                this.checkBoundsBoxes = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 10:
                this.entityLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 11:
                this.animationsLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 12:
                this.framesLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 13:
                this.comboBoxType = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 14:
                this.boxTypeLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 15:
                this.comboBoxItems = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 16:
                this.boxItemsLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 17:
                this.boxWidth = ((System.Windows.Controls.TextBox)(target));
                return;

            case 18:
                this.boxWidthLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 19:
                this.boxHeightLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 20:
                this.boxHeight = ((System.Windows.Controls.TextBox)(target));
                return;

            case 21:
                this.boxX = ((System.Windows.Controls.TextBox)(target));
                return;

            case 22:
                this.boxXLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 23:
                this.boxYLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 24:
                this.boxY = ((System.Windows.Controls.TextBox)(target));
                return;

            case 25:
                this.saveBtn = ((System.Windows.Controls.Button)(target));
                return;

            case 26:
                this.checkBaseSprite = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 27:
                this.frameX = ((System.Windows.Controls.TextBox)(target));
                return;

            case 28:
                this.labelOffX1 = ((System.Windows.Controls.Label)(target));
                return;

            case 29:
                this.labelOffY = ((System.Windows.Controls.Label)(target));
                return;

            case 30:
                this.frameY = ((System.Windows.Controls.TextBox)(target));
                return;

            case 31:
                this.saveBtn_Copy = ((System.Windows.Controls.Button)(target));
                return;

            case 32:
                this.label = ((System.Windows.Controls.Label)(target));
                return;

            case 33:
                this.label_Copy = ((System.Windows.Controls.Label)(target));
                return;

            case 34:
                this.spriteBoxX = ((System.Windows.Controls.TextBox)(target));
                return;

            case 35:
                this.labelSX = ((System.Windows.Controls.Label)(target));
                return;

            case 36:
                this.labelSY = ((System.Windows.Controls.Label)(target));
                return;

            case 37:
                this.spriteBoxY = ((System.Windows.Controls.TextBox)(target));
                return;

            case 38:
                this.label_Copy1 = ((System.Windows.Controls.Label)(target));
                return;

            case 39:
                this.scrollBar = ((System.Windows.Controls.Primitives.ScrollBar)(target));

            #line 72 "..\..\MainWindow.xaml"
                this.scrollBar.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.scrollBar_ValueChanged);

            #line default
            #line hidden
                return;

            case 40:
                this.btnAddBox = ((System.Windows.Controls.Button)(target));
                return;

            case 41:
                this.labelBaseProp = ((System.Windows.Controls.Label)(target));
                return;

            case 42:
                this.baseX = ((System.Windows.Controls.Label)(target));
                return;

            case 43:
                this.baseY = ((System.Windows.Controls.Label)(target));
                return;

            case 44:
                this.btnRemoveBox = ((System.Windows.Controls.Button)(target));
                return;

            case 45:
                this.baseTextX = ((System.Windows.Controls.TextBox)(target));
                return;

            case 46:
                this.baseTextY = ((System.Windows.Controls.TextBox)(target));

            #line 88 "..\..\MainWindow.xaml"
                this.baseTextY.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.textBox1_TextChanged);

            #line default
            #line hidden
                return;

            case 47:
                this.labelPosition = ((System.Windows.Controls.Label)(target));
                return;

            case 48:
                this.posXLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 49:
                this.posyLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 50:
                this.posTextX = ((System.Windows.Controls.TextBox)(target));
                return;

            case 51:
                this.posTextY = ((System.Windows.Controls.TextBox)(target));

            #line 93 "..\..\MainWindow.xaml"
                this.posTextY.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.textBox1_TextChanged);

            #line default
            #line hidden
                return;

            case 52:
                this.baseSave = ((System.Windows.Controls.Button)(target));
                return;

            case 53:
                this.posSave = ((System.Windows.Controls.Button)(target));
                return;

            case 54:
                this.labelShadow = ((System.Windows.Controls.Label)(target));
                return;

            case 55:
                this.shadowPosXLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 56:
                this.shadowPosYLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 57:
                this.shadowX = ((System.Windows.Controls.TextBox)(target));
                return;

            case 58:
                this.shadowY = ((System.Windows.Controls.TextBox)(target));

            #line 100 "..\..\MainWindow.xaml"
                this.shadowY.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.textBox1_TextChanged);

            #line default
            #line hidden
                return;

            case 59:
                this.shadowSave = ((System.Windows.Controls.Button)(target));
                return;
            }
            this._contentLoaded = true;
        }
コード例 #8
0
        private static void ActorOnChangeValue(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            if (e != null)
            {
                CharacterView instance = source as CharacterView;
                String        actor    = (string)e.NewValue;
                instance._frames       = new List <string>();
                instance._baseOffset   = new Position();
                instance._shadowOffset = new Position();
                instance._position     = new Position();

                if (string.IsNullOrEmpty(actor) == false)
                {
                    if (instance._actor != null)
                    {
                        GameManager.GetInstance().RemoveEntity(instance._actor);
                    }

                    instance._position.X = 400;
                    instance._position.Y = 200;

                    if (instance._entities.ContainsKey(actor) == false)
                    {
                        if (instance._fusionEngineASM != null)
                        {
                            var type = instance._fusionEngineASM.GetType("FusionEngine." + actor);

                            Entity entity = (Entity)Activator.CreateInstance(type);
                            entity.SetAnimationType(FusionEngine.Animation.Type.NONE);
                            entity.SetAnimationState(FusionEngine.Animation.State.STANCE);

                            instance._entities.TryAdd(actor, entity);
                            GameManager.GetInstance().GetRenderManager().AddEntity(entity);
                            instance._actor = entity;
                        }
                    }
                    else
                    {
                        instance._actor = instance._entities[actor];
                        instance._actor.SetAnimationState(FusionEngine.Animation.State.STANCE);
                        GameManager.GetInstance().GetRenderManager().AddEntity(instance._actor);
                    }

                    instance._baseOffset.X   = (int)instance._actor.GetBaseOffsetX();
                    instance._baseOffset.Y   = (int)instance._actor.GetBaseOffsetY();
                    instance._shadowOffset.X = (int)instance._actor.GetCurrentSprite().GetShadowOffsetX();
                    instance._shadowOffset.Y = (int)instance._actor.GetCurrentSprite().GetShadowOffsetY();
                }

                instance.Frames       = instance._frames;
                instance.BaseOffset   = instance._baseOffset;
                instance.Position     = instance._position;
                instance.ShadowOffset = instance._shadowOffset;

                if (instance._actor != null)
                {
                    instance._actor.SetPostion(instance.Position.X, 0, instance.Position.Y);
                    instance._actor.SetScale(instance._actor.GetBaseScale().X - 1, instance._actor.GetBaseScale().Y - 1);
                    instance.CheckScale(instance.Scale, 0);

                    DependencyPropertyChangedEventArgs args = new DependencyPropertyChangedEventArgs(AnimationProperty, null, "STANCE");
                    AnimationOnChangeValue(source, args);
                }
            }
        }