public void SetAnchorText(SpriteText.Anchor_Pos anchor) { this.spriteText.SetAnchor(anchor); this.spriteTextShadow.SetAnchor(anchor); switch (anchor) { case SpriteText.Anchor_Pos.Upper_Left: case SpriteText.Anchor_Pos.Middle_Left: case SpriteText.Anchor_Pos.Lower_Left: this.spriteText.SetAlignment(SpriteText.Alignment_Type.Left); this.spriteTextShadow.SetAlignment(SpriteText.Alignment_Type.Left); break; case SpriteText.Anchor_Pos.Upper_Center: case SpriteText.Anchor_Pos.Middle_Center: case SpriteText.Anchor_Pos.Lower_Center: this.spriteText.SetAlignment(SpriteText.Alignment_Type.Center); this.spriteTextShadow.SetAlignment(SpriteText.Alignment_Type.Center); break; case SpriteText.Anchor_Pos.Upper_Right: case SpriteText.Anchor_Pos.Middle_Right: case SpriteText.Anchor_Pos.Lower_Right: this.spriteText.SetAlignment(SpriteText.Alignment_Type.Right); this.spriteTextShadow.SetAlignment(SpriteText.Alignment_Type.Right); break; } }
public static GameObject GetEZGUI_SPRITETEXT(string ObjectName, string _ObjectPath, int PosX, int PosY, int PosZ, SpriteText.Anchor_Pos Anchor, SpriteText.Alignment_Type Allignment, string Text, HUD_BASE_POS BasePosType) { GameObject CurObject = GetGameObject(ObjectName, _ObjectPath); if (CurObject == null) { return(null); } CurObject.AddComponent <EzGui_SpriteText>(); CurObject.GetComponent <EzGui_SpriteText>().Create(); CurObject.GetComponent <EzGui_SpriteText>().SetName(ObjectName); CurObject.GetComponent <EzGui_SpriteText>().SetEZGUI(CurObject.GetComponent <SpriteText>()); CurObject.GetComponent <EzGui_SpriteText>().SetBasePos(BasePosType); CurObject.GetComponent <EzGui_SpriteText>().SetPos((float)PosX, (float)PosY, (float)PosZ); CurObject.GetComponent <EzGui_SpriteText>().SetAnchor(Anchor); CurObject.GetComponent <EzGui_SpriteText>().SetAllignment(Allignment); CurObject.GetComponent <EzGui_SpriteText>().SetText(Text); CurObject.GetComponent <EzGui_SpriteText>().SetColor(Color.black); CurObject.GetComponent <EzGui_SpriteText>().SetValid(false); CurObject.name = ObjectName; CurObject.layer = LayerMask.NameToLayer("GUI"); CurObject.transform.parent = Main.inst.GetResourceObject_EZGUISPRITETEXT().transform; return(CurObject); }
public virtual void SetColumnRect(int index, Rect a_rcRect, SpriteText.Anchor_Pos anchor) { if (0 <= index && ListBox.MAX_COLUMN_NUM > index) { this.columnRect[index] = a_rcRect; } this.columnTextAnchor[index] = anchor; }
public virtual void SetColumnAlignment(int index, SpriteText.Anchor_Pos anchor) { if (0 > index && ListBox.MAX_COLUMN_NUM <= index) { return; } this.columnTextAnchor[index] = anchor; }
public virtual void SetColumnRect(int index, Rect a_rcRect, SpriteText.Anchor_Pos anchor, float a_fFonSize) { if (0 <= index && ListBox.MAX_COLUMN_NUM > index) { this.columnRect[index] = a_rcRect; } this.columnTextAnchor[index] = anchor; this.m_faFontSize[index] = a_fFonSize; }
public virtual void Mirror(SpriteText s) { this.text = s.text; this.font = s.font; this.offsetZ = s.offsetZ; this.characterSize = s.characterSize; this.characterSpacing = s.characterSpacing; this.lineSpacing = s.lineSpacing; this.anchor = s.anchor; this.alignment = s.alignment; this.tabSize = s.tabSize; this.color = s.color; this.maxWidth = s.maxWidth; this.pixelPerfect = s.pixelPerfect; this.renderCamera = s.renderCamera; this.hideAtStart = s.hideAtStart; }
public UISimpleText(Object uISimpleTextPreb, Transform parent, Vector3 offset, string textStr, float characterSize, Color color, SpriteText.Anchor_Pos anchor) { // //get the position of the parent // Vector3 parentPosition = parent.position; // // GameObject spriteTextObj = (GameObject) GameObject.Instantiate(uISimpleTextPreb,new Vector3(0,0,0),Quaternion.identity); // _simpleText = spriteTextObj.GetComponent<SpriteText>(); // _simpleText.transform.parent = parent; // // //set the offset // _simpleText.transform.position = new Vector3(parent.position.x + offset.x,parent.position.y + offset.y,parent.position.z + offset.z); // // _simpleText.Text = textStr; // _simpleText.SetCharacterSize(characterSize); // _simpleText.Color = color; // _simpleText.Anchor = anchor; }
/* public Vector3 pos; public Vector3 scale; public Quaternion rot; */ // Mirrors the specified SpriteText's settings public virtual void Mirror(SpriteText s) { text = s.text; font = s.font; offsetZ = s.offsetZ; characterSize = s.characterSize; characterSpacing = s.characterSpacing; lineSpacing = s.lineSpacing; anchor = s.anchor; alignment = s.alignment; tabSize = s.tabSize; color = s.color; maxWidth = s.maxWidth; pixelPerfect = s.pixelPerfect; renderCamera = s.renderCamera; hideAtStart = s.hideAtStart; }
private static void Tooltip_Base(Form cForm, Tooltip_Dlg.Tooltip_Text_Info[] saTextInfo, int nRank, G_ID eWidowID, int Valid_Weapons) { Tooltip_Dlg.Create_Texture item = default(Tooltip_Dlg.Create_Texture); List <Tooltip_Dlg.Create_Texture> list = new List <Tooltip_Dlg.Create_Texture>(); float num = 230f; float num2 = 0f; float num3 = 0f; Rect rcRect = default(Rect); num2 += 13f; int i = 0; while (i < saTextInfo.Length) { string strName = "ItemInfo_" + i; float num4; if (saTextInfo[i].m_nTextureType == 3) { item.m_fY = num2 + saTextInfo[i].m_fY; item.m_nRank = nRank; num4 = Tooltip_Dlg.F_STAR_HEIGHT + saTextInfo[i].m_fY; goto IL_2A9; } if (saTextInfo[i].m_nTextureType == 4) { item.m_fY = num2 + saTextInfo[i].m_fY; num4 = Tooltip_Dlg.F_WEAPON_HEIGHT + saTextInfo[i].m_fY; goto IL_2A9; } if (saTextInfo[i].m_nTextureType == 1) { item.m_fY = num2 + 8f - Tooltip_Dlg.F_LINE_TEXTURE_HEIGHT; num4 = 16f + Tooltip_Dlg.F_LINE_TEXTURE_HEIGHT; goto IL_2A9; } if (saTextInfo[i].m_nTextureType == 2) { item.m_fY = num2 + 8f - Tooltip_Dlg.F_LINE_TEXTURE_HEIGHT; num4 = 16f + Tooltip_Dlg.F_LINE_TEXTURE_HEIGHT; goto IL_2A9; } if (saTextInfo[i].m_strText != null) { if (i == 0) { num4 = 22f; } else if (i == saTextInfo.Length - 1) { int num5 = 0; if (i == saTextInfo.Length - 1) { num5 = saTextInfo[i].m_strText.Length / 20; num5++; } num4 = 20f * (float)num5; } else { num4 = 20f; } string strText = saTextInfo[i].m_strText; rcRect.x = ((i != 0) ? 13f : 0f); rcRect.y = num2; rcRect.width = ((i != 0) ? (num - 26f) : num); rcRect.height = num4; SpriteText.Anchor_Pos ePso = SpriteText.Anchor_Pos.Upper_Left; Tooltip_Dlg.s_laText = Tooltip_Dlg.Create_Text(cForm, strName, strText, rcRect, saTextInfo[i].m_fFontSize, ePso, false, NrTSingleton <CTextParser> .Instance.GetTextColor(saTextInfo[i].m_strTextColorCode)); item.m_laText = Tooltip_Dlg.s_laText; if (num3 < Tooltip_Dlg.s_laText.spriteText.TotalWidth) { num3 = Tooltip_Dlg.s_laText.spriteText.TotalWidth; } num4 = Tooltip_Dlg.s_laText.spriteText.TotalHeight + 5f; goto IL_2A9; } IL_2DD: i++; continue; IL_2A9: item.m_nTextureType = saTextInfo[i].m_nTextureType; item.m_eAnchor = saTextInfo[i].m_eAnchor; list.Add(item); num2 += num4; goto IL_2DD; } num2 += 13f; if (num3 < Tooltip_Dlg.F_STAR_MAX_WIDTH) { num3 = Tooltip_Dlg.F_STAR_MAX_WIDTH + 26f; } float num6 = num3 + 26f; cForm.SetSize((int)num6, (int)num2); for (int j = 0; j < list.Count; j++) { switch (list[j].m_nTextureType) { case 0: if (list[j].m_eAnchor == SpriteText.Anchor_Pos.Middle_Center) { float x = num6 / 2f - list[j].m_laText.spriteText.TotalWidth / 2f; list[j].m_laText.SetLocation(x, list[j].m_laText.GetLocationY()); } break; case 1: Tooltip_Dlg.Draw_Line(cForm, list[j].m_fY, num6, false); break; case 2: Tooltip_Dlg.Draw_Line(cForm, list[j].m_fY, num6, true); break; case 3: Tooltip_Dlg.Draw_Star(cForm, list[j].m_fY, num6, list[j].m_nRank); break; case 4: Tooltip_Dlg.Draw_Weapon(cForm, list[j].m_fY, num6, Valid_Weapons); break; } } }
private static Label Create_Text(Form cForm, string strName, string strText, Rect rcRect, float fFontSize, SpriteText.Anchor_Pos ePso, bool bMultiLine, string strColor) { Label label = Label.Create(strName, Vector3.zero); label.width = rcRect.width; label.height = rcRect.height; label.CreateSpriteText(); label.MaxWidth = Mathf.Min(rcRect.width, 300f); label.MultiLine = true; label.ColorText = strColor; label.SetCharacterSize(fFontSize); SpriteRoot.ANCHOR_METHOD anchor; SpriteText.Alignment_Type alignment; switch (ePso) { case SpriteText.Anchor_Pos.Upper_Left: case SpriteText.Anchor_Pos.Middle_Left: case SpriteText.Anchor_Pos.Lower_Left: anchor = SpriteRoot.ANCHOR_METHOD.MIDDLE_LEFT; alignment = SpriteText.Alignment_Type.Left; break; case SpriteText.Anchor_Pos.Upper_Center: case SpriteText.Anchor_Pos.Middle_Center: case SpriteText.Anchor_Pos.Lower_Center: anchor = SpriteRoot.ANCHOR_METHOD.MIDDLE_CENTER; alignment = SpriteText.Alignment_Type.Center; break; case SpriteText.Anchor_Pos.Upper_Right: case SpriteText.Anchor_Pos.Middle_Right: case SpriteText.Anchor_Pos.Lower_Right: anchor = SpriteRoot.ANCHOR_METHOD.MIDDLE_RIGHT; alignment = SpriteText.Alignment_Type.Right; break; default: anchor = SpriteRoot.ANCHOR_METHOD.MIDDLE_LEFT; alignment = SpriteText.Alignment_Type.Left; break; } label.SetAnchor(anchor); label.SetAnchor(ePso); label.SetAlignment(alignment); label.gameObject.renderer.enabled = false; label.gameObject.layer = GUICamera.UILayer; label.Text = strText; cForm.AddDictionaryControl(strName, label); cForm.InteractivePanel.MakeChild(label.gameObject); label.SetLocation(rcRect.x, rcRect.y, -0.001f); return(label); }
/* public Vector3 pos; public Vector3 scale; public Quaternion rot; */ // Mirrors the specified SpriteText's settings public virtual void Mirror(SpriteText s) { text = s.text; font = s.font; offsetZ = s.offsetZ; characterSize = s.characterSize; characterSpacing = s.characterSpacing; lineSpacing = s.lineSpacing; anchor = s.anchor; alignment = s.alignment; tabSize = s.tabSize; color = s.color; maxWidth = s.maxWidth; pixelPerfect = s.pixelPerfect; renderCamera = s.renderCamera; #if SCREEN_SPACE_POSITIONING positionInScreenSpace = s.positionInScreenSpace; screenPos = s.screenPos; relativeToScreen.Copy(s.relativeToScreen); #endif hideAtStart = s.hideAtStart; }
public void SetMessageAnchor(SpriteText.Anchor_Pos _Anchor) { this.m_LbNote.SetAnchorText(_Anchor); }
public override void SetColumnRect(int index, int x, int y, int width, int height, SpriteText.Anchor_Pos anchor, float a_fFonSize) { if (0 <= index && ListBox.MAX_COLUMN_NUM > index) { this.columnRect[index] = new Rect((float)x, (float)y, (float)width, (float)height); } this.columnTextAnchor[index] = anchor; this.m_faFontSize[index] = a_fFonSize; this._ListBox.SetColumnRect(index, x, y, width, height, anchor, a_fFonSize); }
public static TextField TextField(string name, string str, bool multiLine, float maxWidth, float height, float fontSize, SpriteText.Font_Effect fontEffect, SpriteText.Anchor_Pos anchor, string fontColor) { GameObject gameObject = new GameObject(name); TextField textField = gameObject.AddComponent <TextField>(); if (null == textField) { return(null); } textField.customCollider = false; textField.gameObject.layer = GUICamera.UILayer; textField.width = maxWidth; textField.height = height; textField.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); textField.includeTextInAutoCollider = false; textField.DefaultTextAnchor = anchor; if (anchor == SpriteText.Anchor_Pos.Upper_Left || (anchor == SpriteText.Anchor_Pos.Middle_Left | anchor == SpriteText.Anchor_Pos.Lower_Left)) { textField.DefaultTextAlignment = SpriteText.Alignment_Type.Left; } else if (anchor == SpriteText.Anchor_Pos.Upper_Center || (anchor == SpriteText.Anchor_Pos.Middle_Center | anchor == SpriteText.Anchor_Pos.Lower_Center)) { textField.DefaultTextAlignment = SpriteText.Alignment_Type.Center; } if (anchor == SpriteText.Anchor_Pos.Upper_Right || anchor == SpriteText.Anchor_Pos.Middle_Right || anchor == SpriteText.Anchor_Pos.Lower_Right) { textField.DefaultTextAlignment = SpriteText.Alignment_Type.Right; } textField.fontSize = fontSize; textField.multiLine = multiLine; textField.maxWidth = maxWidth; UIBaseInfoLoader uIBaseInfoLoader = NrTSingleton <UIImageInfoManager> .Instance.FindUIImageDictionary("Com_I_Transparent"); textField.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width, uIBaseInfoLoader.UVs.height); textField.m_bPattern = uIBaseInfoLoader.Pattern; Material material = (Material)CResources.Load(uIBaseInfoLoader.Material); textField.Setup(maxWidth, height, material); textField.States[0].spriteFrames = new CSpriteFrame[1]; textField.States[0].spriteFrames[0] = new CSpriteFrame(); Rect rect = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.x), 1f - UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.width), UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.height)); textField.States[0].spriteFrames[0].uvs = rect; textField.SetUVs(rect); textField.autoResize = false; textField.anchor = SpriteRoot.ANCHOR_METHOD.UPPER_LEFT; textField.States[1].spriteFrames = new CSpriteFrame[1]; textField.States[1].spriteFrames[0] = new CSpriteFrame(); Rect uvs = new Rect(0f, 0f, 1f, 1f); textField.States[1].spriteFrames[0].uvs = uvs; textField.CreateSpriteText(); textField.ColorText = fontColor; textField.SetCharacterSize(fontSize); textField.SetFontEffect(fontEffect); textField.Text = str; textField.Start(); return(textField); }
public void SetAnchor(SpriteText.Anchor_Pos ObjectAnchor) { EZGUI_SpriteTextFront.SetAnchor(ObjectAnchor); EZGUI_SpriteTextBack.SetAnchor(ObjectAnchor); }
public static Label Label(string name, string str, bool multiLine, float maxWidth, float height, float fontSize, SpriteText.Font_Effect fontEffect, SpriteText.Anchor_Pos anchor, string fontColor) { GameObject gameObject = new GameObject(name); Label label = gameObject.AddComponent <Label>(); label.customCollider = true; label.gameObject.layer = GUICamera.UILayer; label.width = maxWidth; label.height = height; label.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); label.includeTextInAutoCollider = false; label.DefaultTextAnchor = anchor; if (anchor == SpriteText.Anchor_Pos.Upper_Left || (anchor == SpriteText.Anchor_Pos.Middle_Left | anchor == SpriteText.Anchor_Pos.Lower_Left)) { label.DefaultTextAlignment = SpriteText.Alignment_Type.Left; } else if (anchor == SpriteText.Anchor_Pos.Upper_Center || (anchor == SpriteText.Anchor_Pos.Middle_Center | anchor == SpriteText.Anchor_Pos.Lower_Center)) { label.DefaultTextAlignment = SpriteText.Alignment_Type.Center; } if (anchor == SpriteText.Anchor_Pos.Upper_Right || anchor == SpriteText.Anchor_Pos.Middle_Right || anchor == SpriteText.Anchor_Pos.Lower_Right) { label.DefaultTextAlignment = SpriteText.Alignment_Type.Right; } label.fontSize = fontSize; label.multiLine = multiLine; label.maxWidth = maxWidth; label.CreateSpriteText(); label.ColorText = fontColor; label.SetCharacterSize(fontSize); label.SetFontEffect(fontEffect); label.Text = str; label.BackGroundHide(true); return(label); }
public static ScrollLabel ScrollLabel(string name, string str, bool multiLine, float maxWidth, float height, float fontSize, SpriteText.Font_Effect fontEffect, SpriteText.Anchor_Pos anchor, string fontColor) { GameObject gameObject = new GameObject(name); ScrollLabel scrollLabel = gameObject.AddComponent <ScrollLabel>(); scrollLabel.gameObject.layer = GUICamera.UILayer; scrollLabel.viewableArea = new Vector2(maxWidth, height); scrollLabel.alignment = UIScrollList.ALIGNMENT.LEFT_TOP; scrollLabel.orientation = UIScrollList.ORIENTATION.VERTICAL; scrollLabel.AnchorPos = anchor; scrollLabel.ScrollListTo(0f); if (anchor == SpriteText.Anchor_Pos.Upper_Left || (anchor == SpriteText.Anchor_Pos.Middle_Left | anchor == SpriteText.Anchor_Pos.Lower_Left)) { scrollLabel.AlignmentType = SpriteText.Alignment_Type.Left; } else if (anchor == SpriteText.Anchor_Pos.Upper_Center || (anchor == SpriteText.Anchor_Pos.Middle_Center | anchor == SpriteText.Anchor_Pos.Lower_Center)) { scrollLabel.AlignmentType = SpriteText.Alignment_Type.Center; } if (anchor == SpriteText.Anchor_Pos.Upper_Right || anchor == SpriteText.Anchor_Pos.Middle_Right || anchor == SpriteText.Anchor_Pos.Lower_Right) { scrollLabel.AlignmentType = SpriteText.Alignment_Type.Right; } scrollLabel.FontSize = (int)fontSize; scrollLabel.touchScroll = true; scrollLabel.CreateBoxCollider(); scrollLabel.ColorText = fontColor; scrollLabel.FontEffect = fontEffect; scrollLabel.SetScrollLabel(str); return(scrollLabel); }
public virtual void SetColumnRect(int index, int x, int y, int width, int height, SpriteText.Anchor_Pos anchor, float a_fFonSize, bool a_bMultiLine) { if (0 <= index && ListBox.MAX_COLUMN_NUM > index) { this.columnRect[index] = new Rect((float)x, (float)y, (float)width, (float)height); } this.columnTextAnchor[index] = anchor; this.m_faFontSize[index] = a_fFonSize; this.bUseMultiLine[index] = a_bMultiLine; }
public virtual void SetColumnRect(int index, int x, int y, int width, int height, SpriteText.Anchor_Pos anchor) { if (0 <= index && ListBox.MAX_COLUMN_NUM > index) { this.columnRect[index] = new Rect((float)x, (float)y, (float)width, (float)height); } this.columnTextAnchor[index] = anchor; }
// set the anchor public void SetAnchor(SpriteText.Anchor_Pos anchor) { _simpleText.Anchor = anchor; }
public static Label Label(string name, string str, bool multiLine, float maxWidth, float fontSize, SpriteText.Font_Effect fontEffect, SpriteText.Anchor_Pos anchor, SpriteText.Alignment_Type alignment, Color color) { Label result; using (new ScopeProfile("UICreateControl - Label")) { GameObject gameObject = new GameObject(name); Label label = gameObject.AddComponent <Label>(); label.Setup(maxWidth, fontSize); label.gameObject.layer = GUICamera.UILayer; label.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); label.includeTextInAutoCollider = false; label.DefaultTextAnchor = anchor; label.DefaultTextAlignment = alignment; label.fontSize = fontSize; label.multiLine = multiLine; label.maxWidth = maxWidth; label.color = color; label.CreateSpriteText(); if (multiLine) { label.spriteText.useWhiteSpace = false; label.spriteTextShadow.useWhiteSpace = false; } label.SetCharacterSize(fontSize); label.SetFontEffect(fontEffect); label.Text = str; label.BackGroundHide(true); label.Start(); BoxCollider boxCollider = (BoxCollider)label.GetComponent(typeof(BoxCollider)); if (null != boxCollider) { UnityEngine.Object.Destroy(boxCollider); } result = label; } return(result); }