private void MakeLineItem(ref UIListItemContainer container, string index, TreeView.TreeNode node) { string backButtonName = UIScrollList.backButtonName; UIButton uIButton; if (string.Empty != this.childImageStyle) { uIButton = UICreateControl.Button(backButtonName, this.childImageStyle, base.GetSize().x, this.lineHeight); } else { uIButton = UICreateControl.Button(backButtonName, "Com_B_ListBtnH", base.GetSize().x, this.lineHeight); } uIButton.EffectAni = false; uIButton.IsListButton = true; uIButton.allwaysPlayAnim = true; container.MakeChild(uIButton.gameObject); uIButton.gameObject.transform.localPosition = Vector3.zero; if (string.Empty != node.ImageKey) { base.name = "image"; CheckBox checkBox = UICreateControl.CheckBox(base.name, node.ImageKey, 10f, 10f); container.MakeChild(checkBox.gameObject); checkBox.gameObject.transform.localPosition = new Vector3((float)node.Depth * this.depthX + this.childStartX, -this.LineHeight / 2f + 5f, -0.05f); this.addX = 12f; } if (this.useDepthCount) { for (int i = 0; i < TreeView.MAX_TEXT_NUM; i++) { if (string.Empty != node.GetString(i)) { base.name = "text" + i; GameObject gameObject = new GameObject(base.name); Label label = gameObject.AddComponent <Label>(); label.gameObject.layer = GUICamera.UILayer; label.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); container.MakeChild(label.gameObject); label.CreateSpriteText(); float y = this.lineHeight / 2f * -1f; if (null != label.spriteText) { if (i == 0) { label.SetAnchor(SpriteText.Anchor_Pos.Middle_Left); label.SetAlignment(SpriteText.Alignment_Type.Left); label.gameObject.transform.localPosition = new Vector3((float)node.Depth * this.depthX + this.childStartX + this.addX, y, 0f); label.MaxWidth = this.viewableArea.x - label.gameObject.transform.localPosition.x; } else { if (this.childrenAlignment[i] == SpriteText.Alignment_Type.Left) { label.SetAnchor(SpriteText.Anchor_Pos.Middle_Left); label.SetAlignment(this.childrenAlignment[i]); } else if (this.childrenAlignment[i] == SpriteText.Alignment_Type.Center) { label.SetAnchor(SpriteText.Anchor_Pos.Middle_Center); label.SetAlignment(this.childrenAlignment[i]); } else if (this.childrenAlignment[i] == SpriteText.Alignment_Type.Right) { label.SetAnchor(SpriteText.Anchor_Pos.Middle_Right); label.SetAlignment(this.childrenAlignment[i]); } label.gameObject.transform.localPosition = new Vector3(this.coulmnX[node.Depth, i], y, 0f); label.MaxWidth = this.viewableArea.x - label.gameObject.transform.localPosition.x; } label.width = this.coulmnWidth[node.Depth, i]; label.MultiLine = false; label.SetFontEffect(this.fontEffect[node.Depth]); label.SetCharacterSize(this.fontSize[node.Depth]); label.SPOT = true; label.Text = node.GetString(i); label.BackGroundHide(true); } } } } else { base.name = "text" + base.Count.ToString(); GameObject gameObject2 = new GameObject(base.name); Label label2 = gameObject2.AddComponent <Label>(); label2.gameObject.layer = GUICamera.UILayer; label2.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); label2.CreateSpriteText(); container.MakeChild(label2.gameObject); float y2 = this.lineHeight / 2f * -1f; if (null != label2.spriteText) { if (this.childAlignment == SpriteText.Alignment_Type.Left) { label2.SetAnchor(SpriteText.Anchor_Pos.Middle_Left); label2.spriteText.transform.localPosition = new Vector3(this.childStartX + this.addX, y2, 0f); } else if (this.childAlignment == SpriteText.Alignment_Type.Right) { label2.SetAnchor(SpriteText.Anchor_Pos.Middle_Right); label2.spriteText.transform.localPosition = new Vector3(this.viewableArea.x - 6f, y2, 0f); } else { label2.SetAnchor(SpriteText.Anchor_Pos.Middle_Center); label2.spriteText.transform.localPosition = new Vector3(this.viewableArea.x / 2f, y2, 0f); } label2.SetAlignment(this.childAlignment); } label2.MaxWidth = this.viewableArea.x - label2.spriteText.transform.localPosition.x; label2.MultiLine = false; label2.SPOT = true; label2.SetFontEffect(this.FontEffect); label2.SetCharacterSize(15f); label2.Text = node.Text; label2.BackGroundHide(true); } }
private UIListItemContainer MakeChildRootBase(string sChildRootName, TreeView.TreeNode node, bool haveCheckButton, float fontSize, SpriteText.Font_Effect fontEffect, string imageKey) { GameObject gameObject = new GameObject("ChildRoot_NameOnly"); UIListItemContainer uIListItemContainer = gameObject.AddComponent <UIListItemContainer>(); uIListItemContainer.gameObject.layer = GUICamera.UILayer; uIListItemContainer.Data = node; uIListItemContainer.AddValueChangedDelegate(new EZValueChangedDelegate(this.ClickButton)); string name = UIScrollList.backButtonName; UIButton uIButton; if (string.Empty != this.parentImageStyle) { uIButton = UICreateControl.Button(name, this.parentImageStyle, this.viewableArea.x, this.lineHeight); } else { uIButton = UICreateControl.Button(name, "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 = new Vector3(0f, 0f, 0f); DrawTexture drawTexture = null; float x; if (this.checkButton) { name = "arrow"; CheckBox checkBox = null; if (haveCheckButton) { if (string.Empty != this.checkButtonStyle) { UIBaseInfoLoader uIBaseInfoLoader = NrTSingleton <UIImageInfoManager> .Instance.FindUIImageDictionary(this.checkButtonStyle); if (uIBaseInfoLoader != null) { checkBox = UICreateControl.CheckBox(name, this.checkButtonStyle, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount, uIBaseInfoLoader.UVs.height); } } else { checkBox = UICreateControl.CheckBox(name, "Win_I_ArrowBl", 12f, 10f); } } else { checkBox = UICreateControl.CheckBox(name, "Win_I_ListTreeN", 12f, 10f); } uIListItemContainer.MakeChild(checkBox.gameObject); checkBox.gameObject.transform.localPosition = new Vector3(11f, -8f, -0.05f); x = 24f; if (string.Empty != imageKey) { drawTexture = UICreateControl.DrawTexture("image", imageKey); uIListItemContainer.MakeChild(drawTexture.gameObject); float num = 12f + checkBox.width + 2f; float y = (this.LineHeight - drawTexture.height) / 2f * -1f; drawTexture.gameObject.transform.localPosition = new Vector3(num, y, -0.05f); x = num + drawTexture.width + 2f; } } else if (string.Empty != imageKey) { if (haveCheckButton) { UIBaseInfoLoader uIBaseInfoLoader2 = NrTSingleton <UIImageInfoManager> .Instance.FindUIImageDictionary(this.checkButtonStyle); if (uIBaseInfoLoader2 != null && this.checkButtonStyle == imageKey) { UIButton uIButton2 = UICreateControl.Button(name, imageKey, uIBaseInfoLoader2.UVs.width / (float)uIBaseInfoLoader2.ButtonCount, uIBaseInfoLoader2.UVs.height); if (null != uIButton2) { uIListItemContainer.MakeChild(uIButton2.gameObject); uIButton2.PlayAni(true); float y2 = (this.LineHeight - uIButton2.height) / 2f * -1f; uIButton2.gameObject.transform.localPosition = new Vector3(6f, y2, -0.05f); } } x = 6f + uIBaseInfoLoader2.UVs.width / (float)uIBaseInfoLoader2.ButtonCount + 6f; } else { drawTexture = UICreateControl.DrawTexture("image", imageKey); if (null != drawTexture) { uIListItemContainer.MakeChild(drawTexture.gameObject); float y3 = (this.LineHeight - drawTexture.height) / 2f * -1f; drawTexture.gameObject.transform.localPosition = new Vector3(10f, y3, -0.05f); } x = 26f; } } else { x = 6f; } name = "text" + base.Count.ToString(); GameObject gameObject2 = new GameObject(name); Label label = gameObject2.AddComponent <Label>(); label.gameObject.layer = GUICamera.UILayer; uIListItemContainer.MakeChild(label.gameObject); label.width = this.viewableArea.x; label.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); label.CreateSpriteText(); float y4 = this.lineHeight / 2f * -1f; if (this.parentAlignment == SpriteText.Alignment_Type.Left) { label.spriteText.SetAnchor(SpriteText.Anchor_Pos.Middle_Left); label.spriteText.SetAlignment(this.parentAlignment); label.spriteText.transform.localPosition = new Vector3(x, y4, -0.02f); } else if (this.parentAlignment == SpriteText.Alignment_Type.Right) { label.spriteText.SetAnchor(SpriteText.Anchor_Pos.Middle_Right); label.spriteText.SetAlignment(this.parentAlignment); label.spriteText.transform.localPosition = new Vector3(this.viewableArea.x - 6f, y4, -0.02f); if (null != drawTexture) { float num2 = this.viewableArea.x - 6f - label.spriteText.TotalWidth; drawTexture.gameObject.transform.localPosition = new Vector3(num2 - 10f, drawTexture.gameObject.transform.localPosition.y, -0.05f); } } else { label.spriteText.SetAnchor(SpriteText.Anchor_Pos.Middle_Center); label.spriteText.SetAlignment(this.parentAlignment); label.spriteText.transform.localPosition = new Vector3(this.viewableArea.x / 2f, y4, -0.02f); if (null != drawTexture) { float num3 = this.viewableArea.x / 2f - label.spriteText.TotalWidth; drawTexture.gameObject.transform.localPosition = new Vector3(num3 - 10f, drawTexture.gameObject.transform.localPosition.y, -0.05f); } } label.MaxWidth = this.viewableArea.x - label.spriteText.transform.localPosition.x; label.MultiLine = false; label.SPOT = true; label.SetFontEffect(fontEffect); label.SetCharacterSize(fontSize); label.Text = sChildRootName; label.BackGroundHide(true); return(uIListItemContainer); }