public void SetChildDepthOption(int depth, int fontSize, SpriteText.Font_Effect fontEffect, int x1, int x2, int x3, int width1, int width2, int width3)
 {
     this.fontSize[depth]       = (float)fontSize;
     this.fontEffect[depth]     = fontEffect;
     this.coulmnX[depth, 0]     = (float)x1;
     this.coulmnX[depth, 1]     = (float)x2;
     this.coulmnX[depth, 2]     = (float)x3;
     this.coulmnWidth[depth, 0] = (float)width1;
     this.coulmnWidth[depth, 1] = (float)width2;
     this.coulmnWidth[depth, 2] = (float)width3;
 }
Esempio n. 2
0
    public void SetFontEffect(SpriteText.Font_Effect FEffect)
    {
        Transform transform = base.transform.FindChild("ChatText");

        if (transform != null)
        {
            this.emoticonContainer = transform.GetComponent <UIListItemContainer>();
            if (this.emoticonContainer == null)
            {
                this.emoticonContainer = transform.gameObject.AddComponent <UIListItemContainer>();
            }
            this.emoticonContainer.FontEffect = FEffect;
        }
    }
        public void SetLabelScroll(float fontSize, SpriteText.Font_Effect fontEffect)
        {
            this.ColumnNum       = 1;
            this.m_faFontSize[0] = fontSize;
            this.fontEffect      = fontEffect;
            this.autoListBox     = false;
            this.bLabelScroll    = true;
            this.maxLine         = 1;
            BoxCollider boxCollider = base.gameObject.AddComponent <BoxCollider>();

            if (boxCollider != null)
            {
                boxCollider.size   = new Vector3(this.viewableArea.x, this.viewableArea.y, 0f);
                boxCollider.center = new Vector3(0f, 0f, -0.1f);
            }
        }
 public TreeView.TreeNode InsertChildRoot(string sChildRootName, bool haveCheckButton, float fontSize, SpriteText.Font_Effect fontEffect, string imageKey)
 {
     TreeView.TreeNode node = new TreeView.TreeNode(sChildRootName, 0L);
     return(this.InsertChildRootBase(sChildRootName, node, haveCheckButton, fontSize, fontEffect, imageKey));
 }
        private TreeView.TreeNode InsertChildRootBase(string sChildRootName, TreeView.TreeNode node, bool haveCheckButton, float fontSize, SpriteText.Font_Effect fontEffect, string imageKey)
        {
            this.mTree.AddChild(node);
            UIListItemContainer item = this.MakeChildRootBase(sChildRootName, node, haveCheckButton, fontSize, fontEffect, imageKey);

            base.InsertItemDonotPosionUpdate(item, base.Count, null, true);
            return(node);
        }
        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);
        }
        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 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 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 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 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);
        }