Exemple #1
0
    bool TryParseOldColor(ref int iStart)
    {
        //[rrggbb][-]
        int length = m_szText.Length;

        if (iStart + 3 > length)
        {
            return(false);
        }
        if (m_szText[iStart + 1] == '-' &&
            m_szText[iStart + 2] == ']')
        {
            if (m_colors.size > 0)
            {
                m_colors.Pop();
            }
            iStart += 2;
            return(true);
        }

        if (iStart + 8 > length)
        {
            return(false);
        }
        if (m_szText[iStart + 7] != ']')
        {
            return(false);
        }

        for (int i = 0; i < 6; ++i)
        {
            char ch = m_szText[iStart + i + 1];
            if (ch >= '0' && ch <= '9')
            {
                continue;
            }
            if (ch >= 'a' && ch <= 'f')
            {
                continue;
            }
            if (ch >= 'A' && ch <= 'F')
            {
                continue;
            }
            return(false);
        }

        int nR = GetX16(iStart + 1);
        int nG = GetX16(iStart + 3);
        int nB = GetX16(iStart + 5);

        Color32 c = new Color32((byte)nR, (byte)nG, (byte)nB, (byte)255);

        m_colors.Add(c);
        iStart += 7;
        return(true);
    }
Exemple #2
0
    /// <summary>
    /// Create a new draw call, reusing an old one if possible.
    /// </summary>

    static UIDrawCall Create(string name)
    {
#if SHOW_HIDDEN_OBJECTS && UNITY_EDITOR
        name = (name != null) ? "_UIDrawCall [" + name + "]" : "DrawCall";
#endif
        if (mInactiveList.size > 0)
        {
            UIDrawCall dc = mInactiveList.Pop();
            mActiveList.Add(dc);
            if (name != null)
            {
                dc.name = name;
            }
            NGUITools.SetActive(dc.gameObject, true);
            return(dc);
        }

#if UNITY_EDITOR
        // If we're in the editor, create the game object with hide flags set right away
        GameObject go = UnityEditor.EditorUtility.CreateGameObjectWithHideFlags(name,
 #if SHOW_HIDDEN_OBJECTS
                                                                                HideFlags.DontSave | HideFlags.NotEditable, typeof(UIDrawCall));
 #else
                                                                                HideFlags.HideAndDontSave, typeof(UIDrawCall));
 #endif
        UIDrawCall newDC = go.GetComponent <UIDrawCall>();
#else
        GameObject go = new GameObject(name);
        DontDestroyOnLoad(go);
        UIDrawCall newDC = go.AddComponent <UIDrawCall>();
#endif
        // Create the draw call
        mActiveList.Add(newDC);
        return(newDC);
    }
Exemple #3
0
    /// <summary>
    /// Return to the previous window.
    /// </summary>

    static public void GoBack()
    {
        CreateInstance();

        if (mHistory.size > 0)
        {
            if (mActive != null)
            {
                if (showSound != null)
                {
                    NGUITools.PlaySound(hideSound);
                }
                mFading.Add(mActive);
                mActive = null;
            }

            while (mActive == null)
            {
                mActive = mHistory.Pop();

                if (mActive != null)
                {
                    mActive.alpha = 0f;
                    mActive.gameObject.SetActive(true);
                    mFading.Remove(mActive);
                    break;
                }
            }
        }
        else
        {
            Close();
        }
    }
    private static UIDrawCall Create(string name)
    {
        //IL_0034: Unknown result type (might be due to invalid IL or missing references)
        //IL_003a: Expected O, but got Unknown
        //IL_0042: Unknown result type (might be due to invalid IL or missing references)
        //IL_0047: Expected O, but got Unknown
        if (mInactiveList.size > 0)
        {
            UIDrawCall uIDrawCall = mInactiveList.Pop();
            mActiveList.Add(uIDrawCall);
            if (name != null)
            {
                uIDrawCall.set_name(name);
            }
            NGUITools.SetActive(uIDrawCall.get_gameObject(), true);
            return(uIDrawCall);
        }
        GameObject val = new GameObject(name);

        Object.DontDestroyOnLoad(val);
        UIDrawCall uIDrawCall2 = val.AddComponent <UIDrawCall>();

        mActiveList.Add(uIDrawCall2);
        return(uIDrawCall2);
    }
Exemple #5
0
    /// <summary>
    /// Return to the previous window.
    /// </summary>

    static public void GoBack()
    {
        CreateInstance();

        if (mHistory.size > 0)
        {
            if (mActive != null)
            {
                mFading.Add(mActive);
                mActive = null;
            }

            while (mActive == null)
            {
                mActive = mHistory.Pop();

                if (mActive != null)
                {
                    mActive.alpha = 0;
                    //mActive.SetAlphaRecursive(0f, false);
                    mActive.gameObject.SetActive(true);
                    mFading.Remove(mActive);
                    break;
                }
            }
        }
    }
 // allocate an object
 public T Allocate()
 {
     if (objectPool.size > 0)
     {
         return(objectPool.Pop());
     }
     return(new T());
 }
Exemple #7
0
        // 控制临时变量作用域,出栈
        public void DepthRemove()
        {
            BetterList <string> topValueNames = stackTempValueName.Pop();

            for (int i = 0; i < topValueNames.size; i++)
            {
                dictValues.Remove(topValueNames[i]);
            }
            topValueNames.Clear();
            s_tempValueNamePool.Add(topValueNames);
        }
Exemple #8
0
 // 控制临时变量作用域,进栈
 public void DepthAdd()
 {
     if (s_tempValueNamePool.size > 0)
     {
         stackTempValueName.Add(s_tempValueNamePool.Pop());
     }
     else
     {
         stackTempValueName.Add(new BetterList <string>());
     }
 }
Exemple #9
0
 public static BetterList <CLS_Content.Value> NewParamList()
 {
     if (s_paramListPool.size > 0)
     {
         return(s_paramListPool.Pop());
     }
     else
     {
         return(new BetterList <CLS_Content.Value>());
     }
 }
    public void DeleteLine()
    {
        int vertexCount = mVertexList.size;
        int startIndex  = mLineStack.Pop();

        for (int i = vertexCount - 1; i >= startIndex; i--)
        {
            mVertexList.Pop();
        }
        DeleteTriangles(vertexCount - 2 - startIndex);
        RenderLines();
    }
Exemple #11
0
        public T GetObject()
        {
            T newObject = default(T);

            if (freeList.size > 0)
            {
                newObject = freeList.Pop();
            }
            else
            {
                newObject = creator();
            }
            return(newObject);
        }
Exemple #12
0
 public static CLS_Content NewContent(ICLS_Environment environment)
 {
     if (s_contentPool.size > 0)
     {
         CLS_Content content = s_contentPool.Pop();
         content.environment = environment;
         return(content);
     }
     else
     {
         CLS_Content content = new CLS_Content();
         content.environment = environment;
         return(content);
     }
 }
    private static UIDrawCall Create(string name)
    {
        if (mInactiveList.size > 0)
        {
            UIDrawCall uIDrawCall = mInactiveList.Pop();
            mActiveList.Add(uIDrawCall);
            if (name != null)
            {
                uIDrawCall.name = name;
            }
            NGUITools.SetActive(uIDrawCall.gameObject, state: true);
            return(uIDrawCall);
        }
        GameObject gameObject = new GameObject(name);

        UnityEngine.Object.DontDestroyOnLoad(gameObject);
        UIDrawCall uIDrawCall2 = gameObject.AddComponent <UIDrawCall>();

        mActiveList.Add(uIDrawCall2);
        return(uIDrawCall2);
    }
Exemple #14
0
    static UIDrawCall Create(string name)
    {
        if (mInactiveList.size > 0)
        {
            UIDrawCall dc = mInactiveList.Pop();
            mActiveList.Add(dc);
            if (name != null)
            {
                dc.name = name;
            }
            NGUITools.SetActive(dc.gameObject, true);
            return(dc);
        }

        GameObject go = new GameObject(name);

        DontDestroyOnLoad(go);
        UIDrawCall newDC = go.AddComponent <UIDrawCall>();

        mActiveList.Add(newDC);
        return(newDC);
    }
Exemple #15
0
 public void OutStack(ICLS_Expression expr)
 {
     stackExpr.Pop();
 }
Exemple #16
0
 public void OutStackContent(CLS_Content content)
 {
     stackContent.Pop();
 }