Exemple #1
0
 void OnDestroy()
 {
     LocalString.Destroy();
     PathManager.Destroy();
     SpriteFaceCache.Destory();
     GameManager.gameInit = false;
 }
Exemple #2
0
    private string GetOutputText()
    {
        _imagesTagInfoList.Clear();
        IList <UIVertex> verts       = cachedTextGenerator.verts;
        StringBuilder    textBuilder = new StringBuilder();
        int textIndex = 0;

        foreach (Match match in _inputRegex.Matches(text))
        {
            int tempId = 0;
            if (!string.IsNullOrEmpty(match.Groups[1].Value) && !match.Groups[1].Value.Equals("-"))
            {
                tempId = int.Parse(match.Groups[1].Value);
            }
            string tempTag = match.Groups[2].Value;
            //更新超链接
            if (tempId < 0)
            {
                textBuilder.Append(text.Substring(textIndex, match.Index - textIndex));
                textBuilder.Append("<color=blue>");
                int _startIndex = textBuilder.Length * 4;
                textBuilder.Append("[" + match.Groups[2].Value + "]");
                int _endIndex = textBuilder.Length * 4 - 2;
                textBuilder.Append("</color>");

                var hrefInfo = new HrefInfo
                {
                    id         = Mathf.Abs(tempId),
                    startIndex = _startIndex, // 超链接里的文本起始顶点索引
                    endIndex   = _endIndex,
                    name       = match.Groups[2].Value
                };
                _listHrefInfos.Add(hrefInfo);
            }
            //更新表情
            else
            {
                textBuilder.Append(text.Substring(textIndex, match.Index - textIndex));

                SpriteAsset      spriteAsset = SpriteFaceCache.GetAsset(tempId);
                SpriteInforGroup tempGroup   = SpriteFaceCache.GetAsset(tempId, tempTag);
                float            imgSize     = spriteAsset == null ? 24.0f : spriteAsset.size;
                float            imgWidth    = spriteAsset == null ? 1.0f : spriteAsset.width;

                int vertexIndex = textBuilder.Length * 4;
                textBuilder.Append(@"<quad size=" + imgSize + " width=" + imgWidth + " />");
                SpriteTagInfo spInfo = new SpriteTagInfo();
                spInfo.vertId = vertexIndex;
                spInfo.faceId = tempId;
                spInfo.action = tempTag;
                spInfo.size   = new Vector2(imgSize * imgWidth, imgSize);
                _imagesTagInfoList.Add(spInfo);
            }

            textIndex = match.Index + match.Length;
        }

        textBuilder.Append(text.Substring(textIndex, text.Length - textIndex));
        return(textBuilder.ToString());
    }
 //设置动画 动作
 public void setIndexAction(int index, string action)
 {
     if (m_index == index && m_actoin == action)
     {
         return;
     }
     m_index    = index;
     m_actoin   = action;
     _infoGroup = SpriteFaceCache.GetAsset(m_index, m_actoin);
     tickTime   = SpriteFaceCache.GetAsset(m_index).tickTime;
 }
 void Start()
 {
     _infoGroup = SpriteFaceCache.GetAsset(m_index, m_actoin);
     tickTime   = SpriteFaceCache.GetAsset(m_index).tickTime;
 }