コード例 #1
0
ファイル: CharLook.cs プロジェクト: github-esme/MsCharacter
        public void Draw(DrawArgument args, float alpha)
        {
            if (Body == null || Hair == null || Face == null)
            {
                return;
            }
            var acMove = new Vector2();

            if (Action != null)
            {
                acMove = Action.Move();
            }
            var relArgs = new DrawArgument(acMove, _flip);

            var inStance     = _stance.Get(alpha);
            var inExpression = _expression.Get(alpha);
            var inFrame      = _stFrame.Get(alpha);
            var inExpFrame   = _expFrame.Get(alpha);

            switch (inStance)
            {
            case Stance.Id.Stand1:
            case Stance.Id.Stand2:
                if (_alerted.Bool)
                {
                    inStance = Stance.Id.Alert;
                }
                break;
            }

            var args2 = (relArgs + args);

            Draw(inStance, inExpression, inFrame, inExpFrame, args2);
        }
コード例 #2
0
ファイル: MapleStory.cs プロジェクト: github-esme/MsCharacter
        public Game1()
        {
            GameUtil.Graphics     = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            GameUtil.Graphics.PreferredBackBufferWidth  = 800;
            GameUtil.Graphics.PreferredBackBufferHeight = 600;

            var lookEntry = new LookEntry();

            lookEntry.Skin   = 1;
            lookEntry.Hair   = 30003;
            lookEntry.Face   = 20001;
            lookEntry.Equips = new Dictionary <short, int>();

            lookEntry.Equips[0] = 1060000; // 裤子
            lookEntry.Equips[1] = 1302000; // 武器
            lookEntry.Equips[2] = 1040007; // 上衣

            // _equips.AddEquip(1302003, _drawInfo); // 武器
            // _equips.AddEquip(1060000, _drawInfo); // 裤子
            // _equips.AddEquip(1040007, _drawInfo); // 上衣
            // _equips.AddEquip(1071001, _drawInfo); // 鞋子
            // _equips.AddEquip(1000019, _drawInfo); // 帽子
            // _equips.AddEquip(1102008, _drawInfo); // 披风


            _charLook = new CharLook(lookEntry);
            _drawArgs = new DrawArgument(new Vector2(100, 100), true);
        }
コード例 #3
0
ファイル: Face.cs プロジェクト: github-esme/MsCharacter
 public void Draw(Expression.Id exp, short frame, DrawArgument args)
 {
     if (_expressions.ContainsKey(exp) && _expressions[exp].ContainsKey(frame))
     {
         _expressions[exp][frame].Tex.Draw(args);
     }
 }
コード例 #4
0
ファイル: AfterImage.cs プロジェクト: github-esme/MsCharacter
 public void Draw(short stFrame, DrawArgument args, float alpha)
 {
     if (!_displayed && stFrame >= FirstFrame)
     {
         _animation.Draw(args, alpha);
     }
 }
コード例 #5
0
ファイル: Body.cs プロジェクト: github-esme/MsCharacter
        public void Draw(Stance.Id stance, Layer layer, short frame, DrawArgument args)
        {
            if (stance == Stance.Id.Dead)
            {
                if (layer == Layer.Head)
                {
                    _stances[Stance.Id.Stand1][layer][frame].Draw(args + new Vector2(0, 4));
                }
                else
                {
                    if (!_stances.ContainsKey(stance) || !_stances[stance].ContainsKey(layer) ||
                        !_stances[stance][layer].ContainsKey(frame))
                    {
                        return;
                    }
                    _stances[stance][layer][frame].Draw(args + new Vector2(args.XScale.Equals(-1) ? 3 : -3, 0));
                }

                return;
            }

            if (!_stances.ContainsKey(stance) || !_stances[stance].ContainsKey(layer) ||
                !_stances[stance][layer].ContainsKey(frame))
            {
                return;
            }
            _stances[stance][layer][frame].Draw(args);
        }
コード例 #6
0
ファイル: Clothing.cs プロジェクト: github-esme/MsCharacter
 public void Draw(Stance.Id stance, Layer layer, short frame, DrawArgument args)
 {
     if (!_stances.ContainsKey(stance) || !_stances[stance].ContainsKey(layer))
     {
         return;
     }
     foreach (var keyValuePair in _stances[stance][layer].Where(keyValuePair => keyValuePair.Key.S == frame))
     {
         keyValuePair.Value.Draw(args);
     }
 }
コード例 #7
0
 public void Draw(Stance.Id stance, Layer layer, short frame, DrawArgument args)
 {
     if (stance == Stance.Id.Dead)
     {
         _stances[Stance.Id.Stand1][Layer.OverHead][frame].Draw(args + new Vector2(0, 4));
     }
     if (_stances.ContainsKey(stance) && _stances[stance].ContainsKey(layer) &&
         _stances[stance][layer].ContainsKey(frame))
     {
         _stances[stance][layer][frame].Draw(args);
     }
 }
コード例 #8
0
ファイル: Animation.cs プロジェクト: github-esme/MsCharacter
        public void Draw(DrawArgument args, float alpha)
        {
            var interFrame  = _frame.Get(alpha);
            var interOpc    = _opacity.Get(alpha) / 255;
            var interScale  = _xyScale.Get(alpha) / 100;
            var modifyOpc   = !interOpc.Equals(1.0f);
            var modifyScale = !interScale.Equals(1.0f);

            if (modifyOpc || modifyScale)
            {
                _frames[interFrame].Draw(args + new DrawArgument(interScale, interScale, interOpc));
            }
            else
            {
                _frames[interFrame].Draw(args);
            }
        }
コード例 #9
0
        public void Draw(DrawArgument args)
        {
            var origin = args.XScale.Equals(-1) ? new Vector2(Rectangle.Width - Origin.X, Origin.Y) : Origin;
            var eff    = args.XScale.Equals(-1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
            var rect   = Rectangle;

            if (args.XScale.Equals(-1))
            {
                rect.X = -rect.Right;
            }
            // GameUtil.SpriteBatch.Draw(
            //     Tex,
            //     args.Pos,
            //     AtlasRect,
            //     color: Color.White,
            //     origin: origin,
            //     effects: eff);

            GameUtil.SpriteBatch.Draw(Tex, args.Pos, AtlasRect, Color.White, 0f, origin, Vector2.One, eff, 0f);
        }
コード例 #10
0
ファイル: CharLook.cs プロジェクト: github-esme/MsCharacter
        private void Draw(Stance.Id inStance, Expression.Id inExpression, short inFrame, short inExpFrame,
                          DrawArgument args)
        {
            if (Stance.IsClimbing(inStance)) // 判断是否为 爬绳
            {
                Body.Draw(inStance, Body.Layer.Body, inFrame, args);
                _equips.Draw(EquipSlot.Id.Gloves, inStance, Clothing.Layer.Glove, inFrame, args);
                _equips.Draw(EquipSlot.Id.Shoes, inStance, Clothing.Layer.Shoes, inFrame, args);
                _equips.Draw(EquipSlot.Id.Bottom, inStance, Clothing.Layer.Pants, inFrame, args);
                _equips.Draw(EquipSlot.Id.Top, inStance, Clothing.Layer.Top, inFrame, args);
                _equips.Draw(EquipSlot.Id.Top, inStance, Clothing.Layer.Mail, inFrame, args);
                _equips.Draw(EquipSlot.Id.Cape, inStance, Clothing.Layer.Cape, inFrame, args);
                Body.Draw(inStance, Body.Layer.Head, inFrame, args);
                _equips.Draw(EquipSlot.Id.EarAcc, inStance, Clothing.Layer.Earrings, inFrame, args);
                switch (_equips.GetCapType())
                {
                case CharEquips.CapType.None:
                    Hair.Draw(inStance, Hair.Layer.Back, inFrame, args);
                    break;

                case CharEquips.CapType.Headband:
                    _equips.Draw(EquipSlot.Id.Hat, inStance, Clothing.Layer.Cap, inFrame, args);
                    Hair.Draw(inStance, Hair.Layer.Back, inFrame, args);
                    break;

                case CharEquips.CapType.HalfCover:
                    Hair.Draw(inStance, Hair.Layer.BelowCap, inFrame, args);
                    _equips.Draw(EquipSlot.Id.Hat, inStance, Clothing.Layer.Cap, inFrame, args);
                    break;

                case CharEquips.CapType.FullCover:
                    _equips.Draw(EquipSlot.Id.Hat, inStance, Clothing.Layer.Cap, inFrame, args);
                    break;
                }

                _equips.Draw(EquipSlot.Id.Shield, inStance, Clothing.Layer.BackShield, inFrame, args);
                _equips.Draw(EquipSlot.Id.Weapon, inStance, Clothing.Layer.BackWeapon, inFrame, args);
            }
            else
            {
                var faceShift = _drawInfo.GetFacePosition(inStance, inFrame);
                var faceArgs  =
                    args + (faceShift - (args.XScale.Equals(-1f) ? new Vector2(faceShift.X * 2, 0) : new Vector2()));
                Hair.Draw(inStance, Hair.Layer.BelowBody, inFrame, args);
                _equips.Draw(EquipSlot.Id.Cape, inStance, Clothing.Layer.Cape, inFrame, args);
                _equips.Draw(EquipSlot.Id.Shield, inStance, Clothing.Layer.ShieldBelowBody, inFrame, args);
                _equips.Draw(EquipSlot.Id.Weapon, inStance, Clothing.Layer.WeaponBelowBody, inFrame, args);
                _equips.Draw(EquipSlot.Id.Hat, inStance, Clothing.Layer.CapBelowBody, inFrame, args);
                Body.Draw(inStance, Body.Layer.Body, inFrame, args);
                _equips.Draw(EquipSlot.Id.Gloves, inStance, Clothing.Layer.WristOverBody, inFrame, args);
                _equips.Draw(EquipSlot.Id.Gloves, inStance, Clothing.Layer.GloveOverBody, inFrame, args);
                _equips.Draw(EquipSlot.Id.Shoes, inStance, Clothing.Layer.Shoes, inFrame, args);
                Body.Draw(inStance, Body.Layer.ArmBelowHead, inFrame, args);

                if (_equips.HasOverAll)
                {
                    _equips.Draw(EquipSlot.Id.Top, inStance, Clothing.Layer.Mail, inFrame, args);
                }
                else
                {
                    _equips.Draw(EquipSlot.Id.Bottom, inStance, Clothing.Layer.Pants, inFrame, args);
                    _equips.Draw(EquipSlot.Id.Top, inStance, Clothing.Layer.Top, inFrame, args);
                }

                Body.Draw(inStance, Body.Layer.ArmBelowHeadOverMail, inFrame, args);
                Hair.Draw(inStance, Hair.Layer.Default, inFrame, args);
                _equips.Draw(EquipSlot.Id.Shield, inStance, Clothing.Layer.ShieldOverHair, inFrame, args);
                _equips.Draw(EquipSlot.Id.EarAcc, inStance, Clothing.Layer.Earrings, inFrame, args);
                Body.Draw(inStance, Body.Layer.Head, inFrame, args);
                Hair.Draw(inStance, Hair.Layer.Shade, inFrame, args);
                Face.Draw(inExpression, inExpFrame, faceArgs);
                _equips.Draw(EquipSlot.Id.Face, inStance, Clothing.Layer.FaceAcc, 0, faceArgs);
                _equips.Draw(EquipSlot.Id.EyeAcc, inStance, Clothing.Layer.EyeAcc, inFrame, args);
                _equips.Draw(EquipSlot.Id.Shield, inStance, Clothing.Layer.Shield, inFrame, args);
                switch (_equips.GetCapType())
                {
                case CharEquips.CapType.None:
                    Hair.Draw(inStance, Hair.Layer.OverHead, inFrame, args);
                    break;

                case CharEquips.CapType.Headband:
                    _equips.Draw(EquipSlot.Id.Hat, inStance, Clothing.Layer.Cap, inFrame, args);
                    Hair.Draw(inStance, Hair.Layer.Default, inFrame, args);
                    Hair.Draw(inStance, Hair.Layer.OverHead, inFrame, args);
                    _equips.Draw(EquipSlot.Id.Hat, inStance, Clothing.Layer.CapOverHair, inFrame, args);
                    break;

                case CharEquips.CapType.HalfCover:
                    Hair.Draw(inStance, Hair.Layer.Default, inFrame, args);
                    _equips.Draw(EquipSlot.Id.Hat, inStance, Clothing.Layer.Cap, inFrame, args);
                    break;

                case CharEquips.CapType.FullCover:
                    _equips.Draw(EquipSlot.Id.Hat, inStance, Clothing.Layer.Cap, inFrame, args);
                    break;
                }

                _equips.Draw(EquipSlot.Id.Weapon, inStance, Clothing.Layer.WeaponBelowArm, inFrame, args);

                if (inStance == Stance.Id.StabO1)
                {
                    Console.WriteLine();
                }
                if (IsTwoHanded(inStance))
                {
                    _equips.Draw(EquipSlot.Id.Top, inStance, Clothing.Layer.MailArm, inFrame, args);
                    Body.Draw(inStance, Body.Layer.Arm, inFrame, args);
                    Body.Draw(inStance, Body.Layer.ArmOverHair, inFrame, args);
                    Body.Draw(inStance, Body.Layer.ArmOverHairBelowWeapon, inFrame, args);
                    _equips.Draw(EquipSlot.Id.Weapon, inStance, Clothing.Layer.Weapon, inFrame, args);
                }
                else
                {
                    _equips.Draw(EquipSlot.Id.Weapon, inStance, Clothing.Layer.Weapon, inFrame, args);
                    Body.Draw(inStance, Body.Layer.Arm, inFrame, args);
                    Body.Draw(inStance, Body.Layer.ArmOverHair, inFrame, args);
                    Body.Draw(inStance, Body.Layer.ArmOverHairBelowWeapon, inFrame, args);
                    _equips.Draw(EquipSlot.Id.Top, inStance, Clothing.Layer.MailArm, inFrame, args);
                }

                _equips.Draw(EquipSlot.Id.Gloves, inStance, Clothing.Layer.Wrist, inFrame, args);
                _equips.Draw(EquipSlot.Id.Gloves, inStance, Clothing.Layer.Glove, inFrame, args);
                _equips.Draw(EquipSlot.Id.Weapon, inStance, Clothing.Layer.WeaponOverGlove, inFrame, args);

                Body.Draw(inStance, Body.Layer.HandBelowWeapon, inFrame, args);

                _equips.Draw(EquipSlot.Id.Weapon, inStance, Clothing.Layer.WeaponOverHand, inFrame, args);
                _equips.Draw(EquipSlot.Id.Weapon, inStance, Clothing.Layer.WeaponOverBody, inFrame, args);
                Body.Draw(inStance, Body.Layer.HandOverHair, inFrame, args);
                Body.Draw(inStance, Body.Layer.HandOverWeapon, inFrame, args);

                _equips.Draw(EquipSlot.Id.Gloves, inStance, Clothing.Layer.WristOverHair, inFrame, args);
                _equips.Draw(EquipSlot.Id.Gloves, inStance, Clothing.Layer.GloveOverHair, inFrame, args);
            }
        }
コード例 #11
0
ファイル: Animation.cs プロジェクト: github-esme/MsCharacter
 public void Draw(DrawArgument args)
 {
     _texture.Draw(args);
 }
コード例 #12
0
ファイル: CharEquips.cs プロジェクト: github-esme/MsCharacter
 public void Draw(EquipSlot.Id slot, Stance.Id stance, Clothing.Layer layer, short frame, DrawArgument args)
 {
     if (!_clothes.ContainsKey(slot))
     {
         return;
     }
     _clothes[slot].Draw(stance, layer, frame, args);
 }