protected void SetupNamePlates() { int margin = UnitConvert.ToAbsoluteWidth(20); Rectangle namePlateRectFoes = new Rectangle(boardRect.Right + margin, boardRect.Top + margin, ((windowWidth - boardRect.Width) / 2) - margin - margin, windowHeight / 2); NamePlateFoes namePlateFoes = new NamePlateFoes(namePlateRectFoes, FontResources.oldenburg_20, FontResources.oldenburg_30, "namePlateFoes", 1); Rectangle namePlateRectLocal = new Rectangle(margin, boardRect.Top + margin, ((windowWidth - boardRect.Width) / 2) - margin - margin, windowHeight / 4); NamePlateLocal namePlateLocal = new NamePlateLocal(namePlateRectLocal, FontResources.oldenburg_20, FontResources.oldenburg_30, "namePlateLocal", 1); PlayerManager.Instance().AddObserver(namePlateFoes); PlayerManager.Instance().AddObserver(namePlateLocal); MeepleColorClaimer.Instance().AddObserver(namePlateFoes); MeepleColorClaimer.Instance().AddObserver(namePlateLocal); CommandQueue.Queue(new AddToBoardCommand(namePlateFoes, namePlateLocal)); }
public NamePlateLocal(Rectangle position, SpriteFont fontSmall, SpriteFont fontBig, string UID, int zPosition = 0) : base(position, TextureResources.Get("NamePlateBackgroundRed"), UID, zPosition) { current = this; contentRect = new Rectangle(position.Location + margin, position.Size - margin - margin); Rectangle helloRect = new Rectangle(contentRect.Location.X, contentRect.Location.Y, contentRect.Width, contentRect.Height / 4); hello = new TextBoardElement(helloRect, "Hello", fontSmall, "namePlateHello", ColorResources.White, zPosition + 1, TextBoardElement.Alignment.LeftBottom); Rectangle nameRect = new Rectangle(contentRect.Location.X, contentRect.Location.Y + helloRect.Height, contentRect.Width, contentRect.Height * 3 / 4); playerName = new TextBoardElement(nameRect, GetLocalPlayerName() + "!", fontBig, "namePlatePlayer", ColorResources.White, zPosition + 1, TextBoardElement.Alignment.LeftTop); CommandQueue.Queue(new AddToBoardCommand(hello, playerName)); UpdateColor(); }