Beispiel #1
0
        public Text(LWF lwf, Movie p, int objId, int instId = -1)
            : base(lwf, p, Format.Object.Type.TEXT, objId)
        {
            Format.Text text = lwf.data.texts[objId];
            m_dataMatrixId = text.matrixId;

            if (text.nameStringId != -1) {
            m_name = lwf.data.strings[text.nameStringId];
            } else {
            if (instId >= 0 && instId < lwf.data.instanceNames.Length) {
                int stringId = lwf.GetInstanceNameStringId(instId);
                if (stringId != -1)
                    m_name = lwf.data.strings[stringId];
            }
            }

            TextRenderer textRenderer =
            lwf.rendererFactory.ConstructText(lwf, objId, this);

            string t = null;
            if (text.stringId != -1)
            t = lwf.data.strings[text.stringId];

            if (text.nameStringId == -1 && string.IsNullOrEmpty(name)) {
            if (text.stringId != -1)
                textRenderer.SetText(t);
            } else {
            lwf.SetTextRenderer(p.GetFullName(), name, t, textRenderer);
            }

            m_renderer = textRenderer;
        }
Beispiel #2
0
        public Text(LWF lwf, Movie p, int objId, int instId = -1)
            : base(lwf, p, Format.Object.Type.TEXT, objId)
        {
            Format.Text text = lwf.data.texts[objId];
            m_dataMatrixId = text.matrixId;

            if (text.nameStringId != -1)
            {
                m_name = lwf.data.strings[text.nameStringId];
            }
            else
            {
                if (instId >= 0 && instId < lwf.data.instanceNames.Length)
                {
                    int stringId = lwf.GetInstanceNameStringId(instId);
                    if (stringId != -1)
                    {
                        m_name = lwf.data.strings[stringId];
                    }
                }
            }

            TextRenderer textRenderer =
                lwf.rendererFactory.ConstructText(lwf, objId, this);

            string t = null;

            if (text.stringId != -1)
            {
                t = lwf.data.strings[text.stringId];
            }

            if (text.nameStringId == -1 && string.IsNullOrEmpty(name))
            {
                if (text.stringId != -1)
                {
                    textRenderer.SetText(t);
                }
            }
            else
            {
#if LWF_USE_LUA
                string lt = lwf.GetTextLua(parent, name);
                if (!System.String.IsNullOrEmpty(lt))
                {
                    t = lt;
                }
#endif
                lwf.SetTextRenderer(p.GetFullName(), name, t, textRenderer);
            }

            m_renderer = textRenderer;
        }