public Graphic(LWF lwf, Movie parent, int objId) : base(lwf, parent, Format.Object.Type.GRAPHIC, objId) { Format.Graphic data = lwf.data.graphics[objId]; int n = data.graphicObjects; m_displayList = new Object[n]; Format.GraphicObject[] graphicObjects = lwf.data.graphicObjects; for (int i = 0; i < n; ++i) { Format.GraphicObject gobj = graphicObjects[data.graphicObjectId + i]; Object obj = null; int graphicObjectId = gobj.graphicObjectId; // Ignore error if (graphicObjectId == -1) continue; switch ((Type)gobj.graphicObjectType) { case Type.BITMAP: obj = new Bitmap(lwf, parent, graphicObjectId); break; case Type.BITMAPEX: obj = new BitmapEx(lwf, parent, graphicObjectId); break; case Type.TEXT: obj = new Text(lwf, parent, graphicObjectId); break; } m_displayList[i] = obj; } }
public Graphic(LWF lwf, Movie parent, int objId) : base(lwf, parent, Format.Object.Type.GRAPHIC, objId) { Format.Graphic data = lwf.data.graphics[objId]; int n = data.graphicObjects; m_displayList = new Object[n]; Format.GraphicObject[] graphicObjects = lwf.data.graphicObjects; for (int i = 0; i < n; ++i) { Format.GraphicObject gobj = graphicObjects[data.graphicObjectId + i]; Object obj = null; int graphicObjectId = gobj.graphicObjectId; // Ignore error if (graphicObjectId == -1) { continue; } switch ((Type)gobj.graphicObjectType) { case Type.BITMAP: obj = new Bitmap(lwf, parent, graphicObjectId); break; case Type.BITMAPEX: obj = new BitmapEx(lwf, parent, graphicObjectId); break; case Type.TEXT: obj = new Text(lwf, parent, graphicObjectId); break; } obj.Exec(); m_displayList[i] = obj; } }
void DrawInspector(ObjectContainer container) { EditorGUI.indentLevel = container.hierarchy + 1; LWF.Object obj = container.obj; LWF.LWF lwf = obj.lwf; if (obj.type == Type.MOVIE) { LWF.Movie movie = (LWF.Movie)obj; string movieName = "Movie: " + (movie.name == null ? "(null)" : movie.name); if (!visibilities.ContainsKey(movie)) { visibilities[movie] = true; } visibilities[movie] = EditorGUILayout.Foldout(visibilities[movie], movieName); if (!visibilities[movie]) { return; } EditorGUI.indentLevel = container.hierarchy + 2; string fullName = movie.GetFullName(); if (fullName == null) { fullName = "(null)"; } EditorGUILayout.LabelField("Fullname:", fullName); EditorGUILayout.LabelField("Visible:", movie.visible.ToString()); EditorGUILayout.LabelField("Playing:", movie.playing.ToString()); EditorGUILayout.LabelField("Frame:", movie.currentFrame.ToString()); DrawInfo(container, movie); // TODO EditorGUILayout.Space(); foreach (KeyValuePair <int, ObjectContainer> kvp in container.objects) { DrawInspector(kvp.Value); } } else { EditorGUILayout.LabelField("Depth:", container.depth.ToString()); EditorGUI.indentLevel = container.hierarchy + 2; switch (obj.type) { case Type.BUTTON: LWF.Button button = (LWF.Button)obj; string buttonName = (button.name == null ? "(null)" : button.name); string buttonFullName = button.GetFullName(); if (buttonFullName == null) { buttonFullName = "(null)"; } EditorGUILayout.LabelField("Button:", buttonName); EditorGUI.indentLevel = container.hierarchy + 3; EditorGUILayout.LabelField("Fullname:", buttonFullName); DrawInfo(container, obj); // TODO break; case Type.GRAPHIC: EditorGUILayout.LabelField("Graphic:", ""); EditorGUI.indentLevel = container.hierarchy + 3; DrawInfo(container, obj); // TODO break; case Type.BITMAP: LWF.Bitmap bitmap = (LWF.Bitmap)obj; int tFId = lwf.data.bitmaps[bitmap.objectId].textureFragmentId; string textureName = (tFId == -1 ? "(null)" : lwf.data.textureFragments[tFId].filename); EditorGUILayout.LabelField("Bitmap:", textureName); EditorGUI.indentLevel = container.hierarchy + 3; DrawInfo(container, obj); // TODO break; case Type.BITMAPEX: LWF.BitmapEx bitmapEx = (LWF.BitmapEx)obj; int tFIdEx = lwf.data.bitmapExs[bitmapEx.objectId].textureFragmentId; string textureNameEx = (tFIdEx == -1 ? "(null)" : lwf.data.textureFragments[tFIdEx].filename); EditorGUILayout.LabelField("BitmapEx:", textureNameEx); EditorGUI.indentLevel = container.hierarchy + 3; DrawInfo(container, obj); // TODO break; case Type.TEXT: LWF.Text text = (LWF.Text)obj; string textName = lwf.data.strings[ lwf.data.texts[text.objectId].nameStringId]; EditorGUILayout.LabelField("Text:", textName); EditorGUI.indentLevel = container.hierarchy + 3; DrawInfo(container, obj); // TODO break; case Type.PARTICLE: EditorGUILayout.LabelField("Particle:", ""); EditorGUI.indentLevel = container.hierarchy + 3; DrawInfo(container, obj); // TODO break; case Type.PROGRAMOBJECT: LWF.ProgramObject pObject = (LWF.ProgramObject)obj; string pObjectName = lwf.data.strings[ lwf.data.programObjects[pObject.objectId].stringId]; EditorGUILayout.LabelField("ProgramObject:", pObjectName); EditorGUI.indentLevel = container.hierarchy + 3; DrawInfo(container, obj); // TODO break; } } }
private void ExecObject(int dlDepth, int objId, int matrixId, int colorTransformId, int instId, int dlBlendMode, bool updateBlendMode = false) { // Ignore error if (objId == -1) return; Data data = m_lwf.data; Format.Object dataObject = data.objects[objId]; int dataObjectId = dataObject.objectId; Object obj = m_displayList[dlDepth]; if (obj != null && (obj.type != (Type)dataObject.objectType || obj.objectId != dataObjectId || (obj.IsMovie() && ((IObject)obj).instanceId != instId))) { if (m_texts != null && obj.IsText()) EraseText(obj.objectId); obj.Destroy(); obj = null; } if (obj == null) { switch ((Type)dataObject.objectType) { case Type.BUTTON: obj = new Button(m_lwf, this, dataObjectId, instId, matrixId, colorTransformId); break; case Type.GRAPHIC: obj = new Graphic(m_lwf, this, dataObjectId); break; case Type.MOVIE: obj = new Movie(m_lwf, this, dataObjectId, instId, matrixId, colorTransformId); ((Movie)obj).blendMode = dlBlendMode; break; case Type.BITMAP: obj = new Bitmap(m_lwf, this, dataObjectId); break; case Type.BITMAPEX: obj = new BitmapEx(m_lwf, this, dataObjectId); break; case Type.TEXT: obj = new Text(m_lwf, this, dataObjectId, instId); break; case Type.PARTICLE: obj = new Particle(m_lwf, this, dataObjectId); break; case Type.PROGRAMOBJECT: obj = new ProgramObject(m_lwf, this, dataObjectId); break; } } if (obj.IsMovie() && updateBlendMode) ((Movie)obj).blendMode = dlBlendMode; if (obj.IsMovie() || obj.IsButton()) { IObject instance = (IObject)obj; instance.linkInstance = null; if (m_instanceHead == null) m_instanceHead = instance; else m_instanceTail.linkInstance = instance; m_instanceTail = instance; if (obj.IsButton()) m_hasButton = true; } if (m_texts != null && obj.IsText()) InsertText(obj.objectId); m_displayList[dlDepth] = obj; obj.execCount = m_movieExecCount; obj.Exec(matrixId, colorTransformId); }
private void ExecObject(int dlDepth, int objId, int matrixId, int colorTransformId, int instId) { // Ignore error if (objId == -1) { return; } Data data = m_lwf.data; Format.Object dataObject = data.objects[objId]; int dataObjectId = dataObject.objectId; Object obj = m_displayList[dlDepth]; if (obj != null && (obj.type != (Type)dataObject.objectType || obj.objectId != dataObjectId || (obj.IsMovie() && ((IObject)obj).instanceId != instId))) { if (m_texts != null && obj.IsText()) { EraseText(obj.objectId); } obj.Destroy(); obj = null; } if (obj == null) { switch ((Type)dataObject.objectType) { case Type.BUTTON: obj = new Button(m_lwf, this, dataObjectId, instId, matrixId, colorTransformId); break; case Type.GRAPHIC: obj = new Graphic(m_lwf, this, dataObjectId); break; case Type.MOVIE: obj = new Movie(m_lwf, this, dataObjectId, instId, matrixId, colorTransformId); break; case Type.BITMAP: obj = new Bitmap(m_lwf, this, dataObjectId); break; case Type.BITMAPEX: obj = new BitmapEx(m_lwf, this, dataObjectId); break; case Type.TEXT: obj = new Text(m_lwf, this, dataObjectId, instId); break; case Type.PARTICLE: obj = new Particle(m_lwf, this, dataObjectId); break; case Type.PROGRAMOBJECT: obj = new ProgramObject(m_lwf, this, dataObjectId); break; } } if (obj.IsMovie() || obj.IsButton()) { IObject instance = (IObject)obj; instance.linkInstance = null; if (m_instanceHead == null) { m_instanceHead = instance; } else { m_instanceTail.linkInstance = instance; } m_instanceTail = instance; if (obj.IsButton()) { m_hasButton = true; } } if (m_texts != null && obj.IsText()) { InsertText(obj.objectId); } m_displayList[dlDepth] = obj; obj.execCount = m_movieExecCount; obj.Exec(matrixId, colorTransformId); }