Example #1
0
        public SkillCard(System.Drawing.Bitmap cardImage, Vector2D position, string viewName, string cost, Data.Character ownerCharacter, Data.ActionSkill actionSkill)
        {
            this.cardImage      = cardImage;
            this.position       = position;
            this.ownerCharacter = ownerCharacter;
            this.cost           = cost;
            this.actionSkill    = actionSkill;

            {
                var bmp     = cardImage;
                var texture = new Texture(bmp);
                var w       = 160;
                var h       = (int)((double)bmp.Height / (double)bmp.Width * w);
                var sprite  = new ImageSprite(texture, new Rect(new Vector2D(position.X, position.Y), new Vector2D(w, h)), new Color(1, 1, 1, 1));
                layer.Add(sprite, 10);

                size           = new Vector2D(w, h);
                mySprites.face = sprite;
            }

            {
                var x    = position.X - 5;
                var y    = position.Y + 200;
                var font = new Font(Config.MainConfig.MainFontPath, 16, new Color(1, 1, 1, 1), new Font.FontFrame[] {
                    new Font.FontFrame(2, new Color(1, 0, 0, 0)),
                }, 0);
                var ts = new TextSprite(viewName, font, new Vector2D(x, y));

                layer.Add(ts, 20);
                mySprites.viewName = ts;
            }
            {
                var x      = position.X;
                var y      = position.Y + 227;
                var w      = size.X;
                var h      = 1;
                var sprite = new PlaneSprite(new Rect(new Vector2D(x, y), new Vector2D(w, h)), new Color(0.3, 1, 1, 1));
                layer.Add(sprite, 10);
                mySprites.bar = sprite;
            }
            {
                var x    = position.X - 5;
                var y    = position.Y + 225;
                var font = new Font(Config.MainConfig.MainFontPath, 12, new Color(1, 1, 1, 1), new Font.FontFrame[] {
                    new Font.FontFrame(2, new Color(1, 0, 0, 0)),
                }, 0);
                var ts = new TextSprite(cost, font, new Vector2D(x, y));
                //var ts = new TextSprite(cost, "data/font/rounded-mgenplus-1cp-medium.ttf", 12, new Vector2D(x, y), new Color(1, 1, 1, 1));
                layer.Add(ts, 20);
                mySprites.ViewStatus = ts;
            }

            {
                var sprite = new PlaneLineSprite(new Rect(position, size), new Color(0.5, 1, 1, 1));
                layer.Add(sprite, 30);
                mySprites.mouseOn = sprite;
            }
        }
Example #2
0
        public Choice(string[] texts)
        {
            var i = 0;

            foreach (var text in texts)
            {
                var item = new Item();
                {
                    var x = 500;
                    var y = 300 + i * 60;

                    var font = new Font(Config.MainConfig.MainFontPath, 26, new Color(1, 1, 1, 1), new Font.FontFrame[] {
                        new Font.FontFrame(2, new Color(1, 0, 0, 0)),
                    }, 0);
                    var ts = new TextSprite(text, font, new Vector2D(x, y));


                    layer.Add(ts, 20);


                    item.TextSprite = ts;
                }
                {
                    var x      = 500;
                    var y      = 300 + i * 60;
                    var sprite = new PlaneLineSprite(new Rect(new Vector2D(x, y), new Vector2D(600, 50)), new Color(0.5, 1, 1, 1));
                    layer.Add(sprite, 20);
                    item.PlaneLineSprite = sprite;
                }
                {
                    var x      = 500;
                    var y      = 300 + i * 60;
                    var sprite = new PlaneSprite(new Rect(new Vector2D(x, y), new Vector2D(600, 50)), new Color(0.5, 0, 0, 0));
                    layer.Add(sprite, 5);
                    item.BackPlaneSprite = sprite;
                }
                item.Text = text;

                items.Add(item);

                i++;
            }
        }
Example #3
0
        public PlayerCard(Vector2D position, Data.Character character)
        {
            //var cardImage = default(System.Drawing.Bitmap);
            this.character = character;
            this.cardImage = new System.Drawing.Bitmap(character.imagePath);
            this.position  = position;

            character.playerCard = this;

            {
                var bmp     = cardImage;
                var texture = new Texture(bmp);
                var w       = 160;
                var h       = (int)((double)bmp.Height / (double)bmp.Width * w);
                var sprite  = new ImageSprite(texture, new Rect(new Vector2D(position.X, position.Y), new Vector2D(w, h)), new Color(1, 1, 1, 1));
                layer.Add(sprite, 10);

                size           = new Vector2D(w, h);
                mySprites.face = sprite;
            }

            {
                var x      = 0;
                var y      = 0;
                var w      = 60;
                var h      = 6;
                var sprite = new PlaneSprite(new Rect(new Vector2D(x, y), new Vector2D(w, h)), new Color(0.75, 0, 1, 0.5));
                layer.Add(sprite, 10);
                mySprites.elementTimerBar = sprite;
            }
            {
                var x      = 0;
                var y      = 0;
                var w      = 60 + 2;
                var h      = 6 + 2;
                var sprite = new PlaneLineSprite(new Rect(new Vector2D(x, y), new Vector2D(w, h)), new Color(0.5, 0, 0, 0));
                layer.Add(sprite, 10);
                mySprites.elementTimerBarFrame = sprite;
            }

            {
                var x = position.X - 5;
                var y = position.Y + 200;

                var font = new Font(Config.MainConfig.MainFontPath, 16, new Color(1, 1, 1, 1), new Font.FontFrame[] {
                    new Font.FontFrame(2, new Color(1, 0, 0, 0)),
                }, 0);
                var ts = new TextSprite(character.ViewName, font, new Vector2D(x, y));

                layer.Add(ts, 20);
                mySprites.viewName = ts;
            }
            {
                var x      = position.X;
                var y      = position.Y + 227;
                var w      = size.X;
                var h      = 1;
                var sprite = new PlaneSprite(new Rect(new Vector2D(x, y), new Vector2D(w, h)), new Color(0.3, 1, 1, 1));
                layer.Add(sprite, 10);
                mySprites.bar = sprite;
            }
            {
                var x = position.X - 5;
                var y = position.Y + 225;

                var font = new Font(Config.MainConfig.MainFontPath, 12, new Color(1, 1, 1, 1), new Font.FontFrame[] {
                    new Font.FontFrame(2, new Color(1, 0, 0, 0)),
                }, 0);
                var ts = new TextSprite($"{character.HP.Now}/{character.HP.Max}", font, new Vector2D(x, y));
                layer.Add(ts, 20);
                mySprites.ViewStatus = ts;
            }

            {
                var sprite = new PlaneLineSprite(new Rect(position, size), new Color(0.0, 1, 1, 1));
                layer.Add(sprite, 30);
                mySprites.mouseOn = sprite;
            }


            {
                var margin   = mouseOnTargetMargin;
                var filePath = character.imagePath + ".sel.png";
                var bmp2     = default(System.Drawing.Bitmap);
                if (System.IO.File.Exists(filePath))
                {
                    bmp2 = new System.Drawing.Bitmap(filePath);
                }
                else
                {
                    bmp2 = DrawUtility.DrawFrame.Draw(cardImage, margin, 8.0, 2.0, new Color(1, 0, 0.2, 1));
                    bmp2.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
                }

                var texture = new Texture(bmp2);
                var w       = 160 + margin * 2;
                var h       = (int)((double)bmp2.Height / (double)bmp2.Width * w);
                var sprite  = new ImageSprite(texture, new Rect(new Vector2D(10, 10), new Vector2D(w, h)), new Color(1, 1, 1, 1));
                layer.Add(sprite, 5);

                mouseOnTarget = sprite;
            }

            foreach (var element in character.Elements)
            {
                AddElement(element);
            }
        }
Example #4
0
        public EnemyCard(System.Drawing.Bitmap cardImage, Vector2D position, string viewName, Data.Character character)
        {
            this.cardImage       = cardImage;
            this.character       = character;
            this.HPBarFrameWidth = (int)(HPBarFrameWidthBase * character.HPBarFrameWidthScale);
            character.enemyCard  = this;

            {
                var bmp     = cardImage;
                var texture = new Texture(bmp);
                var w       = (int)(bmp.Width * character.imageScale); // 160
                var h       = (int)((double)bmp.Height / (double)bmp.Width * w);
                var sprite  = new ImageSprite(texture, new Rect(new Vector2D(position.X, position.Y), new Vector2D(w, h)), new Color(1, 1, 1, 1));
                layer.Add(sprite, 10);

                size = new Vector2D(w, h);

                mySprites.face = sprite;
            }

            {
                var bmp     = new System.Drawing.Bitmap(Config.MainConfig.BattleScene.EnemyShadowImage);
                var texture = new Texture(bmp);
                var w       = 160;
                var h       = (int)((double)bmp.Height / (double)bmp.Width * w);
                var sprite  = new ImageSprite(texture, new Rect(new Vector2D(position.X, position.Y), new Vector2D(w, h)), new Color(0.8, 1, 1, 1));
                layer.Add(sprite, 5);
                mySprites.shadow = sprite;
            }

            {
                var x      = 0;
                var y      = 0;
                var w      = HPBarFrameWidth;
                var h      = 6;
                var sprite = new PlaneSprite(new Rect(new Vector2D(x, y), new Vector2D(w, h)), new Color(0.75, 1, 0.2, 0.0));
                layer.Add(sprite, 10);
                mySprites.hpBar = sprite;
            }
            {
                var x      = 0;
                var y      = 0;
                var w      = HPBarFrameWidth + 2;
                var h      = 6 + 2;
                var sprite = new PlaneLineSprite(new Rect(new Vector2D(x, y), new Vector2D(w, h)), new Color(0.5, 0, 0, 0));
                layer.Add(sprite, 10);
                mySprites.hpBarFrame = sprite;
            }

            {
                //var sprite = new PlaneLineSprite(new Rect(position, size), new Color(0.5, 1, 1, 1));
                var sprite = new PlaneSprite(new Rect(position, size), new Color(0.0, 1, 1, 1));
                layer.Add(sprite, 30);
                mySprites.mouseOn        = sprite;
                mySprites.mouseOn.IsDraw = false;
            }

            {
                var margin = mouseOnTargetMargin;

                var filePath = character.imagePath + ".sel.png";
                var bmp2     = default(System.Drawing.Bitmap);
                if (System.IO.File.Exists(filePath))
                {
                    bmp2 = new System.Drawing.Bitmap(filePath);
                }
                else
                {
                    bmp2 = DrawUtility.DrawFrame.Draw(cardImage, margin, 8.0, 2.0, new Color(1, 0, 0.2, 1));
                    bmp2.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
                }

                var texture = new Texture(bmp2);
                var w       = (int)(bmp2.Width * character.imageScale); // 160
                var h       = (int)((double)bmp2.Height / (double)bmp2.Width * w);
                var sprite  = new ImageSprite(texture, new Rect(new Vector2D(10, 10), new Vector2D(w, h)), new Color(1, 1, 1, 1));
                layer.Add(sprite, 5);

                mouseOnTarget = sprite;
            }

            foreach (var element in character.Elements)
            {
                AddElement(element);
            }
        }