private void initializePlayerUIs() { //hack /*GameData.PlayerData.Instance[0].Name = "Gwenn"; * GameData.PlayerData.Instance[1].Name = "Aurel"; * GameData.PlayerData.Instance[2].Name = "Jerom"; * GameData.PlayerData.Instance[3].Name = "Bastien";*/ _miniUIs = new List <SmallPlayerUI>(); SmallPlayerUI playerUI = new SmallPlayerUI(_buttonTexture, new Vector2(50f, 50f), 0); _miniUIs.Add(playerUI); playerUI = new SmallPlayerUI(_buttonTexture, new Vector2(200f, 50f), 1); _miniUIs.Add(playerUI); playerUI = new SmallPlayerUI(_buttonTexture, new Vector2(400f, 50f), 2); _miniUIs.Add(playerUI); playerUI = new SmallPlayerUI(_buttonTexture, new Vector2(600f, 50f), 3); _miniUIs.Add(playerUI); //now that the font i s;oaded we can compute the size of each UI foreach (SmallPlayerUI ui in _miniUIs) { ui.initializeArea(MyGame.BasicFontSmall); } }
public TargetedDialogBox(SmallPlayerUI target, UIElements.SimpleButton button, float distanceFromMessage, string message, Rectangle messageArea, UIElements.StretchableImage back) : base(button, message, messageArea, back) { _target = target; _distFromMes = distanceFromMessage; followTarget(); }
/// <summary> /// /// </summary> /// <param name="dt">time since last frame in seconds</param> private void updatePlayersUI(float dt) { ReadOnlyTouchPointCollection touches = MyGame.TouchTarget.GetState(); foreach (TouchPoint touch in touches) { checkForUIDrag(touch, dt); if (touch.IsTagRecognized) { if (!MyGame.MapArea.Contains((int)touch.X, (int)touch.Y)) { int owner = getOwnerForTag(touch.Tag.Value); _miniUIs[owner].Position = Utils.touchPointToV2(touch); } } } for (int i = 0; i < _miniUIs.Count; ++i) { SmallPlayerUI ui = _miniUIs[i]; ui.update(dt); } }