Пример #1
0
 public ObjectContainer(
     LWFObject lo, LWF.Object o, int h, int d, int ri, int rc, int ro)
 {
     lwfObject       = lo;
     obj             = o;
     hierarchy       = h;
     depth           = d;
     renderingIndex  = ri;
     renderingCount  = rc;
     renderingOffset = ro;
     objects         = new Dictionary <int, ObjectContainer>();
 }
Пример #2
0
		public ObjectContainer(
			LWFObject lo, LWF.Object o, int h, int d, int ri, int rc, int ro)
		{
			lwfObject = lo;
			obj = o;
			hierarchy = h;
			depth = d;
			renderingIndex = ri;
			renderingCount = rc;
			renderingOffset = ro;
			objects = new Dictionary<int, ObjectContainer>();
		}
Пример #3
0
    void DrawInfo(ObjectContainer container, LWF.Object obj)
    {
        LWF.Matrix m = obj.matrix;
        EditorGUILayout.LabelField("Matrix", string.Format(
                                       "(sx:{0}, sy:{1}, k0:{2}, k1:{3}, tx:{4}, ty:{5}) ri:{6} rc:{7}",
                                       m.scaleX, m.scaleY, m.skew0, m.skew1, m.translateX, m.translateY,
                                       container.renderingIndex, container.renderingCount));

        LWF.ColorTransform c = obj.colorTransform;
        EditorGUILayout.LabelField("ColorTransform",
                                   string.Format("multi:(r:{0},g:{1},b:{2},a:{3}) " +
                                                 "add:(r:{4},g:{5},b:{6},a:{7})",
                                                 c.multi.red, c.multi.green, c.multi.blue, c.multi.alpha,
                                                 c.add.red, c.add.green, c.add.blue, c.add.alpha));
    }
Пример #4
0
    void OnGUI()
    {
        LWFObject[] lwfObjects =
            FindObjectsOfType(typeof(LWFObject)) as LWFObject[];
        if (lwfObjects == null)
        {
            return;
        }

        if (!texture)
        {
            texture = new Texture2D(1, 1);
            texture.SetPixel(0, 0, Color.white);
            texture.Apply();
        }

        Matrix4x4 savedMatrix = GUI.matrix;
        Color     savedColor  = GUI.color;

        foreach (LWFObject lwfObject in lwfObjects)
        {
            bool visibility;
            if (visibilities.TryGetValue(
                    lwfObject, out visibility) && !visibility)
            {
                continue;
            }

            LWF.LWF lwf = lwfObject.lwf;
            if (lwf == null)
            {
                continue;
            }

            lwf.Inspect((obj, hierarchy, depth, rOffset) => {
                if (obj.type != Type.BUTTON)
                {
                    return;
                }

                for (LWF.Object o = obj.parent; o != null; o = o.parent)
                {
                    LWF.Movie m = o as LWF.Movie;
                    if (m != null && !m.visible)
                    {
                        return;
                    }
                    if (visibilities.TryGetValue(
                            o, out visibility) && !visibility)
                    {
                        return;
                    }
                }

                Factory factory = lwf.rendererFactory as Factory;
                if (factory == null)
                {
                    return;
                }

                LWF.Button button = (LWF.Button)obj;
                DrawButton(button, factory);
            });
        }

        GUI.matrix = savedMatrix;
        GUI.color  = savedColor;
    }
Пример #5
0
    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;
            }
        }
    }
Пример #6
0
 static void inspect(LWF.Object obj, int h, int d, int r)
 {
     LWF.Movie mov = obj as LWF.Movie;
     Debug.Log(mov.name);
 }