累计

来源:互联网 发布:隔夜茶能喝吗 知乎 编辑:程序博客网 时间:2024/04/19 12:55
<span style="color:#ff0000;">1.屏蔽敏感词</span>
    void test()    {        string m_sentence = "我是个大坏人";// 一个句子        string m_selectWord = "坏人";// 敏感词        if (m_sentence.Contains(m_selectWord)) // 句子是否包含敏感词        {            string stars = "";            for (int j = 0; j < m_selectWord.Length; j++)// 判断敏感词长度,方便代替个数            {                stars += "*";            }            m_sentence = m_sentence.Replace(m_selectWord, stars);// **替换敏感词            // 这里变成   string m_sentence = "我是个大**";        }    }
<span style="color:#ff0000;">2.清空<span style="font-family: Arial, Helvetica, sans-serif;">Transform子集</span></span>
<pre name="code" class="csharp">public void ClearPoint(Transform point)    {        if (point == null)        {            return;        }        for (int i = 0; i < point.childCount; i++)        {            NGUITools.Destroy(point.GetChild(i).gameObject);        }    } 
<span style="color:#ff0000;">3.替代制定字符串</span>
<pre name="code" class="csharp">

 string result = "我是X女人".Replace("X", "坏");  
</pre><pre name="code" class="csharp"><span style="color:#ff0000;">4.一个位置到另一个位置的位移动画</span>
<span style="color:#ff0000;"></span>
<pre name="code" class="csharp">  public UIGrid m_Grid;    void PlayAnim()    {        iTween.ValueTo(gameObject, iTween.Hash("from", m_Grid.transform.localPosition.y, "to", m_Grid.transform.localPosition.y + m_Grid.cellHeight, "easetype", iTween.EaseType.linear, "loopType", iTween.LoopType.none, "onupdate", "onupdateTime", "time", 0.5f));    }    private void onupdateTime(float value)    {        m_Grid.transform.localPosition = new Vector3(m_Grid.transform.localPosition.x, value, m_Grid.transform.localPosition.z);        m_Grid.repositionNow = true;//刷新    } 
<span style="color:#ff0000;">5.<span style="font-family: punctuation, 微软雅黑, Tohoma; font-size: 14px; line-height: 22px;">tabs监听</span></span>
    UIEventListener.Get(m_tab1.gameObject).onSelect += OnTabSelect;            UIEventListener.Get(m_tab2.gameObject).onSelect += OnTabSelect; void OnTabSelect(GameObject obj, bool sel)    {        if (sel)        {            if (m_tab1.gameObject == obj)            {                m_grid.Reposition();            }            else            {                m_OtherGrid.Reposition();            }            transform.FindChild("Scroll View").GetComponent<UIScrollView>().ResetPosition();        }    } 



                                             
0 0
原创粉丝点击