예제 #1
0
        public YesNoDialog(ContentManager content, string message)
        {
            Sprite = new Sprite(content, "General\\Dialog_BG");

            yesButton = new Button(new Sprite(content, "General\\YesBtn_Normal"), new Sprite(content, "General\\YesBtn_Hover"));
            yesButton.Position = new Vector2(Sprite.Position.X + Sprite.Bound.Width / 2 - yesButton.Sprite.Bound.Width - 30,
                                             Sprite.Position.Y + Sprite.Bound.Height - 45
                                     );
            yesButton.ButtonEvent += YesBtn_Clicked;

            noButton = new Button(new Sprite(content, "General\\NoBtn_Normal"), new Sprite(content, "General\\NoBtn_Hover"));
            noButton.Position = new Vector2(Sprite.Position.X + Sprite.Bound.Width / 2 + 30,
                                             Sprite.Position.Y + Sprite.Bound.Height - 45
                                     );
            noButton.ButtonEvent += NoBtn_Clicked;

            font = content.Load<SpriteFont>("ArialBold");

            messagePosition = new Vector2(Sprite.Position.X, Sprite.Position.Y);
            messageText = TextFormater.getIntance().WordWrap(font, message, Sprite.Bound.Width - 60);

            Origin = new Vector2(Sprite.Bound.Width / 2, Sprite.Bound.Height / 2);

            float textheight = font.MeasureString(messageText).Y;
            float ratio = (Sprite.Bound.Height + textheight) / Sprite.Bound.Height;

            Sprite.Scale = new Vector2(1, ratio);

            oldMousePos = new Point(0, 0);

            IsShow = false;

            inputControls = new InputController();
        }
예제 #2
0
        public DetailSideBar(ContentManager _content)
        {
            inputController = new InputController();
            contentManager = _content;

            this.Sprite = new Sprite(_content, "General\\detail");
            this.Sprite.Position = new Vector2(0, 0);
            this.CardPreview = new Sprite(SpriteManager.getInstance(_content).GetSprite(SpriteID.BBackSide));
            this.CardPreview.Position = new Vector2(this.Position.X + 5, this.Position.Y + 70);

            font = _content.Load<SpriteFont>("ArialSmall");
            descPosition = new Vector2(this.Position.X + 15, this.Position.Y + 375);
            textBoxRect = new Rectangle((int)descPosition.X, (int)descPosition.Y, 165, 140);

            //CARD DESCRIPTION LAY TRONG CARD DATA
            this.Description = CardData != null ? CardData.Description : "";
            //this.Description = "Dong thu nhat. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello.";

            this.Description = TextFormater.getIntance().WordWrap(font, this.Description, 170);

            scrollBtn = new Button(new Sprite(_content, "General\\scroll_bar"));
            scrollBtn.Sprite.Frame = new Rectangle(16, 16, 16, 16);

            scrollBtn.Position = new Vector2(this.Position.X + 189, this.Position.Y + 381);
            scrollBarHeight = 129 - scrollBtn.Sprite.Frame.Height;

            var normalup = new Sprite(_content, "General\\scroll_bar");
            normalup.Frame = new Rectangle(16, 0, 16, 16);

            var hoverup = new Sprite(_content, "General\\scroll_bar");
            hoverup.Frame = new Rectangle(32, 0, 16, 16);

            upBtn = new Button(normalup, hoverup);
            upBtn.Position = new Vector2(this.Position.X + 189, this.Position.Y + 365);
            upBtn.ButtonEvent += MoveTextUp;

            var normaldown = new Sprite(_content, "General\\scroll_bar");
            normaldown.Frame = new Rectangle(16, 146, 16, 16);

            var hoverdown = new Sprite(_content, "General\\scroll_bar");
            hoverdown.Frame = new Rectangle(32, 146, 16, 16);

            downBtn = new Button(normaldown, hoverdown);
            downBtn.Position = new Vector2(this.Position.X + 189, this.Position.Y + 511);
            downBtn.ButtonEvent += MoveTextDown;
        }
예제 #3
0
        public override void Init()
        {
            base.Init();
            this.MainDeck.Position = GlobalSetting.Default.PlayerMain;
            this.GraveYard.Position = GlobalSetting.Default.PlayerGrave;
            this.MonsterField.Position = GlobalSetting.Default.PlayerMonF;
            this.SpellField.Position = GlobalSetting.Default.PlayerSpellF;
            this.Hand.Position = GlobalSetting.Default.PlayerHand;

            //Graveyard

            this.GraveYard.CardAdded += new CardAddedEventHandler(Graveyard_CardAdded_SetPosition);
                //this.MonsterField.CardAdded += new CardAddedEventHandler(Graveyard_CardAdded);
                //this.MonsterField.CardRemoved += new CardRemoveEventHandler(Graveyard_CardRemove);

            // MonsterField
            this.MonsterField.CardAdded += new CardAddedEventHandler(MonsterField_CardAdded_SetPosition);
            this.MonsterField.CardAdded += new CardAddedEventHandler(MonsterField_CardAdded);
            this.MonsterField.CardRemoved += new CardRemoveEventHandler(MonsterField_CardRemove);

            // Spell Field
            this.SpellField.CardAdded += new CardAddedEventHandler(SpellField_CardAdded_SetPosition);
            this.SpellField.CardAdded += new CardAddedEventHandler(SpellField_CardAdded);
            this.SpellField.CardRemoved += new CardRemoveEventHandler(SpellField_CardRemove);

            // Hand
            this.Hand.CardAdded += new CardAddedEventHandler(Hand_CardAdded_ScaleCard);
            this.Hand.CardAdded += new CardAddedEventHandler(Hand_SetPosition);
            this.Hand.CardAdded += new CardAddedEventHandler(Hand_CardAdded);
            this.Hand.CardRemoved += new CardRemoveEventHandler(Hand_CardRemove);
            this.Hand.CardRemoved += new CardRemoveEventHandler(Hand_CardRemoved_ScaleCard);
            this.Hand.CardRemoved += new CardRemoveEventHandler(Hand_SetPosition);

            Phase = ePhase.STARTUP;
            IsTurn = true;
            this.Input = new InputController();
        }