public static Emoticon Emoticon(string name, float emoticonWidth, float emoticonHeight, UIBaseInfoLoader baseInfoLoder, float[] delays) { GameObject gameObject = new GameObject(name); Emoticon emoticon = gameObject.AddComponent <Emoticon>(); emoticon.SetDelay(delays); emoticon.SetUseBoxCollider(false); emoticon.gameObject.layer = GUICamera.UILayer; emoticon.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); emoticon.AutoAnimatorStop = false; if (baseInfoLoder != null) { emoticon.SetSpriteTile(baseInfoLoder.Tile, baseInfoLoder.UVs.width / (float)baseInfoLoder.ButtonCount, baseInfoLoder.UVs.height); Material material = (Material)CResources.Load(baseInfoLoder.Material); emoticon.Setup(emoticonWidth, emoticonHeight, material); float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, baseInfoLoder.UVs.width / (float)baseInfoLoder.ButtonCount); Rect uvs = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, baseInfoLoder.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, baseInfoLoder.UVs.y + baseInfoLoder.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, baseInfoLoder.UVs.height)); for (int i = 0; i < 3; i++) { emoticon.States[i].spriteFrames = new CSpriteFrame[1]; emoticon.States[i].spriteFrames[0] = new CSpriteFrame(); uvs.x += pixelToUVsWidth; emoticon.States[i].spriteFrames[0].uvs = uvs; emoticon.animations[i] = new UVAnimation(); emoticon.animations[i].SetAnim(emoticon.States[i], i); } emoticon.autoResize = false; } return(emoticon); }
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 static UIRadioBtn RadioBtn(Form form, string name, string imageKey, float width, float height) { UIBaseInfoLoader uIBaseInfoLoader = UIBaseFileManager.FindUIImageDictionary(name, imageKey); if (uIBaseInfoLoader == null) { return(null); } GameObject gameObject = new GameObject(name); UIRadioBtn uIRadioBtn = gameObject.AddComponent <UIRadioBtn>(); uIRadioBtn.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); uIRadioBtn.gameObject.layer = GUICamera.UILayer; uIRadioBtn.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount, uIBaseInfoLoader.UVs.height); uIRadioBtn.m_bPattern = uIBaseInfoLoader.Pattern; Material material = (Material)CResources.Load(uIBaseInfoLoader.Material); uIRadioBtn.Setup(width, height, material); float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount); Rect uvs = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.height)); for (int i = 0; i <= (int)(uIBaseInfoLoader.ButtonCount - 1); i++) { uIRadioBtn.States[i].spriteFrames = new CSpriteFrame[1]; uIRadioBtn.States[i].spriteFrames[0] = new CSpriteFrame(); uvs.x += pixelToUVsWidth; uIRadioBtn.States[i].spriteFrames[0].uvs = uvs; uIRadioBtn.animations[i].SetAnim(uIRadioBtn.States[i], i); } uIRadioBtn.autoResize = false; uIRadioBtn.useParentForGrouping = false; uIRadioBtn.SetGroup(100 * form.WindowID); form.AddDictionaryControl(name, uIRadioBtn); form.InteractivePanel.MakeChild(uIRadioBtn.gameObject); uIRadioBtn.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); uIRadioBtn.gameObject.layer = GUICamera.UILayer; UIButton uIButton = UICreateControl.Button(name + "OverButton", imageKey + "_over", uIRadioBtn.width, uIRadioBtn.height); if (null != uIButton) { uIButton.Start(); BoxCollider component = uIButton.gameObject.GetComponent <BoxCollider>(); if (null != component) { UnityEngine.Object.Destroy(component); } form.InteractivePanel.MakeChild(uIButton.gameObject); uIRadioBtn.layers = new SpriteRoot[1]; for (int j = 0; j < 1; j++) { uIRadioBtn.layers[j] = uIButton; uIButton.transform.localPosition = uIRadioBtn.GetLocation(); } } uIRadioBtn.Start(); return(uIRadioBtn); }
public static UIButton Button(string name, string imageKey, float width, float height) { UIBaseInfoLoader uIBaseInfoLoader = UIBaseFileManager.FindUIImageDictionary(name, imageKey); if (uIBaseInfoLoader == null) { return(null); } GameObject gameObject = new GameObject(name); UIButton uIButton = gameObject.AddComponent <UIButton>(); uIButton.gameObject.layer = GUICamera.UILayer; uIButton.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); uIButton.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount, uIBaseInfoLoader.UVs.height); Material material = (Material)CResources.Load(uIBaseInfoLoader.Material); uIButton.Setup(width, height, material); float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount); Rect rect = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.height)); Rect uvs = new Rect(rect); uvs.x += pixelToUVsWidth; for (int i = 0; i < (int)uIBaseInfoLoader.ButtonCount; i++) { uIButton.States[i].spriteFrames = new CSpriteFrame[1]; uIButton.States[i].spriteFrames[0] = new CSpriteFrame(); rect.x += pixelToUVsWidth; if ((int)uIBaseInfoLoader.ButtonCount <= i) { uIButton.States[i].spriteFrames[0].uvs = uvs; } else { uIButton.States[i].spriteFrames[0].uvs = rect; } uIButton.animations[i].SetAnim(uIButton.States[i], i); } uIButton.autoResize = false; uIButton.Start(); return(uIButton); }
public static Emoticon EmoticonCharChat(string name, float emoticonWidth, float emoticonHeight, string emoticonKey) { GameObject gameObject = new GameObject(name); Emoticon emoticon = gameObject.AddComponent <Emoticon>(); emoticon.SetUseBoxCollider(false); emoticon.gameObject.layer = GUICamera.UILayer; emoticon.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); emoticon.AutoAnimatorStop = false; UIEmoticonInfo uIEmoticonInfo = NrTSingleton <UIEmoticonManager> .Instance.FindUIEmoticonDictionary(emoticonKey); if (uIEmoticonInfo != null) { emoticon.SetDelay(uIEmoticonInfo.delays); UIBaseInfoLoader infoLoader = uIEmoticonInfo.infoLoader; if (infoLoader == null) { return(emoticon); } emoticon.SetSpriteTile(infoLoader.Tile, infoLoader.UVs.width / (float)infoLoader.ButtonCount, infoLoader.UVs.height); Material material = (Material)CResources.Load(infoLoader.Material); emoticon.Setup(emoticonWidth, emoticonHeight, material); float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, infoLoader.UVs.width / (float)infoLoader.ButtonCount); Rect uvs = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, infoLoader.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, infoLoader.UVs.y + infoLoader.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, infoLoader.UVs.height)); for (int i = 0; i < 3; i++) { emoticon.States[i].spriteFrames = new CSpriteFrame[1]; emoticon.States[i].spriteFrames[0] = new CSpriteFrame(); uvs.x += pixelToUVsWidth; emoticon.States[i].spriteFrames[0].uvs = uvs; emoticon.animations[i].SetAnim(emoticon.States[i], i); } emoticon.autoResize = false; } return(emoticon); }
public override void Add(ListItem item) { GameObject gameObject = new GameObject("DropDownListItem" + base.Count.ToString()); UIListItemContainer uIListItemContainer = gameObject.AddComponent <UIListItemContainer>(); uIListItemContainer.Data = item; uIListItemContainer.isDraggable = true; uIListItemContainer.AutoFindOuterEdges = false; string backButtonName = UIScrollList.backButtonName; UIButton uIButton; if (string.Empty != this.selectStyle) { uIButton = UICreateControl.Button(backButtonName, this.selectStyle, this.viewableArea.x, this.lineHeight); } else { uIButton = UICreateControl.Button(backButtonName, "Com_B_ListBtnH", this.viewableArea.x, this.lineHeight); } uIButton.EffectAni = false; uIButton.IsListButton = true; uIButton.allwaysPlayAnim = true; uIListItemContainer.MakeChild(uIButton.gameObject); uIButton.gameObject.transform.localPosition = Vector3.zero; float num = this._offsetX; float num2 = -0.02f; for (int i = 0; i < this.currentColumnNum; i++) { string name = this.columnTitle + i.ToString(); GameObject gameObject2 = new GameObject(name); num2 -= 0.01f; if (item.GetType(i) == ListItem.TYPE.IMAGE) { DrawTexture drawTexture = gameObject2.AddComponent <DrawTexture>(); drawTexture.gameObject.layer = GUICamera.UILayer; if (item.ColumnKey[i] is ITEM) { drawTexture.c_cItemTooltip = (ITEM)item.ColumnKey[i]; } else if (item.ColumnKey[i] is long) { drawTexture.nItemUniqueTooltip = (int)item.ColumnKey[i]; } if (this.useColumnRect) { drawTexture.width = this.columnRect[i].width; drawTexture.height = this.columnRect[i].height; } else { drawTexture.width = (float)this.columnWidth[i]; drawTexture.height = this.lineHeight; } drawTexture.autoResize = false; drawTexture.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); UIBaseInfoLoader columnImageInfo = item.GetColumnImageInfo(i); if (columnImageInfo != null && string.Empty != columnImageInfo.Material) { drawTexture.BaseInfoLoderImage = columnImageInfo; } else { drawTexture.SetTextureKey(item.GetColumnImageStr(i)); } uIListItemContainer.MakeChild(drawTexture.gameObject); if (this.useColumnRect) { drawTexture.gameObject.transform.localPosition = new Vector3(this.columnRect[i].x, -this.columnRect[i].y, num2); BoxCollider boxCollider = (BoxCollider)drawTexture.gameObject.AddComponent(typeof(BoxCollider)); boxCollider.size = new Vector3(this.columnRect[i].width, this.columnRect[i].height, 0f); boxCollider.center = new Vector3(this.columnRect[i].x / 2f, -this.columnRect[i].y / 2f, 0f); } else { drawTexture.gameObject.transform.localPosition = new Vector3(num, 0f, -0.02f); num += (float)this.columnWidth[i]; BoxCollider boxCollider2 = (BoxCollider)drawTexture.gameObject.AddComponent(typeof(BoxCollider)); boxCollider2.size = new Vector3((float)this.columnWidth[i], this.lineHeight, 0f); boxCollider2.center = new Vector3((float)(this.columnWidth[i] / 2), -this.lineHeight / 2f, num2); } } else if (item.GetType(i) == ListItem.TYPE.TEXT) { Label label = gameObject2.AddComponent <Label>(); label.gameObject.layer = GUICamera.UILayer; label.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); label.Data = item.ColumnKey[i]; float num3; float y; if (this.useColumnRect) { label.width = this.columnRect[i].width; label.height = this.columnRect[i].height; num3 = this.columnRect[i].x; y = -1f * this.columnRect[i].y; } else { num3 = num; y = 0f; label.width = (float)this.columnWidth[i]; label.height = this.lineHeight; num += (float)this.columnWidth[i]; } if (this.bUseSpotLabel) { label.MaxWidth = (float)this.columnWidth[i]; label.multiLine = false; } label.Text = item.GetColumnStr(i); if (this.bUseSpotLabel) { label.SPOT = true; } label.SetFontEffect(base.FontEffect); label.BackGroundHide(true); if (this.m_faFontSize[i] > 0f) { label.SetCharacterSize(this.m_faFontSize[i]); } if (label.spriteText) { if (this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Upper_Left || this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Middle_Left || this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Lower_Left) { label.SetAnchor(this.columnTextAnchor[i]); label.SetAlignment(SpriteText.Alignment_Type.Left); if (i == 0) { num3 += 6f; } } else if (this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Upper_Center || this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Middle_Center || this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Lower_Center) { label.SetAnchor(this.columnTextAnchor[i]); label.SetAlignment(SpriteText.Alignment_Type.Center); } else if (this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Upper_Right || this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Middle_Right || this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Lower_Right) { label.SetAnchor(this.columnTextAnchor[i]); label.SetAlignment(SpriteText.Alignment_Type.Right); } } uIListItemContainer.MakeChild(label.gameObject); label.gameObject.transform.localPosition = new Vector3(num3, y, num2); } else if (item.GetType(i) == ListItem.TYPE.BUTTON) { UIBaseInfoLoader uIBaseInfoLoader = NrTSingleton <UIImageInfoManager> .Instance.FindUIImageDictionary(item.GetColumnImageStr(i)); if (uIBaseInfoLoader != null) { UIButton uIButton2 = gameObject2.AddComponent <UIButton>(); uIButton2.EffectAni = false; uIButton2.CreateSpriteText(); uIButton2.gameObject.layer = GUICamera.UILayer; uIButton2.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); uIButton2.SetAnchor(SpriteText.Anchor_Pos.Middle_Center); uIButton2.SetAlignment(SpriteText.Alignment_Type.Center); uIButton2.AddValueChangedDelegate(item.GetColumnDelegate(i)); uIButton2.width = this.columnRect[i].width; uIButton2.height = this.columnRect[i].height; uIButton2.Data = item.ColumnKey[i]; uIButton2.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount, uIBaseInfoLoader.UVs.height); Material material = (Material)CResources.Load(uIBaseInfoLoader.Material); uIButton2.Setup(this.columnRect[i].width, this.columnRect[i].height, material); float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount); Rect rect = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.height)); Rect uvs = new Rect(rect); uvs.x += pixelToUVsWidth; for (int j = 0; j < 4; j++) { uIButton2.States[j].spriteFrames = new CSpriteFrame[1]; uIButton2.States[j].spriteFrames[0] = new CSpriteFrame(); rect.x += pixelToUVsWidth; if ((int)uIBaseInfoLoader.ButtonCount <= j) { uIButton2.States[j].spriteFrames[0].uvs = uvs; } else { uIButton2.States[j].spriteFrames[0].uvs = rect; } uIButton2.animations[j] = new UVAnimation(); uIButton2.animations[j].SetAnim(uIButton2.States[j], j); } uIButton2.autoResize = false; uIButton2.Text = item.GetColumnStr(i); if (this.m_faFontSize[i] > 0f) { uIButton2.spriteText.SetCharacterSize(this.m_faFontSize[i]); } uIButton2.PlayAnim(0, 0); uIListItemContainer.MakeChild(uIButton2.gameObject); uIButton2.gameObject.transform.localPosition = new Vector3(this.columnRect[i].x, -this.columnRect[i].y, num2); } } } uIListItemContainer.transform.position = Vector3.zero; if (null != base.GetItem(this.startIndex)) { base.RemoveItemDonotPositionUpdate(this.startIndex, true); base.InsertItemDonotPosionUpdate(uIListItemContainer, this.startIndex, null, true); } else { base.InsertItemDonotPosionUpdate(uIListItemContainer, this.startIndex, null, true); } this.startIndex++; }
public UIListItemContainer CreateContainer(ListItem item) { GameObject gameObject = new GameObject("ListItem"); UIListItemContainer uIListItemContainer = gameObject.AddComponent <UIListItemContainer>(); uIListItemContainer.Data = item.Key; uIListItemContainer.isDraggable = true; uIListItemContainer.AutoFindOuterEdges = false; string backButtonName = UIScrollList.backButtonName; UIButton uIButton; if (this.orientation == UIScrollList.ORIENTATION.VERTICAL) { if (string.Empty != this.selectStyle) { uIButton = UICreateControl.Button(backButtonName, this.selectStyle, this.viewableArea.x, this.lineHeight); } else { uIButton = UICreateControl.Button(backButtonName, "Com_B_ListBtnH", this.viewableArea.x, this.lineHeight); } } else if (this.orientation == UIScrollList.ORIENTATION.HORIZONTAL) { if (string.Empty != this.selectStyle) { uIButton = UICreateControl.Button(backButtonName, this.selectStyle, this.lineHeight, this.viewableArea.y); } else { uIButton = UICreateControl.Button(backButtonName, "Com_B_ListBtnH", this.lineHeight, this.viewableArea.y); } } else if (string.Empty != this.selectStyle) { uIButton = UICreateControl.Button(backButtonName, this.selectStyle, this.viewableArea.x, this.lineHeight); } else { uIButton = UICreateControl.Button(backButtonName, "Com_B_ListBtnH", this.viewableArea.x, this.lineHeight); } uIButton.EffectAni = false; uIButton.IsListButton = true; uIButton.allwaysPlayAnim = true; uIListItemContainer.MakeChild(uIButton.gameObject); uIButton.gameObject.transform.localPosition = Vector3.zero; float num = this._offsetX; float num2 = 0f; for (int i = 0; i < this.currentColumnNum; i++) { string name = this.columnTitle; num2 -= 0.2f; if (item.GetType(i) == ListItem.TYPE.IMAGE) { GameObject gameObject2 = new GameObject(name); DrawTexture drawTexture = gameObject2.AddComponent <DrawTexture>(); drawTexture.gameObject.layer = GUICamera.UILayer; drawTexture.Data = item.ColumnKey[i]; if (this.useColumnRect) { if (item.ColumnKey[i] is float) { drawTexture.width = (float)item.ColumnKey[i]; drawTexture.height = this.columnRect[i].height; } else { drawTexture.width = this.columnRect[i].width; drawTexture.height = this.columnRect[i].height; } } else { drawTexture.width = (float)this.columnWidth[i]; drawTexture.height = this.lineHeight; } ITEM iTEM = item.ColumnKey[i] as ITEM; if (iTEM != null) { if (iTEM.m_nItemUnique == 70000) { NrTSingleton <FormsManager> .Instance.AttachEffectKey("FX_UI_HEARTS_STONE", drawTexture, new Vector2(drawTexture.width, drawTexture.height)); } int num3 = iTEM.m_nOption[2]; if (string.Compare(MsgHandler.HandleReturn <string>("RankStateString", new object[] { num3 }), "best") == 0) { NrTSingleton <FormsManager> .Instance.AttachEffectKey("FX_WEAPON_GOOD", drawTexture, new Vector2(drawTexture.width, drawTexture.height)); } } if (item.ColumnKey[i] is ITEM) { drawTexture.c_cItemTooltip = (ITEM)item.ColumnKey[i]; } else if (item.ColumnKey[i] is int) { drawTexture.nItemUniqueTooltip = (int)item.ColumnKey[i]; } else if (item.ColumnKey[i] is string) { drawTexture.ToolTip = (string)item.ColumnKey[i]; } if (item.ColumnKey2[i] is ITEM) { drawTexture.c_cItemSecondTooltip = (ITEM)item.ColumnKey2[i]; } drawTexture.autoResize = false; drawTexture.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); UIBaseInfoLoader columnImageInfo = item.GetColumnImageInfo(i); if (columnImageInfo != null && string.Empty != columnImageInfo.Material) { drawTexture.BaseInfoLoderImage = columnImageInfo; } else { drawTexture.SetTextureKey(item.GetColumnImageStr(i)); } float num4 = item.Get_Alpha(i); if (num4 > 0f) { drawTexture.SetAlpha(num4); } uIListItemContainer.MakeChild(drawTexture.gameObject); if (this.useColumnRect) { drawTexture.Setup(drawTexture.width, drawTexture.height); drawTexture.gameObject.transform.localPosition = new Vector3(this.columnRect[i].x, -this.columnRect[i].y, num2); BoxCollider component = drawTexture.gameObject.GetComponent <BoxCollider>(); if (null != component) { component.size = new Vector3(this.columnRect[i].width, this.columnRect[i].height, 0f); component.center = new Vector3(this.columnRect[i].x / 2f, -this.columnRect[i].y / 2f, 0f); } } else { drawTexture.Setup((float)this.columnWidth[i], this.lineHeight); drawTexture.gameObject.transform.localPosition = new Vector3(num, 0f, -0.02f); num += (float)this.columnWidth[i]; BoxCollider component2 = drawTexture.gameObject.GetComponent <BoxCollider>(); if (null != component2) { component2.size = new Vector3((float)this.columnWidth[i], this.lineHeight, 0f); component2.center = new Vector3((float)(this.columnWidth[i] / 2), -this.lineHeight / 2f, num2); } } drawTexture.AddValueChangedDelegate(item.GetColumnDelegate(i)); } else if (item.GetType(i) == ListItem.TYPE.TEXT) { GameObject gameObject3 = new GameObject(name); Label label = gameObject3.AddComponent <Label>(); label.customCollider = true; label.gameObject.layer = GUICamera.UILayer; label.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); label.Data = item.ColumnKey[i]; float x; float y; if (this.useColumnRect) { label.width = this.columnRect[i].width; label.height = this.columnRect[i].height; x = this.columnRect[i].x; y = -1f * this.columnRect[i].y; } else { x = num; y = 0f; label.width = (float)this.columnWidth[i]; label.height = this.lineHeight; num += (float)this.columnWidth[i]; } label.CreateSpriteText(); label.MaxWidth = label.width; if (this.bUseMultiLine[i]) { label.MultiLine = true; } else { label.MultiLine = false; if (this.bUseSpotLabel) { label.SPOT = true; } else { label.SPOT = this.columSpot[i]; } } label.Text = item.GetColumnStr(i); label.SetFontEffect(this.FontEffect); label.BackGroundHide(true); if (this.m_faFontSize[i] > 0f) { label.SetCharacterSize(this.m_faFontSize[i]); } if (label.spriteText) { if (this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Upper_Left || this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Middle_Left || this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Lower_Left) { label.SetAnchor(this.columnTextAnchor[i]); label.SetAlignment(SpriteText.Alignment_Type.Left); } else if (this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Upper_Center || this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Middle_Center || this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Lower_Center) { label.SetAnchor(this.columnTextAnchor[i]); label.SetAlignment(SpriteText.Alignment_Type.Center); } else if (this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Upper_Right || this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Middle_Right || this.columnTextAnchor[i] == SpriteText.Anchor_Pos.Lower_Right) { label.SetAnchor(this.columnTextAnchor[i]); label.SetAlignment(SpriteText.Alignment_Type.Right); } } uIListItemContainer.MakeChild(label.gameObject); label.gameObject.transform.localPosition = new Vector3(x, y, num2); } else if (item.GetType(i) == ListItem.TYPE.BUTTON) { UIBaseInfoLoader uIBaseInfoLoader = NrTSingleton <UIImageInfoManager> .Instance.FindUIImageDictionary(item.GetColumnImageStr(i)); if (uIBaseInfoLoader != null) { GameObject gameObject4 = new GameObject(name); UIButton uIButton2 = gameObject4.AddComponent <UIButton>(); uIButton2.CreateSpriteText(); uIButton2.gameObject.layer = GUICamera.UILayer; uIButton2.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); uIButton2.SetAnchor(SpriteText.Anchor_Pos.Middle_Center); uIButton2.SetAlignment(SpriteText.Alignment_Type.Center); uIButton2.AddValueChangedDelegate(item.GetColumnDelegate(i)); uIButton2.width = this.columnRect[i].width; uIButton2.height = this.columnRect[i].height; uIButton2.Data = item.ColumnKey[i]; uIButton2.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount, uIBaseInfoLoader.UVs.height); Material material = CResources.Load(uIBaseInfoLoader.Material) as Material; uIButton2.Setup(this.columnRect[i].width, this.columnRect[i].height, material); float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount); Rect rect = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.height)); Rect uvs = new Rect(rect); uvs.x += pixelToUVsWidth; if (TsPlatform.IsMobile) { if (uIBaseInfoLoader.ButtonCount == 4) { for (int j = 0; j < 4; j++) { uIButton2.States[j].spriteFrames = new CSpriteFrame[1]; uIButton2.States[j].spriteFrames[0] = new CSpriteFrame(); rect.x += pixelToUVsWidth; uIButton2.States[j].spriteFrames[0].uvs = rect; uIButton2.animations[j].SetAnim(uIButton2.States[j], j); } } else if (uIBaseInfoLoader.ButtonCount == 3) { rect.x += pixelToUVsWidth; uIButton2.States[0].spriteFrames = new CSpriteFrame[1]; uIButton2.States[0].spriteFrames[0] = new CSpriteFrame(); uIButton2.States[0].spriteFrames[0].uvs = uvs; uIButton2.animations[0] = new UVAnimation(); uIButton2.animations[0].SetAnim(uIButton2.States[0], 0); uIButton2.States[1].spriteFrames = new CSpriteFrame[1]; uIButton2.States[1].spriteFrames[0] = new CSpriteFrame(); uIButton2.States[1].spriteFrames[0].uvs = uvs; uIButton2.animations[1].SetAnim(uIButton2.States[1], 1); rect.x += pixelToUVsWidth; uIButton2.States[2].spriteFrames = new CSpriteFrame[1]; uIButton2.States[2].spriteFrames[0] = new CSpriteFrame(); uIButton2.States[2].spriteFrames[0].uvs = rect; uIButton2.animations[2].SetAnim(uIButton2.States[2], 2); rect.x += pixelToUVsWidth; uIButton2.States[3].spriteFrames = new CSpriteFrame[1]; uIButton2.States[3].spriteFrames[0] = new CSpriteFrame(); uIButton2.States[3].spriteFrames[0].uvs = rect; uIButton2.animations[3].SetAnim(uIButton2.States[3], 3); } else if (uIBaseInfoLoader.ButtonCount == 2) { rect.x += pixelToUVsWidth; uIButton2.States[0].spriteFrames = new CSpriteFrame[1]; uIButton2.States[0].spriteFrames[0] = new CSpriteFrame(); uIButton2.States[0].spriteFrames[0].uvs = uvs; uIButton2.animations[0].SetAnim(uIButton2.States[0], 0); rect.x += pixelToUVsWidth; uIButton2.States[1].spriteFrames = new CSpriteFrame[1]; uIButton2.States[1].spriteFrames[0] = new CSpriteFrame(); uIButton2.States[1].spriteFrames[0].uvs = uvs; uIButton2.animations[1].SetAnim(uIButton2.States[1], 1); uIButton2.States[2].spriteFrames = new CSpriteFrame[1]; uIButton2.States[2].spriteFrames[0] = new CSpriteFrame(); uIButton2.States[2].spriteFrames[0].uvs = rect; uIButton2.animations[2].SetAnim(uIButton2.States[2], 2); uIButton2.States[3].spriteFrames = new CSpriteFrame[1]; uIButton2.States[3].spriteFrames[0] = new CSpriteFrame(); uIButton2.States[3].spriteFrames[0].uvs = uvs; uIButton2.animations[3].SetAnim(uIButton2.States[3], 3); } else { for (int k = 0; k < 4; k++) { uIButton2.States[k].spriteFrames = new CSpriteFrame[1]; uIButton2.States[k].spriteFrames[0] = new CSpriteFrame(); rect.x += pixelToUVsWidth; if ((int)uIBaseInfoLoader.ButtonCount <= k) { uIButton2.States[k].spriteFrames[0].uvs = uvs; } else { uIButton2.States[k].spriteFrames[0].uvs = rect; } uIButton2.animations[k].SetAnim(uIButton2.States[k], k); } } } else { for (int l = 0; l < 4; l++) { uIButton2.States[l].spriteFrames = new CSpriteFrame[1]; uIButton2.States[l].spriteFrames[0] = new CSpriteFrame(); rect.x += pixelToUVsWidth; if ((int)uIBaseInfoLoader.ButtonCount <= l) { uIButton2.States[l].spriteFrames[0].uvs = uvs; } else { uIButton2.States[l].spriteFrames[0].uvs = rect; } uIButton2.animations[l].SetAnim(uIButton2.States[l], l); } } uIButton2.autoResize = false; if (string.Empty != item.GetColumnStr(i)) { uIButton2.Text = item.GetColumnStr(i); if (this.m_faFontSize[i] > 0f) { uIButton2.SetCharacterSize(this.m_faFontSize[i]); } } else { uIButton2.DeleteSpriteText(); } uIButton2.PlayAnim(0, 0); if (item.ColumnKey[i] is bool && !(bool)item.ColumnKey[i]) { uIButton2.controlIsEnabled = false; } uIListItemContainer.MakeChild(uIButton2.gameObject); uIButton2.gameObject.transform.localPosition = new Vector3(this.columnRect[i].x, -this.columnRect[i].y, num2); } } else if (item.GetType(i) == ListItem.TYPE.ITEM) { GameObject gameObject5 = new GameObject(name); ItemTexture itemTexture = gameObject5.AddComponent <ItemTexture>(); itemTexture.Layer = GUICamera.UILayer; ITEM iTEM2 = item.ColumnKey[i] as ITEM; if (this.useColumnRect) { itemTexture.width = this.columnRect[i].width; itemTexture.height = this.columnRect[i].height; } else { itemTexture.width = (float)this.columnWidth[i]; itemTexture.height = this.lineHeight; } if (iTEM2.m_nItemUnique == 70000) { this.SetSlotEffect("FX_UI_HEARTS_STONE", itemTexture, new Vector2(itemTexture.width, itemTexture.height)); } int num5 = iTEM2.m_nOption[2]; if (string.Compare(MsgHandler.HandleReturn <string>("RankStateString", new object[] { num5 }), "best") == 0) { this.SetSlotEffect("FX_WEAPON_GOOD", itemTexture, new Vector2(itemTexture.width, itemTexture.height)); if (item.GetGameObjectDelegate() != null) { itemTexture.AddGameObjectDelegate(item.GetGameObjectDelegate()); } } itemTexture.autoResize = false; itemTexture.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); float num6 = item.Get_Alpha(i); if (num6 > 0f) { itemTexture.SetAlpha(num6); } uIListItemContainer.MakeChild(itemTexture.gameObject); if (this.useColumnRect) { itemTexture.Setup(this.columnRect[i].width, this.columnRect[i].height); itemTexture.gameObject.transform.localPosition = new Vector3(this.columnRect[i].x, -this.columnRect[i].y, num2); BoxCollider boxCollider = (BoxCollider)itemTexture.gameObject.AddComponent(typeof(BoxCollider)); if (boxCollider != null) { boxCollider.size = new Vector3(this.columnRect[i].width, this.columnRect[i].height, 0f); boxCollider.center = new Vector3(this.columnRect[i].x / 2f, -this.columnRect[i].y / 2f, 0f); } } else { itemTexture.Setup((float)this.columnWidth[i], this.lineHeight); itemTexture.gameObject.transform.localPosition = new Vector3(num, 0f, -0.02f); num += (float)this.columnWidth[i]; BoxCollider boxCollider2 = (BoxCollider)itemTexture.gameObject.AddComponent(typeof(BoxCollider)); boxCollider2.size = new Vector3((float)this.columnWidth[i], this.lineHeight, 0f); boxCollider2.center = new Vector3((float)(this.columnWidth[i] / 2), -this.lineHeight / 2f, num2); } itemTexture.Start(); itemTexture.SetItemTexture(item.ColumnKey[i] as ITEM, false, true, 1f); if (item.p_bIsTooltip[i] && item.ColumnKey[i] is ITEM) { itemTexture.c_cItemTooltip = (ITEM)item.ColumnKey[i]; } if (item.p_bIsSecondTooltip[i] && item.ColumnKey2[i] is ITEM) { itemTexture.c_cItemSecondTooltip = (ITEM)item.ColumnKey2[i]; } itemTexture.AddValueChangedDelegate(item.GetColumnDelegate(i)); } else if (item.GetType(i) == ListItem.TYPE.SOLDIER) { GameObject gameObject6 = new GameObject(name); ItemTexture itemTexture2 = gameObject6.AddComponent <ItemTexture>(); itemTexture2.Layer = GUICamera.UILayer; if (this.useColumnRect) { itemTexture2.width = this.columnRect[i].width; itemTexture2.height = this.columnRect[i].height; } else { itemTexture2.width = (float)this.columnWidth[i]; itemTexture2.height = this.lineHeight; } itemTexture2.autoResize = false; itemTexture2.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); float num7 = item.Get_Alpha(i); if (num7 > 0f) { itemTexture2.SetAlpha(num7); } uIListItemContainer.MakeChild(itemTexture2.gameObject); if (this.useColumnRect) { itemTexture2.Setup(this.columnRect[i].width, this.columnRect[i].height); itemTexture2.gameObject.transform.localPosition = new Vector3(this.columnRect[i].x, -this.columnRect[i].y, num2); BoxCollider boxCollider3 = (BoxCollider)itemTexture2.gameObject.AddComponent(typeof(BoxCollider)); boxCollider3.size = new Vector3(this.columnRect[i].width, this.columnRect[i].height, 0f); boxCollider3.center = new Vector3(this.columnRect[i].x / 2f, -this.columnRect[i].y / 2f, 0f); } else { itemTexture2.Setup((float)this.columnWidth[i], this.lineHeight); itemTexture2.gameObject.transform.localPosition = new Vector3(num, 0f, -0.02f); num += (float)this.columnWidth[i]; BoxCollider boxCollider4 = (BoxCollider)itemTexture2.gameObject.AddComponent(typeof(BoxCollider)); boxCollider4.size = new Vector3((float)this.columnWidth[i], this.lineHeight, 0f); boxCollider4.center = new Vector3((float)(this.columnWidth[i] / 2), -this.lineHeight / 2f, num2); } itemTexture2.Start(); if (item.ColumnKey[i] is int) { int charkind = (int)item.ColumnKey[i]; itemTexture2.SetSolImageTexure(eCharImageType.SMALL, charkind, -1); } else if (item.ColumnKey[i] is NkListSolInfo) { NkListSolInfo solInfo = item.ColumnKey[i] as NkListSolInfo; itemTexture2.SetSolImageTexure(eCharImageType.SMALL, solInfo); } } else if (item.GetType(i) == ListItem.TYPE.PROGRESSBAR) { GameObject gameObject7 = new GameObject(name); UIProgressBar uIProgressBar = gameObject7.AddComponent <UIProgressBar>(); uIProgressBar.gameObject.layer = GUICamera.UILayer; uIProgressBar.width = this.columnRect[i].width; uIProgressBar.height = this.columnRect[i].height; UIBaseInfoLoader uIBaseInfoLoader2 = NrTSingleton <UIImageInfoManager> .Instance.FindUIImageDictionary(item.GetColumnImageStr(i)); uIProgressBar.SetSpriteTile(uIBaseInfoLoader2.Tile, uIBaseInfoLoader2.UVs.width / (float)uIBaseInfoLoader2.ButtonCount, uIBaseInfoLoader2.UVs.height); Material material2 = CResources.Load(uIBaseInfoLoader2.Material) as Material; uIProgressBar.Setup(this.columnRect[i].width, this.columnRect[i].height, material2); Rect uvs2 = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material2, uIBaseInfoLoader2.UVs.x), 1f - UIBaseFileManager.GetPixelToUVsHeight(material2, uIBaseInfoLoader2.UVs.y + uIBaseInfoLoader2.UVs.height), UIBaseFileManager.GetPixelToUVsWidth(material2, uIBaseInfoLoader2.UVs.width), UIBaseFileManager.GetPixelToUVsHeight(material2, uIBaseInfoLoader2.UVs.height)); uIProgressBar.States[0].spriteFrames = new CSpriteFrame[1]; uIProgressBar.States[0].spriteFrames[0] = new CSpriteFrame(); uIProgressBar.States[0].spriteFrames[0].uvs = uvs2; uIProgressBar.animations[0].SetAnim(uIProgressBar.States[0], 0); uIBaseInfoLoader2.Initialize(); if (NrTSingleton <UIImageInfoManager> .Instance.FindUIImageDictionary(item.GetColumnImageStr2(i), ref uIBaseInfoLoader2)) { uvs2 = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material2, uIBaseInfoLoader2.UVs.x), 1f - UIBaseFileManager.GetPixelToUVsHeight(material2, uIBaseInfoLoader2.UVs.y + uIBaseInfoLoader2.UVs.height), UIBaseFileManager.GetPixelToUVsWidth(material2, uIBaseInfoLoader2.UVs.width), UIBaseFileManager.GetPixelToUVsHeight(material2, uIBaseInfoLoader2.UVs.height)); uIProgressBar.States[1].spriteFrames = new CSpriteFrame[1]; uIProgressBar.States[1].spriteFrames[0] = new CSpriteFrame(); uIProgressBar.States[1].spriteFrames[0].uvs = uvs2; uIProgressBar.animations[1].SetAnim(uIProgressBar.States[1], 1); } uIProgressBar.autoResize = false; uIProgressBar.anchor = SpriteRoot.ANCHOR_METHOD.UPPER_LEFT; uIProgressBar.PlayAnim(0, 0); uIProgressBar.Value = (float)item.ColumnKey[i]; uIListItemContainer.MakeChild(uIProgressBar.gameObject); uIProgressBar.gameObject.transform.localPosition = new Vector3(this.columnRect[i].x, -this.columnRect[i].y, num2); } } return(uIListItemContainer); }
public static HorizontalSlider HorizontalSlider(string name, string styleName1, string styleName2, string styleName3, float width, float height) { GameObject gameObject = new GameObject(name); HorizontalSlider horizontalSlider = gameObject.AddComponent <HorizontalSlider>(); if (null == horizontalSlider) { return(null); } horizontalSlider.gameObject.layer = GUICamera.UILayer; UIBaseInfoLoader uIBaseInfoLoader = UIBaseFileManager.FindUIImageDictionary(name, styleName1); Material material = (Material)CResources.Load(uIBaseInfoLoader.Material); horizontalSlider.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount, uIBaseInfoLoader.UVs.height); horizontalSlider.m_bPattern = uIBaseInfoLoader.Pattern; horizontalSlider.Setup(width, height, material); 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)); for (int i = 0; i < 1; i++) { horizontalSlider.States[i].spriteFrames = new CSpriteFrame[1]; horizontalSlider.States[i].spriteFrames[0] = new CSpriteFrame(); horizontalSlider.States[i].spriteFrames[0].uvs = rect; horizontalSlider.animations[i].SetAnim(horizontalSlider.States[i], i); } UIBaseInfoLoader uIBaseInfoLoader2 = UIBaseFileManager.FindUIImageDictionary(name, styleName2); Material material2 = (Material)CResources.Load(uIBaseInfoLoader.Material); horizontalSlider.emptySprite.SetSpriteTile(uIBaseInfoLoader2.Tile, uIBaseInfoLoader2.UVs.width / (float)uIBaseInfoLoader2.ButtonCount, uIBaseInfoLoader2.UVs.height); float num = uIBaseInfoLoader.UVs.height - uIBaseInfoLoader2.UVs.height; horizontalSlider.emptySprite.Setup(width, height - num, material2); horizontalSlider.emptySprite.SetTextureUVs(new Vector2(uIBaseInfoLoader2.UVs.x, uIBaseInfoLoader2.UVs.y + uIBaseInfoLoader2.UVs.height), new Vector2(uIBaseInfoLoader2.UVs.width, uIBaseInfoLoader2.UVs.height)); horizontalSlider.emptySprite.transform.localPosition = new Vector3(0f, -num / 2f, -0.5f); UIBaseInfoLoader uIBaseInfoLoader3 = UIBaseFileManager.FindUIImageDictionary(name, styleName3); horizontalSlider.m_sprKnobTile.SetSpriteTile(uIBaseInfoLoader3.Tile, uIBaseInfoLoader3.UVs.width, uIBaseInfoLoader3.UVs.height); horizontalSlider.knobSize = new Vector2(uIBaseInfoLoader3.UVs.width / (float)uIBaseInfoLoader3.ButtonCount, uIBaseInfoLoader3.UVs.height); float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader3.UVs.width / (float)uIBaseInfoLoader3.ButtonCount); rect = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader3.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader3.UVs.y + uIBaseInfoLoader3.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader3.UVs.height)); Rect uvs = new Rect(rect); uvs.x += pixelToUVsWidth; for (int j = 1; j < 4; j++) { horizontalSlider.States[j].spriteFrames = new CSpriteFrame[1]; horizontalSlider.States[j].spriteFrames[0] = new CSpriteFrame(); if ((int)uIBaseInfoLoader.ButtonCount > j - 1) { rect.x += pixelToUVsWidth; horizontalSlider.States[j].spriteFrames[0].uvs = rect; } else { horizontalSlider.States[j].spriteFrames[0].uvs = uvs; } horizontalSlider.animations[j].SetAnim(horizontalSlider.States[j], j); } horizontalSlider.anchor = SpriteRoot.ANCHOR_METHOD.UPPER_LEFT; horizontalSlider.autoResize = false; horizontalSlider.gameObject.layer = GUICamera.UILayer; horizontalSlider.stopKnobFromEdge = uIBaseInfoLoader3.UVs.width / (float)uIBaseInfoLoader3.ButtonCount / 2f - 3f; horizontalSlider.Start(); return(horizontalSlider); }
public static LinkText LinkText(string name, EmoticonInfo.ChatTextInfo chatTextInfo, ITEM linkItem, Color color, string defaultColor, SpriteText.Font_Effect fontEffect) { UIBaseInfoLoader uIBaseInfoLoader = UIBaseFileManager.FindUIImageDictionary(name, "Com_I_Transparent"); if (uIBaseInfoLoader == null) { return(null); } GameObject gameObject = new GameObject(name); LinkText linkText = gameObject.AddComponent <LinkText>(); linkText.UpdateText = true; linkText.gameObject.layer = GUICamera.UILayer; linkText.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); linkText.linkTextType = chatTextInfo.linkTextType; linkText.CreateSpriteText(); if (chatTextInfo.linkTextType == UnityForms.LinkText.TYPE.PLAYER) { if (10 >= chatTextInfo.normalText.Length || string.Compare(chatTextInfo.normalText, 0, "[#", 0, 2) != 0 || chatTextInfo.normalText[10] != ']') { linkText.ColorText = defaultColor; } linkText.NormalColorText = defaultColor; linkText.OverColorText = MsgHandler.HandleReturn <string>("GetTextColor", new object[] { "1302" }); } else { string text = string.Empty; if (chatTextInfo.linkTextType == UnityForms.LinkText.TYPE.COUPON) { text = MsgHandler.HandleReturn <string>("GetTextColor", new object[] { "1306" }); } else if (fontEffect == SpriteText.Font_Effect.White_Shadow_Small) { text = MsgHandler.HandleReturn <string>("GetTextColor", new object[] { "1206" }); } else { text = MsgHandler.HandleReturn <string>("GetTextColor", new object[] { "1107" }); } linkText.ColorText = text; linkText.NormalColorText = text; linkText.OverColorText = text; } linkText.MultiLine = false; linkText.BaseString = chatTextInfo.normalText; linkText.textKey = chatTextInfo.textKey; linkText.SetCharacterSize(chatTextInfo.fontSize); linkText.SetFontEffect(fontEffect); linkText.Text = linkText.ColorText + chatTextInfo.normalText; if (chatTextInfo.linkTextType == UnityForms.LinkText.TYPE.ITEM) { linkText.data = linkItem; } linkText.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount, uIBaseInfoLoader.UVs.height); Material material = (Material)CResources.Load(uIBaseInfoLoader.Material); linkText.Setup(linkText.spriteText.TotalWidth, linkText.spriteText.TotalHeight, material); float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount); Rect rect = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.height)); Rect uvs = new Rect(rect); uvs.x += pixelToUVsWidth; for (int i = 0; i < (int)uIBaseInfoLoader.ButtonCount; i++) { linkText.States[i].spriteFrames = new CSpriteFrame[1]; linkText.States[i].spriteFrames[0] = new CSpriteFrame(); rect.x += pixelToUVsWidth; if ((int)uIBaseInfoLoader.ButtonCount <= i) { linkText.States[i].spriteFrames[0].uvs = uvs; } else { linkText.States[i].spriteFrames[0].uvs = rect; } linkText.animations[i].SetAnim(linkText.States[i], i); } linkText.autoResize = false; linkText.SetState(0); linkText.Start(); return(linkText); }
public static CheckBox CheckBox(string name, string imageKey, float width, float height) { UIBaseInfoLoader uIBaseInfoLoader = UIBaseFileManager.FindUIImageDictionary(name, imageKey); if (uIBaseInfoLoader == null) { return(null); } GameObject gameObject = new GameObject(name); CheckBox checkBox = gameObject.AddComponent <CheckBox>(); checkBox.autoResize = false; checkBox.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); checkBox.gameObject.layer = GUICamera.UILayer; checkBox.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount, uIBaseInfoLoader.UVs.height); Material material = (Material)CResources.Load(uIBaseInfoLoader.Material); checkBox.Setup(width, height, material); checkBox.States = new TextureAnim[] { new TextureAnim("Checked"), new TextureAnim("Unchecked"), new TextureAnim("Disabled") }; checkBox.transitions = new EZTransitionList[] { new EZTransitionList(new EZTransition[] { new EZTransition("Checked") }), new EZTransitionList(new EZTransition[] { new EZTransition("Unchecked") }), new EZTransitionList(new EZTransition[] { new EZTransition("Disabled") }) }; float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount); Rect rect = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.height)); Rect uvs = new Rect(rect); uvs.x += pixelToUVsWidth; for (int i = 0; i < 2; i++) { checkBox.States[i].spriteFrames = new CSpriteFrame[1]; checkBox.States[i].spriteFrames[0] = new CSpriteFrame(); rect.x += pixelToUVsWidth; if ((int)uIBaseInfoLoader.ButtonCount <= i) { checkBox.States[i].spriteFrames[0].uvs = uvs; } else { checkBox.States[i].spriteFrames[0].uvs = rect; } checkBox.animations[i] = new UVAnimation(); checkBox.animations[i].SetAnim(checkBox.States[i], i); } return(checkBox); }