Beispiel #1
0
            public void UseTextWithMovie(string fullPath)
            {
                if (m_movieTables == null)
                m_movieTables = new Dictionary<string, TextContextTable>();

                TextContextTable table;
                if (!m_movieTables.TryGetValue(fullPath, out table)) {
                table = new TextContextTable(m_data.texts.Length);
                m_movieTables[fullPath] = table;
                }

                for (int i = 0; i < m_data.texts.Length; ++i) {
                Format.Text text = m_data.texts[i];
                if (text.nameStringId != -1) {
                TextContext context =
                    new TextContext(this, gameObject, m_data, text);
                table.contexts[i] = context;
                string textName = m_data.strings[text.nameStringId];
                List<TextContext> contexts;
                if (!table.map.TryGetValue(textName, out contexts))
                    table.map[textName] = new List<TextContext>();
                table.map[textName].Add(context);
                }
                }
            }
Beispiel #2
0
            protected void CreateTextContexts(Data data)
            {
                m_data = data;
                m_defaultTable = new TextContextTable(m_data.texts.Length);

                for (int i = 0; i < m_data.texts.Length; ++i) {
                Format.Text text = m_data.texts[i];
                if (text.nameStringId != -1) {
                TextContext context =
                    new TextContext(this, gameObject, m_data, text);
                m_defaultTable.contexts[i] = context;
                string textName = m_data.strings[text.nameStringId];
                List<TextContext> contexts;
                if (!m_defaultTable.map.TryGetValue(textName, out contexts))
                    m_defaultTable.map[textName] = new List<TextContext>();
                m_defaultTable.map[textName].Add(context);
                }
                }
            }
Beispiel #3
0
            protected void CreateTextContexts(Data data)
            {
                m_data         = data;
                m_defaultTable = new TextContextTable(m_data.texts.Length);

                for (int i = 0; i < m_data.texts.Length; ++i)
                {
                    Format.Text text = m_data.texts[i];
                    if (text.nameStringId != -1)
                    {
                        TextContext context =
                            new TextContext(this, gameObject, m_data, text);
                        m_defaultTable.contexts[i] = context;
                        string             textName = m_data.strings[text.nameStringId];
                        List <TextContext> contexts;
                        if (!m_defaultTable.map.TryGetValue(textName, out contexts))
                        {
                            m_defaultTable.map[textName] = new List <TextContext>();
                        }
                        m_defaultTable.map[textName].Add(context);
                    }
                }
            }
Beispiel #4
0
            private string GetTextInternal(TextContextTable table, string name)
            {
                List<TextContext> contexts;
                if (table == null ||
                !table.map.TryGetValue(name, out contexts) || contexts == null)
                return null;

                if (contexts[0].bitmapFontRenderer != null)
                return contexts[0].bitmapFontRenderer.GetText();
                if (contexts[0].systemFontRenderer != null)
                return contexts[0].systemFontRenderer.GetText();
                return null;
            }
Beispiel #5
0
            private bool SetTextInternal(TextContextTable table,
		string name, string text, UnityEngine.Color[] colors = null)
            {
                List<TextContext> contexts;
                if (table == null ||
                !table.map.TryGetValue(name, out contexts) || contexts == null)
                return false;

                bool result = true;
                foreach (TextContext context in contexts) {
                if (context.bitmapFontRenderer != null) {
                if (colors == null) {
                    if (!context.bitmapFontRenderer.SetText(
                            text, context.color))
                        result = false;
                } else {
                    if (!context.bitmapFontRenderer.SetText(text, colors))
                        result = false;
                }
                } else if (context.systemFontRenderer != null) {
                if (!context.systemFontRenderer.SetText(text, context.color))
                    result = false;
                } else {
                result = false;
                }
                }
                return result;
            }