private void ShowError(string errorMessage) { mFileErrorWindow.Showing = true; ITextGuiElement errorText = mFileErrorWindow.SelectSingleElement <ITextGuiElement>("MainFrame/ErrorFrame/ErrorMessage"); errorText.Text = errorMessage; }
private GuiController SetupNametag(string name, GameObject displayObject) { GuiController nametag = new GuiController(GameFacade.Instance.RetrieveMediator <RuntimeGuiManager>(), NAMETAG_GUI_PATH); Transform headTransform = GameObjectUtility.GetNamedChildRecursive("Head", displayObject).transform; nametag.Manager.SetTopLevelPosition ( nametag.MainGui, new FollowWorldSpaceObject ( GameFacade.Instance.RetrieveMediator <FashionCameraMediator>().Camera, headTransform, GuiAnchor.CenterCenter, Vector2.zero, new Vector3(0.0f, 0.3f, 0.0f) // TODO: Hard coded value ) ); ITextGuiElement nameElement = nametag.MainGui.SelectSingleElement <ITextGuiElement>("**/NameLabel"); nameElement.Text = String.Format(nameElement.Text, name); nametag.MainGui.Showing = false; return(nametag); }
public StationWorker(string name, GameObject displayObject, HeadController headController, BodyController bodyController) : base(name, displayObject, headController, bodyController) { mNametag = new GuiController(GameFacade.Instance.RetrieveMediator <RuntimeGuiManager>(), NAMETAG_GUI_PATH); mNametag.Manager.SetTopLevelPosition ( mNametag.MainGui, new FollowWorldSpaceObject ( GameFacade.Instance.RetrieveMediator <FashionCameraMediator>().Camera, displayObject.transform, GuiAnchor.CenterCenter, Vector2.zero, Vector3.up * FashionModel.APPROX_AVATAR_HEIGHT * 1.1f // TODO: Hard coded value ) ); ITextGuiElement nameElement = mNametag.MainGui.SelectSingleElement <ITextGuiElement>("**/NameLabel"); nameElement.Text = String.Format(nameElement.Text, name); mNametag.MainGui.Showing = false; }
public Vector2 GetSize(IGuiElement element) { if (element == null) { throw new ArgumentNullException("element"); } if (!(element is ITextGuiElement)) { throw new ArgumentException("ExpandText only works on ITextGuiElements", "element"); } if (element.Style == null) { throw new Exception("ExpandText does not work with the built in unity style"); } ITextGuiElement textElement = (ITextGuiElement)element; UnityEngine.GUIStyle unityStyle = textElement.Style.GenerateUnityGuiStyle(); unityStyle.wordWrap = false; GUIContent textContent = new GUIContent(textElement.Text); Vector2 size = unityStyle.CalcSize(textContent); if (size.x > mLineWrapWidth) { size.x = mLineWrapWidth; unityStyle.wordWrap = true; size.y = unityStyle.CalcHeight(textContent, mLineWrapWidth); } size.x += textElement.Style.InternalMargins.Left + textElement.Style.InternalMargins.Right; size.y += textElement.Style.InternalMargins.Top + textElement.Style.InternalMargins.Bottom; return(size); }