Example #1
0
    public void Create()
    {
        if (m_selectBoxWidth <= 0)
        {
            m_selectBoxWidth = 349;
        }
        if (m_selectBoxHeight <= 0)
        {
            m_selectBoxHeight = 429;
        }
        if (m_elementsWidth <= 0)
        {
            m_elementsWidth = m_selectBoxWidth;
        }
        if (m_elementsHieght <= 0)
        {
            m_elementsHieght = 120;
        }
        if (m_elementsFontSizeNumb <= 0)
        {
            m_elementsFontSizeNumb = 70;
        }
        if (m_contentList.Count == 0)
        {
            IMCDebug.LogWarning("SelectBox m_contentList.Count is 0");
            return;
        }

        Invoke("InvkeStart", 0.1f);//使用延迟0.1秒使得不影响排列
    }
Example #2
0
 /// <summary>
 /// 设置指定索引的按钮宽高
 /// </summary>
 /// <param name="buttonIndex">按钮索引</param>
 /// <param name="width">宽</param>
 /// <param name="height">高</param>
 public void SetButtonWidthHeight(int buttonIndex, float width, float height)
 {
     if (buttonIndex > -1 && buttonIndex < buttonChilds.Count - 1)
     {
         LayoutElement lay;
         lay           = buttonChilds[buttonIndex].GetComponent <LayoutElement>();
         lay.minWidth  = width;
         lay.minHeight = height;
         return;
     }
     IMCDebug.LogWarning("没有找到匹配的索引 -IMCMessageBox.cs -SetButtonWidthHeight()");
 }
 private void OpenURL(string hrefName)
 {
     Debug.Log("点击了 " + hrefName);
     try
     {
         Application.OpenURL(hrefName);
     }
     catch (System.Exception)
     {
         IMCDebug.LogWarning("网址有误!");
     }
 }
Example #4
0
    /// <summary>
    /// 设置指定名字符合按钮宽高
    /// </summary>
    /// <param name="buttonName">按钮名字</param>
    /// <param name="width">宽</param>
    /// <param name="height">高</param>
    public void SetButtonWidthHeight(string buttonName, float width, float height)
    {
        LayoutElement lay;

        for (int i = 0; i < buttonChilds.Count; i++)
        {
            if (buttonChilds[i].name == buttonName)
            {
                lay           = buttonChilds[i].GetComponent <LayoutElement>();
                lay.minWidth  = width;
                lay.minHeight = height;
            }
        }
        IMCDebug.LogWarning("没有找到匹配的按钮名字 -IMCMessageBox.cs -SetButtonWidthHeight()");
    }
Example #5
0
    public void Create(float controlsWidth, float controlsHeight, float elementsWidth, float elementsHeight, int fontSizeNumb, List <string> content, TextAnchor anchor = TextAnchor.MiddleCenter)
    {
        m_selectBoxWidth       = controlsWidth;
        m_selectBoxHeight      = controlsHeight;
        m_elementsWidth        = elementsWidth;
        m_elementsHieght       = elementsHeight;
        m_elementsFontSizeNumb = fontSizeNumb;
        m_anchor = anchor;
        if (content.Count != 0)
        {
            m_contentList.Clear();
            m_contentList = content;
        }
        else
        {
            IMCDebug.LogWarning("SelectBox content.Count is 0");
            return;
        }

        Invoke("InvkeStart", 0.1f);
    }
Example #6
0
    private void InitializeElementsContent(List <string> content)//元素内容排列
    {
        try
        {
            dateElements = new List <string>();
            for (int i = 0; i < content.Count; i++)
            {
                dateElements.Add(content[i]);
            }

            #region 使最开始的数据显示第一个索引
            int dateElementsIndex = 0;
            for (int i = m_childs.Count - m_childs.Count / 2 - 1; i < m_childs.Count; i++)
            {
                m_childs[i].text = dateElements[dateElementsIndex];
                dateElementsIndex++;
            }

            dateElementsIndex = dateElements.Count - 1;
            for (int i = m_childs.Count - m_childs.Count / 2 - 1 - 1; i >= 0; i--)
            {
                m_childs[i].text = dateElements[dateElementsIndex];
                dateElementsIndex--;
            }
            #endregion

            m_CenterObject.text = dateElements[0];

            SelectBoxActivateToggle = true;
        }
        catch
        {
            for (int i = 0; i < m_childs.Count; i++)
            {
                m_childs[i].text = "";
            }
            SelectBoxActivateToggle = false;
            IMCDebug.LogWarning(this.name + "  " + "Initialize failure!");
        }
    }