Exemplo n.º 1
0
 public Link(InlineElement[] linkText, string destination, string title, ParserConfig config) : base(config)
 {
     Children    = linkText;
     Destination =
         InlineElementUtils.UrlEncode(InlineText.HandleEscapeAndHtmlEntity(RemoveAngleBrackets(destination)));
     Title = title == null ? null : InlineText.HandleEscapeAndHtmlEntity(RemoveQuotes(title));
 }
    public void RemoveSpriteAnimInfos(InlineText inlineText)
    {
        if (inlineText == null)
        {
            return;
        }

        int id = inlineText.GetInstanceID();

        if (!mTextSpriteAnimKeysDic.ContainsKey(id))
        {
            return;
        }

        int           count          = mTotalSpriteAnimDic.Count;
        List <string> spriteAnimKeys = mTextSpriteAnimKeysDic[id];

        for (int i = 0; i < spriteAnimKeys.Count; ++i)
        {
            if (mTotalSpriteAnimDic.ContainsKey(spriteAnimKeys[i]))
            {
                mTotalSpriteAnimDic.Remove(spriteAnimKeys[i]);
            }
        }
        mTextSpriteAnimKeysDic.Remove(id);

        if (count != mTotalSpriteAnimDic.Count)
        {
            //Debug.Log("mInlineSpriteAnimInfoDic Count:" + mTotalSpriteAnimDic.Count);
            UpdateMeshCapacity();
        }
    }
Exemplo n.º 3
0
    public void OnClickSend()
    {
        string _chatString = _InputText.text;

        if (string.IsNullOrEmpty(_chatString))
        {
            return;
        }

        for (int i = 0; i < testcnt; ++i)
        {
            GameObject _chatClone = Instantiate(_PreChatItem);
            _chatClone.transform.SetParent(_ChatParent);

            InlineText _chatText = _chatClone.GetComponentInChildren <InlineText>();
            if (_chatText != null)
            {
                _chatText.text = _chatString;
            }

            TextMeshProUGUI textmesh = _chatClone.GetComponentInChildren <TextMeshProUGUI>();
            if (textmesh != null)
            {
                textmesh.text = _chatString;
            }
        }

        cal.Reset();
    }
Exemplo n.º 4
0
    public void UpdateTextInfo(int id, InlineText key, List <SpriteTagInfo> value)
    {
        if (!_indexSpriteGraphic.ContainsKey(id) || !_textMeshInfo.ContainsKey(id) || value.Count <= 0)
        {
            return;
        }
        int     spriteTagCount = value.Count;
        Vector3 textPos        = key.transform.position;
        Vector3 spritePos      = _indexSpriteGraphic[id].SpriteGraphic.transform.position;
        Vector3 disPos         = (textPos - spritePos) * (1.0f / key.pixelsPerUnit);

        //新增摄像机模式的位置判断
        if (key.canvas != null)
        {
            if (key.canvas.renderMode != RenderMode.ScreenSpaceOverlay)
            {
                Vector3 scale = key.canvas.transform.localScale;
                disPos  = new Vector3(disPos.x / scale.x, disPos.y / scale.y, disPos.z / scale.z);
                disPos /= (1.0f / key.pixelsPerUnit);
            }
        }

        MeshInfo meshInfo = new MeshInfo();

        meshInfo.Tag       = new string[spriteTagCount];
        meshInfo.Vertices  = new Vector3[spriteTagCount * 4];
        meshInfo.Uv        = new Vector2[spriteTagCount * 4];
        meshInfo.Triangles = new int[spriteTagCount * 6];
        for (int i = 0; i < value.Count; i++)
        {
            int m = i * 4;
            //标签
            meshInfo.Tag[i] = value[i].Tag;
            //顶点位置
            meshInfo.Vertices[m + 0] = value[i].Pos[0] + disPos;
            meshInfo.Vertices[m + 1] = value[i].Pos[1] + disPos;
            meshInfo.Vertices[m + 2] = value[i].Pos[2] + disPos;
            meshInfo.Vertices[m + 3] = value[i].Pos[3] + disPos;
            //uv
            meshInfo.Uv[m + 0] = value[i].Uv[0];
            meshInfo.Uv[m + 1] = value[i].Uv[1];
            meshInfo.Uv[m + 2] = value[i].Uv[2];
            meshInfo.Uv[m + 3] = value[i].Uv[3];
        }
        if (_textMeshInfo[id].ContainsKey(key))
        {
            MeshInfo oldMeshInfo = _textMeshInfo[id][key];
            if (!meshInfo.Equals(oldMeshInfo))
            {
                _textMeshInfo[id][key] = meshInfo;
            }
        }
        else
        {
            _textMeshInfo[id].Add(key, meshInfo);
        }

        //更新图片
        DrawSprites(id);
    }
Exemplo n.º 5
0
    public void OnClickSend()
    {
        string _chatString = _InputText.text;

        if (string.IsNullOrEmpty(_chatString))
        {
            return;
        }

        GameObject _chatClone = Instantiate(_PreChatItem);

        _chatClone.transform.parent = _ChatParent;
        InlineText _chatText  = _chatClone.transform.FindChild("Text").GetComponent <InlineText>();
        Image      _chatImage = _chatClone.transform.FindChild("BG").GetComponent <Image>();

        _chatText.text = _chatString;
        _chatText.ActiveText();
        Vector2 _imagSize = _ChatTextSize;

        if (_chatText.preferredWidth < _ChatTextSize.x)
        {
            _imagSize.x = _chatText.preferredWidth + 0.3f;
        }
        if (_chatText.preferredHeight > _ChatTextSize.y)
        {
            _imagSize.y = _chatText.preferredHeight + 0.8f;
        }
        _chatImage.rectTransform.sizeDelta = _imagSize;
        Vector2 _pos = new Vector2(0.0f, _ViewHight);

        _chatClone.GetComponent <RectTransform>().anchoredPosition = _pos;

        _ViewHight            += -_imagSize.y - 20.0f;
        _ViewContent.sizeDelta = new Vector2(_ViewContent.sizeDelta.x, Mathf.Abs(_ViewHight));
    }
Exemplo n.º 6
0
        public void Equals_3()
        {
            InlineText a1 = new InlineText("a");
            InlineText a2 = new InlineText("a");
            InlineText b9 = new InlineText("b");

            object x1 = a1;
            object x2 = a2;
            object y9 = b9;

            ReferenceEquals(a1, a2).IsFalse();
            a1.Equals(a1).IsTrue();
            a1.Equals(a2).IsTrue();
            a1.Equals(b9).IsFalse();
#pragma warning disable CS1718
            (a1 == a1).IsTrue();
            (a1 == a2).IsTrue();
            (a1 == b9).IsFalse();
            (a1 != a1).IsFalse();
            (a1 != a2).IsFalse();
            (a2 != b9).IsTrue();
#pragma warning restore CS1718

            x1.Equals(x1).IsTrue();
            x1.Equals(x2).IsTrue();
            x1.Equals(b9).IsFalse();
#pragma warning disable CS1718
            (x1 == x1).IsTrue();
            (x1 == x2).IsFalse();
            (x1 == y9).IsFalse();
            (x1 != x1).IsFalse();
            (x1 != x2).IsTrue();
            (x1 != y9).IsTrue();
#pragma warning restore CS1718

            a1.Equals(x1).IsTrue();
            a1.Equals(x2).IsTrue();
            a1.Equals(y9).IsFalse();
#pragma warning disable CS0253
            (a1 == x1).IsTrue();
            (a1 == x2).IsFalse();
            (a1 == y9).IsFalse();
            (a1 != x1).IsFalse();
            (a1 != x2).IsTrue();
            (a1 != y9).IsTrue();
#pragma warning restore CS0253

            x1.Equals(a1).IsTrue();
            x1.Equals(a2).IsTrue();
            x1.Equals(b9).IsFalse();
#pragma warning disable CS0252
            (x1 == a1).IsTrue();
            (x1 == a2).IsFalse();
            (x1 == b9).IsFalse();
            (x1 != a1).IsFalse();
            (x1 != a2).IsTrue();
            (x2 != b9).IsTrue();
#pragma warning restore CS0252
        }
Exemplo n.º 7
0
    public void UpdateTextInfo(int _id, InlineText _key, List <SpriteTagInfo> _value)
    {
        if (!_IndexSpriteGraphic.ContainsKey(_id) || !_TextMeshInfo.ContainsKey(_id) || _value.Count <= 0)
        {
            return;
        }
        int     _spriteTagCount = _value.Count;
        Vector3 _textPos        = _key.transform.position;
        Vector3 _spritePos      = _IndexSpriteGraphic[_id]._SpriteGraphic.transform.position;
        Vector3 _disPos         = (_textPos - _spritePos) * (1.0f / _key.pixelsPerUnit);

        //新增摄像机模式的位置判断
        if (_key.canvas != null)
        {
            if (_key.canvas.renderMode != RenderMode.ScreenSpaceOverlay)
            {
                Vector3 _scale = _key.canvas.transform.localScale;
                _disPos = new Vector3(_disPos.x / _scale.x, _disPos.y / _scale.y, _disPos.z / _scale.z);
            }
        }

        MeshInfo _meshInfo = new MeshInfo();

        _meshInfo._Tag       = new string[_spriteTagCount];
        _meshInfo._Vertices  = new Vector3[_spriteTagCount * 4];
        _meshInfo._UV        = new Vector2[_spriteTagCount * 4];
        _meshInfo._Triangles = new int[_spriteTagCount * 6];
        for (int i = 0; i < _value.Count; i++)
        {
            int m = i * 4;
            //标签
            _meshInfo._Tag[i] = _value[i]._Tag;
            //顶点位置
            _meshInfo._Vertices[m + 0] = _value[i]._Pos[0] + _disPos;
            _meshInfo._Vertices[m + 1] = _value[i]._Pos[1] + _disPos;
            _meshInfo._Vertices[m + 2] = _value[i]._Pos[2] + _disPos;
            _meshInfo._Vertices[m + 3] = _value[i]._Pos[3] + _disPos;
            //uv
            _meshInfo._UV[m + 0] = _value[i]._UV[0];
            _meshInfo._UV[m + 1] = _value[i]._UV[1];
            _meshInfo._UV[m + 2] = _value[i]._UV[2];
            _meshInfo._UV[m + 3] = _value[i]._UV[3];
        }
        if (_TextMeshInfo[_id].ContainsKey(_key))
        {
            MeshInfo _oldMeshInfo = _TextMeshInfo[_id][_key];
            if (!_meshInfo.Equals(_oldMeshInfo))
            {
                _TextMeshInfo[_id][_key] = _meshInfo;
            }
        }
        else
        {
            _TextMeshInfo[_id].Add(_key, _meshInfo);
        }

        //更新图片
        DrawSprites(_id);
    }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of <see cref="LinkReferenceDefinition"/>
 /// with link label ,destination, title.
 /// </summary>
 /// <param name="label"></param>
 /// <param name="destination"></param>
 /// <param name="title"></param>
 /// <param name="elem"></param>
 /// <param name="config">Configuration of the parser.</param>
 internal LinkReferenceDefinition(string label, string destination, string title, UnknownElement elem,
                                  ParserConfig config) : base(config)
 {
     Label       = GetSimpleName(label?.Trim(whiteSpaceChars) ?? throw new ArgumentNullException(nameof(title)));
     Destination = InlineElementUtils.UrlEncode(InlineText.HandleEscapeAndHtmlEntity(
                                                    destination ?? throw new ArgumentNullException(nameof(destination))));
     Title = title == null ? null : InlineText.HandleEscapeAndHtmlEntity(title);
     warnings.AddRange(elem?.Warnings ?? new List <string>());
 }
Exemplo n.º 9
0
 /// <summary>
 /// 移除文本
 /// </summary>
 /// <param name="id"></param>
 /// <param name="key"></param>
 public void RemoveTextInfo(int id, InlineText key)
 {
     if (!_textMeshInfo.ContainsKey(id) || !_textMeshInfo[id].ContainsKey(key))
     {
         return;
     }
     _textMeshInfo[id].Remove(key);
     //更新图片
     DrawSprites(id);
 }
Exemplo n.º 10
0
 public void RemoveTextInfo(int _id, InlineText _key)
 {
     if (!_TextMeshInfo.ContainsKey(_id) || _TextMeshInfo[_id].ContainsKey(_key))
     {
         return;
     }
     _TextMeshInfo.Remove(_id);
     //更新图片
     DrawSprites(_id);
 }
Exemplo n.º 11
0
    public void UpdateTextInfo(int _id, InlineText _key, List <SpriteTagInfo> _value)
    {
        if (!_IndexSpriteGraphic.ContainsKey(_id) || !_TextMeshInfo.ContainsKey(_id) || _value.Count <= 0)
        {
            return;
        }
        int     _spriteTagCount = _value.Count;
        Vector3 _textPos        = _key.transform.position;
        Vector3 _spritePos      = _IndexSpriteGraphic[_id]._SpriteGraphic.transform.position;
        Vector3 _disPos         = _textPos - _spritePos;

        MeshInfo _meshInfo = new MeshInfo();

        _meshInfo._Tag       = new string[_spriteTagCount];
        _meshInfo._Vertices  = new Vector3[_spriteTagCount * 4];
        _meshInfo._UV        = new Vector2[_spriteTagCount * 4];
        _meshInfo._Triangles = new int[_spriteTagCount * 6];
        for (int i = 0; i < _value.Count; i++)
        {
            int m = i * 4;
            int n = i * 6;
            //标签
            _meshInfo._Tag[i] = _value[i]._Tag;
            //顶点位置
            _meshInfo._Vertices[m + 0] = _value[i]._Pos[0] + _disPos;
            _meshInfo._Vertices[m + 1] = _value[i]._Pos[1] + _disPos;
            _meshInfo._Vertices[m + 2] = _value[i]._Pos[2] + _disPos;
            _meshInfo._Vertices[m + 3] = _value[i]._Pos[3] + _disPos;
            //uv
            _meshInfo._UV[m + 0] = _value[i]._UV[0];
            _meshInfo._UV[m + 1] = _value[i]._UV[1];
            _meshInfo._UV[m + 2] = _value[i]._UV[2];
            _meshInfo._UV[m + 3] = _value[i]._UV[3];
        }
        if (_TextMeshInfo[_id].ContainsKey(_key))
        {
            MeshInfo _oldMeshInfo = _TextMeshInfo[_id][_key];
            if (_meshInfo.Equals(_oldMeshInfo))
            {
                return;
            }
            else
            {
                _TextMeshInfo[_id][_key] = _meshInfo;
            }
        }
        else
        {
            _TextMeshInfo[_id].Add(_key, _meshInfo);
        }

        //更新图片
        DrawSprites(_id);
    }
Exemplo n.º 12
0
        /// <summary>
        /// Adds a line of string to this <see cref="FencedCodeBlock"/>.
        /// </summary>
        /// <param name="line">A single line to add to this element.</param>
        /// <param name="lazy">Whether <paramref name="line"/> is lazy continuation.</param>
        /// <param name="currentIndent">The indent count of <paramref name="line"/>.</param>
        /// <returns>
        /// Returns <c>AddLineResult.Consumed</c> except when <paramref name="line"/>
        /// contains the close fence.
        /// </returns>
        internal override AddLineResult AddLine(string line, bool lazy, int currentIndent)
        {
            if (lazy && line.GetIndentNum(currentIndent) >= 0)
            {
                throw new InvalidBlockFormatException(BlockElementType.CodeBlock);
            }

            if (!initialized) // When the first line is specified
            {
                Match match = openFenceRegex.Match(line);
                if (!match.Success) // When the first line does not contain open fence.
                {
                    throw new InvalidBlockFormatException(BlockElementType.CodeBlock);
                }

                string fence = match.Groups["fence"].Value;
                fenceLength = fence.Length;
                fenceChar   = fence[0];
                indentNum   = match.Groups["indent"].Length;
                if (match.Groups["info"].Success)
                {
                    infoString = InlineText.HandleEscapeAndHtmlEntity(match.Groups["info"].Value);
                }

                initialized = true;
                return(AddLineResult.Consumed);
            }

            Match closeMatch = closeFenceRegex.Match(line);

            if (!closeMatch.Success)
            {
                contents.Add(RemoveIndent(line, indentNum, currentIndent));
                return(AddLineResult.Consumed);
            }

            string closeFence = closeMatch.Groups["fence"].Value;

            if (closeFence[0] == fenceChar && closeFence.Length >= fenceLength)
            {
                closed = true;
                return(AddLineResult.Consumed | AddLineResult.NeedClose);
            }

            contents.Add(RemoveIndent(line, indentNum, currentIndent));
            return(AddLineResult.Consumed);
        }
Exemplo n.º 13
0
    private void Awake()
    {
        Transform tf         = transform.GetChild(0);
        int       childcount = tf.childCount;

        attrs = new AttributeItem[childcount];
        for (int i = 0; i < childcount; i++)
        {
            Transform  child     = tf.GetChild(i);
            int        itemcount = child.childCount;
            Transform  nametf    = child.GetChild(0);
            InlineText name      = nametf.GetComponent <InlineText>();
            Image      add1      = nametf.GetChild(0).GetComponent <Image>();
            Image      add2      = nametf.GetChild(1).GetComponent <Image>();
            add1.sprite             = add2.sprite;
            add2.transform.position = add1.transform.position;

            Text       value;
            Text       addvalue;
            UIHide     hide;
            UIProgress progress;
            if (itemcount == 3)
            {
                Transform rtf = child.GetChild(1);
                progress   = rtf.gameObject.AddComponent <UIProgress>();
                addvalue   = rtf.GetChild(0).GetComponent <Text>();
                hide       = addvalue.gameObject.AddComponent <UIHide>();
                hide.speed = 0.4f;
                value      = child.GetChild(2).GetComponent <Text>();
            }
            else
            {
                progress = null;
                addvalue = null;
                hide     = null;
                value    = child.GetChild(1).GetComponent <Text>();
            }
            attrs[i] = new AttributeItem()
            {
                name     = name, add1 = add1, add2 = add2, value = value,
                addvalue = addvalue, progress = progress, hide = hide
            };
        }

        modaoP    = modaoImg.gameObject.AddComponent <UIProgress>();
        zhengdaoP = zhengdaoImg.gameObject.AddComponent <UIProgress>();
    }
    public void UnRegister(InlineText inlineText)
    {
        if (null == inlineText)
        {
            return;
        }

        RemoveSpriteAnimInfos(inlineText);

        int id = inlineText.GetInstanceID();

        if (mActicveTextDic.ContainsKey(id))
        {
            mActicveTextDic.Remove(id);
        }
        // Debug.Log("___________________________UnRegister Name:" + inlineText.name);
    }
    public void Register(InlineText inlineText)
    {
        if (null == inlineText)
        {
            return;
        }

        int id = inlineText.GetInstanceID();

        if (mActicveTextDic.ContainsKey(id))
        {
            return;
        }

        // Debug.Log("___________________________Register Name:" + inlineText.name);
        mActicveTextDic[id] = inlineText;
    }
Exemplo n.º 16
0
        void Awake()
        {
            right = transform.Find("Right").transform;
            rightPlayerNameText  = right.Find("PlayerNameText").GetComponent <Text> ();
            rightChatFrame       = right.Find("ChatFrame").GetComponent <RectTransform> ();
            rightPlayerLevelText = right.Find("PlayerLevelText").GetComponent <Text> ();
            rightPlayerIcon      = right.Find("PlayerIcon").GetComponent <Image>();

            left                = transform.Find("Left").transform;
            leftChatFrame       = left.Find("ChatFrame").GetComponent <RectTransform> ();
            leftPlayerNameText  = left.Find("PlayerNameText").GetComponent <Text> ();
            leftPlayerLevelText = left.Find("PlayerLevelText").GetComponent <Text> ();
            leftPlayerIcon      = left.Find("PlayerIcon").GetComponent <Image>();

            messageText = transform.Find("MessageText").GetComponent <InlineText> ();
            itemButton  = transform.GetComponent <Button> ();
            itemButton.AddListener(ItemButtonEvent);
        }
Exemplo n.º 17
0
        public void Ctors_2()
        {
            var a = new InlineText("a");
            var b = new InlineText("b");
            var t = new InlineTag(Tag.S, "*", "*", "t", null, null, null);

            new InlineString().Is();
            new InlineString("a").Is(new InlineText("a"));
            new InlineString(a).Is(new InlineText("a"));
            new InlineString(a, b).Is(new InlineText("ab"));
            new InlineString(t).Is(t);
            new InlineString(a, t).Is(new InlineText("a"), t);
            new InlineString(t, a).Is(t, new InlineText("a"));
            new InlineString(a, a).Is(new InlineText("aa"));
            new InlineString(a, t, a).Is(new InlineText("a"), t, new InlineText("a"));
            new InlineString(a, t, a, a).Is(new InlineText("a"), t, new InlineText("aa"));
            new InlineString(a, a, t, a).Is(new InlineText("aa"), t, new InlineText("a"));
        }
Exemplo n.º 18
0
        /// <summary>
        /// Returns <see cref="InlineElement"/>
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        private IEnumerable <InlineElement> ParseLineBreak(string text)
        {
            string[] lines = text.Replace("\r\n", "\n").Replace("\r", "\n").Split(new[] { '\n' });
            for (int i = 0; i < lines.Length; i++)
            {
                bool isHardBreak = lines[i].EndsWith("  ", StringComparison.Ordinal) ||
                                   (lines[i].EndsWith("\\", StringComparison.Ordinal) &&
                                    !IsEscaped(lines[i], lines.Length - 1));
                if (i < lines.Length - 1)
                {
                    if (lines[i] != string.Empty)
                    {
                        if (isHardBreak && lines[i].EndsWith("\\", StringComparison.Ordinal))
                        {
                            yield return(InlineText.CreateFromText(lines[i].Substring(0, lines[i].Length - 1),
                                                                   parserConfig));
                        }
                        else
                        {
                            yield return(InlineText.CreateFromText(lines[i].TrimEnd(new[] { ' ' }), parserConfig));
                        }
                    }

                    yield return(isHardBreak
                        ? (InlineElement) new HardLineBreak(parserConfig)
                        : new SoftLineBreak(parserConfig));
                }
                else
                {
                    if (lines[i] != string.Empty)
                    {
                        yield return(InlineText.CreateFromText(lines[i], parserConfig));
                    }
                }
            }
        }
Exemplo n.º 19
0
        private void InitComponent()
        {
            chatTop    = transform.Find("ChatTop");
            chatBottom = transform.Find("ChatBottom");
            chatMain   = transform.Find("ChatMain");
            chatMiddle = transform.Find("ChatMiddle");

            worldChat       = chatMain.Find("WorldChat");
            privateChat     = chatMain.Find("PrivateChat");
            privateChatBg   = chatMain.Find("PrivateChat/PrivateChatTop/BackGroundImage");
            labourUnionChat = chatMain.Find("LabourUnionChat");

            playerInfo = privateChat.Find("ChatPlayerInfo");

            hornPanel = chatMiddle.Find("HornPanel").GetComponent <HornPanel>();
            hornPanel.sendHornMessageOnClick = OnClickSendHornMessageCallBack;

            playerInfoPanel   = chatMiddle.Find("PlayerInfoPanel");
            shieldPlayerPanel = chatMiddle.Find("ShieldPlayerPanel");
            addFriendPanel    = chatMiddle.Find("AddFriendPanel");
            expressionPanel   = chatMiddle.Find("ExpressionPanel");

            hornNumberText = chatBottom.Find("HornNumberText").GetComponent <Text> ();
            sendText       = chatBottom.Find("SendText").GetComponent <Text> ();

            worldText             = chatTop.transform.Find("WorldToggle/WorldText").GetComponent <Text> ();
            worldText.color       = Color.white;
            privateChatText       = chatTop.transform.Find("PrivateChatToggle/PrivateChatText").GetComponent <Text> ();
            privateChatText.color = Color.gray;
            labourUnionText       = chatTop.transform.Find("LabourUnionToggle/LabourUnionText").GetComponent <Text> ();
            labourUnionText.color = Color.gray;

            //BuyHornPanel
            buyHornPanel       = chatMiddle.Find("BuyHornPanel");
            buyHornContentText = buyHornPanel.Find("ContentText").GetComponent <Text> ();
            buyHornButton      = buyHornPanel.Find("EnterButton").GetComponent <Button> ();
            buyHornCanelButton = buyHornPanel.Find("CancelButton").GetComponent <Button> ();

            //BuyDiamondPanel
            buyDiamondPanel       = chatMiddle.Find("BuyDiamondPanel");
            buyDiamondButton      = buyDiamondPanel.Find("EnterButton").GetComponent <Button> ();
            buyDiamondCanelButton = buyDiamondPanel.Find("CancelButton").GetComponent <Button> ();

            //VoiceTipPanel
            recordingTipPanel = chatMiddle.Find("RecordingTipPanel");
            tipText           = recordingTipPanel.Find("TipText").GetComponent <Text> ();

            //PlayerInfoPanel
            addFriendButton           = playerInfoPanel.Find("AddFriendButton").GetComponent <Button> ();
            lookFriendButton          = playerInfoPanel.Find("LookFriendButton").GetComponent <Button> ();
            shieldFriendButton        = playerInfoPanel.Find("ShieldFriendButton").GetComponent <Button> ();
            playerInfoPanelMaskButton = playerInfoPanel.Find("MaskButton").GetComponent <Button> ();
            InfoPanelPlayerNameText   = playerInfoPanel.Find("PlayerNameText").GetComponent <Text> ();
            InfoPanelPlayerLevelText  = playerInfoPanel.Find("PlayerLevelText").GetComponent <Text> ();
            InfoPanelPlayerDanText    = playerInfoPanel.Find("PlayerDanText").GetComponent <Text> ();

            //AddFriendPanel
            addFriendPanelEnterButton  = addFriendPanel.Find("EnterButton").GetComponent <Button> ();
            addFriendPanelCancelButton = addFriendPanel.Find("CancelButton").GetComponent <Button> ();
            addFriendPanelCountText    = addFriendPanel.Find("PlayerIcon/AddPlayerText").GetComponent <Text> ();

            //ShieldPlayerPanel
            shieldPlayerPanelEnterButton  = shieldPlayerPanel.Find("EnterButton").GetComponent <Button> ();
            shieldPlayerPanelCancelButton = shieldPlayerPanel.Find("CancelButton").GetComponent <Button> ();
            shieldPlayerPanelCountText    = shieldPlayerPanel.Find("ShieldPlayerTextTitle/ShieldPlayerText").GetComponent <Text> ();

            voiceToggle                = chatBottom.Find("VoiceToggle").GetComponent <Toggle> ();
            sendMessageInputField      = chatBottom.Find("SendMessageInputField").GetComponent <InputField> ();
            speakButton                = chatBottom.Find("SpeakButton").GetComponent <LongPressButton> ();
            speakButton.pressDownEvent = BeginRecord;
            speakButton.longPressEvent = Recording;
            speakButton.leaveEvent     = PauseRecord;
            speakButton.EnterEvent     = ResumeRecord;
            speakButton.pressUpEvent   = BreakOffRecord;

            exitButton           = transform.Find("MaskButton").GetComponent <Button> ();
            hornButton           = chatBottom.Find("HornButton").GetComponent <Button> ();
            expressionButton     = chatBottom.Find("ExpressionButton").GetComponent <Button> ();
            sendButton           = chatBottom.Find("SendButton").GetComponent <Button> ();
            expressionMaskButton = expressionPanel.Find("ExpressionMaskButton").GetComponent <Button> ();

            myFriendScrollView = privateChat.Find("MyFriendScrollView").GetComponent <MyFriendScrollView>();
            myFriendScrollView.OnCreateItemHandler = OnCreateFriendtem;
            myFriendScrollRect   = myFriendScrollView.GetComponent <ScrollRect> ();
            myFriendGroup        = privateChat.Find("MyFriendScrollView/ViewPort/PlayerInfoGroup").GetComponent <ToggleGroup> ();
            friendNumberInfoText = privateChat.Find("PrivateChatTop/FriendNumberText").GetComponent <Text>();
            friendNameText       = privateChat.Find("PrivateChatTop/FriendNameText").GetComponent <Text>();

            chatScrollView = chatMain.Find("ChatScrollView").GetComponent <ChatScrollView> ();
            chatScrollView.OnCreateItemHandler = OnCreateItem;
            chatScrollRect = chatScrollView.GetComponent <ScrollRect> ();

            //show Broadcast message
            broadcastPanel  = chatScrollView.transform.Find("BroadcastPanel");
            playerLevelText = broadcastPanel.transform.Find("PlayerLevelText").GetComponent <Text>();
            playerNameText  = broadcastPanel.transform.Find("PlayerNameText").GetComponent <Text>();
            playerIcon      = broadcastPanel.transform.Find("PlayerIcon").GetComponent <Image>();
            messageText     = broadcastPanel.transform.Find("MessageText").GetComponent <InlineText>();

            privateChatScrollView = privateChat.Find("PrivateChatScrollView").GetComponent <PrivateChatScrollView> ();
            privateChatScrollView.OnCreateItemHandler = OnCreatePrivateChatItem;
            privateChatScrollRect = privateChatScrollView.GetComponent <ScrollRect> ();
        }
Exemplo n.º 20
0
 void Awake()
 {
     messageText = transform.Find("MessageText").GetComponent <InlineText> ();
 }
Exemplo n.º 21
0
 /// <summary>
 /// Represents a character in inline text.
 /// </summary>
 public InlineTextCharacter(MarkdownDocument Document, InlineText Source, char Character)
     : base(Document, Source, Character)
 {
 }
Exemplo n.º 22
0
 void Awake()
 {
     _text = GetComponent <InlineText>();
 }
 public void UpdatePositon(InlineText inlineText, List <SpriteAnimInfo> inputSpriteAnimInfos)
 {
     UpdateSpriteAnimInfos(inlineText, inputSpriteAnimInfos);
     DrawSprite();
 }
    public void UpdateSpriteAnimInfos(InlineText inlineText, List <SpriteAnimInfo> inputSpriteAnimInfos)
    {
        UnityEngine.Profiling.Profiler.BeginSample("inlineSpriteManager UpdateSpriteAnimInfos ");

        if (inlineText == null)
        {
            return;
        }

        bool isUpdateMeshData = false;

        int           id            = inlineText.GetInstanceID();
        List <string> oldSpriteKeys = null;

        if (mTextSpriteAnimKeysDic.ContainsKey(id))
        {
            oldSpriteKeys = mTextSpriteAnimKeysDic[id];
        }

        //input is null
        if (inputSpriteAnimInfos == null)
        {
            if (oldSpriteKeys != null)
            {
                for (int i = 0; i < oldSpriteKeys.Count; ++i)
                {
                    mTotalSpriteAnimDic.Remove(oldSpriteKeys[i]);
                }
                mTextSpriteAnimKeysDic.Remove(id);
                isUpdateMeshData = true;
            }
        }
        else
        {
            int oldCount = mTotalSpriteAnimDic.Count;
            if (oldSpriteKeys != null)
            {
                for (int i = 0; i < oldSpriteKeys.Count; ++i)
                {
                    mTotalSpriteAnimDic.Remove(oldSpriteKeys[i]);
                }
            }

            List <string> keys = new List <string>();
            for (int i = 0; i < inputSpriteAnimInfos.Count; ++i)
            {
                SpriteAnimInfo temp = inputSpriteAnimInfos[i];
                if (temp != null && temp.IsValid())
                {
                    mTotalSpriteAnimDic[temp.Key] = temp;
                    keys.Add(temp.Key);
                }
            }

            if (keys.Count > 0)
            {
                mTextSpriteAnimKeysDic[id] = keys;
            }
            else
            {
                if (oldSpriteKeys != null)
                {
                    mTextSpriteAnimKeysDic.Remove(id);
                }
            }

            if (oldCount != mTotalSpriteAnimDic.Count)
            {
                isUpdateMeshData = true;
            }
        }

        if (isUpdateMeshData)
        {
            //Debug.LogWarning("mInlineSpriteAnimInfoDic Count:" + mSpriteAnimInfoDic.Count);
            UpdateMeshCapacity();
        }


        UnityEngine.Profiling.Profiler.EndSample();
    }
Exemplo n.º 25
0
 void Awake()
 {
     mText   = GetComponentInChildren <InlineText>();
     mButton = gameObject.GetComponent <Button>();
     mButton.onClick.AddListener(OnPointerClick);
 }
Exemplo n.º 26
0
        public void Equals_1()
        {
            var a1 = new InlineText("a");
            var a2 = new InlineText("a");
            var b3 = new InlineText("b");

            var p1 = new InlineTag(Tag.S, "id", "rid", "name", "ctype", "display", "code");
            var p2 = new InlineTag(Tag.S, "id", "rid", "name", "ctype", "display", "code");
            var q3 = new InlineTag(Tag.B, "ID", "RID", "NAME", "CTYPE", "DISPLAY", "CODE");

            ReferenceEquals(a1, a2).IsFalse();
            ReferenceEquals(p1, p2).IsFalse();

            InlineRun c1 = a1, c2 = a2, d3 = b3;
            InlineRun r1 = p1, r2 = p2, s3 = q3;

            ReferenceEquals(c1, a1).IsTrue();
            ReferenceEquals(c1, a2).IsFalse();
            ReferenceEquals(r1, p1).IsTrue();
            ReferenceEquals(r1, p2).IsFalse();

            a1.Equals(a2).IsTrue();
            a1.Equals(b3).IsFalse();
            a1.Equals(p2).IsFalse();
            a1.Equals(q3).IsFalse();
            a1.Equals(c2).IsTrue();
            a1.Equals(d3).IsFalse();
            a1.Equals(r2).IsFalse();
            a1.Equals(s3).IsFalse();

            p1.Equals(a2).IsFalse();
            p1.Equals(b3).IsFalse();
            p1.Equals(p2).IsTrue();
            p1.Equals(q3).IsFalse();
            p1.Equals(c2).IsFalse();
            p1.Equals(d3).IsFalse();
            p1.Equals(r2).IsTrue();
            p1.Equals(s3).IsFalse();

            c1.Equals(a2).IsTrue();
            c1.Equals(b3).IsFalse();
            c1.Equals(p2).IsFalse();
            c1.Equals(q3).IsFalse();
            c1.Equals(c2).IsTrue();
            c1.Equals(d3).IsFalse();
            c1.Equals(r2).IsFalse();
            c1.Equals(s3).IsFalse();

            p1.Equals(a2).IsFalse();
            p1.Equals(b3).IsFalse();
            p1.Equals(p2).IsTrue();
            p1.Equals(q3).IsFalse();
            p1.Equals(c2).IsFalse();
            p1.Equals(d3).IsFalse();
            p1.Equals(r2).IsTrue();
            p1.Equals(s3).IsFalse();

            (a1 == a2).IsTrue();
            (a1 == b3).IsFalse();
            (a1 == p2).IsFalse();
            (a1 == q3).IsFalse();
            (a1 == c2).IsTrue();
            (a1 == d3).IsFalse();
            (a1 == r2).IsFalse();
            (a1 == s3).IsFalse();

            (p1 == a2).IsFalse();
            (p1 == b3).IsFalse();
            (p1 == p2).IsTrue();
            (p1 == q3).IsFalse();
            (p1 == c2).IsFalse();
            (p1 == d3).IsFalse();
            (p1 == r2).IsTrue();
            (p1 == s3).IsFalse();

            (c1 == a2).IsTrue();
            (c1 == b3).IsFalse();
            (c1 == p2).IsFalse();
            (c1 == q3).IsFalse();
            (c1 == c2).IsTrue();
            (c1 == d3).IsFalse();
            (c1 == r2).IsFalse();
            (c1 == s3).IsFalse();

            (p1 == a2).IsFalse();
            (p1 == b3).IsFalse();
            (p1 == p2).IsTrue();
            (p1 == q3).IsFalse();
            (p1 == c2).IsFalse();
            (p1 == d3).IsFalse();
            (p1 == r2).IsTrue();
            (p1 == s3).IsFalse();

            (a1 != a2).IsFalse();
            (a1 != b3).IsTrue();
            (a1 != p2).IsTrue();
            (a1 != q3).IsTrue();
            (a1 != c2).IsFalse();
            (a1 != d3).IsTrue();
            (a1 != r2).IsTrue();
            (a1 != s3).IsTrue();

            (p1 != a2).IsTrue();
            (p1 != b3).IsTrue();
            (p1 != p2).IsFalse();
            (p1 != q3).IsTrue();
            (p1 != c2).IsTrue();
            (p1 != d3).IsTrue();
            (p1 != r2).IsFalse();
            (p1 != s3).IsTrue();

            (c1 != a2).IsFalse();
            (c1 != b3).IsTrue();
            (c1 != p2).IsTrue();
            (c1 != q3).IsTrue();
            (c1 != c2).IsFalse();
            (c1 != d3).IsTrue();
            (c1 != r2).IsTrue();
            (c1 != s3).IsTrue();

            (p1 != a2).IsTrue();
            (p1 != b3).IsTrue();
            (p1 != p2).IsFalse();
            (p1 != q3).IsTrue();
            (p1 != c2).IsTrue();
            (p1 != d3).IsTrue();
            (p1 != r2).IsFalse();
            (p1 != s3).IsTrue();
        }
Exemplo n.º 27
0
 internal Link(string destination, ParserConfig config, bool mailto = false) : base(config)
 {
     Children    = new InlineElement[] { InlineText.CreateFromText(destination, config, false) };
     Destination = (mailto ? "mailto:" : string.Empty) + InlineElementUtils.UrlEncode(destination);
 }
Exemplo n.º 28
0
 private string FormatInlineText(InlineText comment)
 {
     return(comment.Text);
 }