示例#1
0
        public DialogControl(NeutralNpc npc)
        {
            _npc = npc;

            _boxColor = new Color(0, 0, 0, 100);
            _lineHeight = (int)_npc.inGameLevel.spriteService.TextSize("H").Y+12;

            //Litt massive opprettelser for å legge boksene i en salgs mal. Source har ikke noe å si?
            npcTalkBox = new StaticSprite("box", new Rectangle(40, (int)_npc.inGameLevel.spriteService.GameWindowSize.Y, _maxTextWidth + 20, 0),
                new Rectangle(0, 0, 1, 1), 1001f, _boxColor);
            npcNameBox = new StaticSprite("box", new Rectangle(70, (int)_npc.inGameLevel.spriteService.GameWindowSize.Y-(_lineHeight),
                (int)_npc.inGameLevel.spriteService.TextSize(_npc.npcName).X + 10, _lineHeight), new Rectangle(0, 0, 1, 1), 1001f, _boxColor);
            playerTalkBox = new StaticSprite("box",
                new Rectangle((int)_npc.inGameLevel.spriteService.GameWindowSize.X - 560, (int)_npc.inGameLevel.spriteService.GameWindowSize.Y, _maxTextWidth + 20, 0),
                new Rectangle(0, 0, 1, 1), 1001f, _boxColor);
            playerNameBox = new StaticSprite("box",
                new Rectangle((int)_npc.inGameLevel.spriteService.GameWindowSize.X - 105, (int)_npc.inGameLevel.spriteService.GameWindowSize.Y - (_lineHeight), 35, _lineHeight),
                new Rectangle(0, 0, 1, 1), 1001f, _boxColor);

            npcSaysPos.X = npcTalkBox.DestinationX + 10;
            npcSaysPos.Y = npcTalkBox.DestinationY + _textOffsetY;

            npcNamePos = new Vector2(npcNameBox.DestinationX + 5, npcNameBox.DestinationY + 6);
            playerNamePos = new Vector2(playerNameBox.DestinationX + 5, playerNameBox.DestinationY + 6);
        }
示例#2
0
        public TownLevel(Player player1, Game game)
            : base(player1, game)
        {
            _background = new StaticSprite("ground", new Rectangle(0, 0, (int)spriteService.GameWindowSize.X, (int)spriteService.GameWindowSize.Y));
            spriteService.LoadDrawable(_background);

            _shopkeeper = new MerchantNpc("shopkeeper", new Rectangle(400, 300, 118, 219), _player1, this);
            spriteService.LoadDrawable(_shopkeeper);
            _oracle = new OracleNpc("oracle", new Rectangle(900, 200, 148, 174), _player1, this);
            spriteService.LoadDrawable(_oracle);
        }