Exemplo n.º 1
0
 void OnDestroy()
 {
     if (buttonInspector != null)
     {
         GameObject.DestroyImmediate(buttonInspector.gameObject);
         buttonInspector = null;
     }
 }
Exemplo n.º 2
0
    void OnGUI()
    {
        LWFObject[] lwfObjects =
            FindObjectsOfType(typeof(LWFObject)) as LWFObject[];
        if (lwfObjects == null || lwfObjects.Length == 0)
        {
            if (buttonInspector != null)
            {
                GameObject.DestroyImmediate(buttonInspector.gameObject);
            }
            return;
        }

        if (buttonInspector == null)
        {
            GameObject obj = new GameObject("LWFObjectButtonInspector");
            obj.hideFlags   = HideFlags.HideAndDontSave;
            buttonInspector = obj.AddComponent <LWFObjectButtonInspector>();
            buttonInspector.SetVisibilities(visibilities);
        }

        EditorGUILayout.BeginVertical();
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

        foreach (LWFObject lwfObject in lwfObjects)
        {
            EditorGUI.indentLevel = 0;
            LWF.LWF lwf = lwfObject.lwf;
            if (lwf == null)
            {
                continue;
            }

            string name =
                string.Format("{0} / {1}", lwfObject.lwfName, lwf.name);
            if (lwf.parent != null)
            {
                string parentName = lwf.parent.name;
                if (parentName == null)
                {
                    parentName = "(null)";
                }
                string parentFullname = lwf.parent.GetFullName();
                if (parentFullname == null)
                {
                    parentFullname = "(null)";
                }
                name += string.Format(" / attached:{0} on:{1} / {2}",
                                      lwf.attachName, parentName, parentFullname);
            }

            if (!visibilities.ContainsKey(lwfObject))
            {
                visibilities[lwfObject] = true;
            }
            visibilities[lwfObject] =
                EditorGUILayout.Foldout(visibilities[lwfObject], name);
            if (!visibilities[lwfObject])
            {
                continue;
            }

            lwfObject.lwf.Inspect((obj, hierarchy, depth, rOffset) => {
                ObjectContainer container =
                    new ObjectContainer(lwfObject, obj, hierarchy, depth,
                                        obj.lwf.renderingIndex, obj.lwf.renderingCount,
                                        rOffset);
                objects[obj] = container;

                if (obj.parent != null)
                {
                    objects[obj.parent].objects[depth] = container;
                }
            });

            DrawInspector(objects[lwfObject.lwf.rootMovie]);
        }

        EditorGUILayout.EndScrollView();
        EditorGUILayout.EndVertical();
    }
Exemplo n.º 3
0
	void OnGUI()
	{
		LWFObject[] lwfObjects =
			FindObjectsOfType(typeof(LWFObject)) as LWFObject[];
		if (lwfObjects == null || lwfObjects.Length == 0) {
			if (buttonInspector != null)
				GameObject.DestroyImmediate(buttonInspector.gameObject);
			return;
		}

		if (buttonInspector == null) {
			GameObject obj = new GameObject("LWFObjectButtonInspector");
			obj.hideFlags = HideFlags.HideAndDontSave;
			buttonInspector = obj.AddComponent<LWFObjectButtonInspector>();
			buttonInspector.SetVisibilities(visibilities);
		}

		EditorGUILayout.BeginVertical();
		scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

		foreach (LWFObject lwfObject in lwfObjects) {
			EditorGUI.indentLevel = 0;
			LWF.LWF lwf = lwfObject.lwf;
			if (lwf == null)
				continue;

			string name =
				string.Format("{0} / {1}", lwfObject.lwfName, lwf.name);
			if (lwf.parent != null) {
				string parentName = lwf.parent.name;
				if (parentName == null)
					parentName = "(null)";
				string parentFullname = lwf.parent.GetFullName();
				if (parentFullname == null)
					parentFullname = "(null)";
				name += string.Format(" / attached:{0} on:{1} / {2}",
					lwf.attachName, parentName, parentFullname);
			}

			if (!visibilities.ContainsKey(lwfObject))
				visibilities[lwfObject] = true;
			visibilities[lwfObject] =
				EditorGUILayout.Foldout(visibilities[lwfObject], name);
			if (!visibilities[lwfObject])
				continue;

			lwfObject.lwf.Inspect((obj, hierarchy, depth, rOffset) => {
				ObjectContainer container =
					new ObjectContainer(lwfObject, obj, hierarchy, depth,
						obj.lwf.renderingIndex, obj.lwf.renderingCount,
						rOffset);
				objects[obj] = container;

				if (obj.parent != null)
					objects[obj.parent].objects[depth] = container;
			});

			DrawInspector(objects[lwfObject.lwf.rootMovie]);
		}

		EditorGUILayout.EndScrollView();
		EditorGUILayout.EndVertical();
	}
Exemplo n.º 4
0
	void OnDestroy()
	{
		if (buttonInspector != null) {
			GameObject.DestroyImmediate(buttonInspector.gameObject);
			buttonInspector = null;
		}
	}