Esempio n. 1
0
            public eAction OnInspector()
            {
                eAction   a = eAction.NONE;
                POFXLayer l = target as POFXLayer;

                GUI.color = Color.grey;
                GUILayout.BeginVertical(EditorStyles.helpBox);
                GUI.color = Color.white;

                if (l.m_material == null)
                {
                    l.Init();
                }

                if (l.m_material == null)
                {
                    //GUILayout.Label("BUG");
                    return(a);
                }

                POFXBase pofx = l.GetComponent <POFXBase>();
                int      id   = pofx.m_layers.IndexOf(l);


                GUILayout.BeginHorizontal();
                l.m_enable = GUILayout.Toggle(l.m_enable, "");
                GUILayout.Label("" + l.GetName(), EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();

                if (id != 0)
                {
                    if (GUILayout.Button("^", EditorStyles.helpBox))
                    {
                        a = eAction.UP;
                    }
                }

                if (id < pofx.m_layers.Count - 1)
                {
                    if (GUILayout.Button("v", EditorStyles.helpBox))
                    {
                        a = eAction.DOWN;
                    }
                }
                if (GUILayout.Button("X", EditorStyles.helpBox))
                {
                    a = eAction.REMOVE;
                }

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUILayout.BeginVertical(EditorStyles.helpBox);
                DrawUI();
                if (GUI.changed)
                {
                    Undo.RecordObject(l, "POFX layer update");
                }

                GUILayout.EndVertical();
                GUILayout.Space(20);
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                if (l.GetComponent <SpriteRenderer>() != null)
                {
                    l.m_sortingOrderOffset = EditorGUILayout.IntField("Order in layer offset", l.m_sortingOrderOffset);
                }
                else
                {
                    GUILayoutRenderQueue();
                }

                GUILayout.Space(20);
                GUILayout.EndHorizontal();

                if (l.m_enableMaterials.Count > 0)
                {
                    GUILayout.Label("Apply to materials :");
                    GUILayout.BeginHorizontal();
                    for (int m = 0; m < l.m_enableMaterials.Count; ++m)
                    //for (int m = 0; m < 20; ++m)
                    {
                        l.m_enableMaterials[m] = GUILayout.Toggle(l.m_enableMaterials[m], "" + (m + 1), GUILayout.MaxWidth(30));
                        //GUILayout.Toggle(false, "" + m, GUILayout.MaxWidth(35));
                        if (m % 5 == 4)
                        {
                            GUILayout.EndHorizontal();
                            GUILayout.BeginHorizontal();
                        }
                    }
                    GUILayout.EndHorizontal();
                }

                GUILayout.EndVertical();
                GUILayout.Space(5);

                return(a);
            }
Esempio n. 2
0
 public void AddLayer(POFXLayer layer)
 {
     m_layers.Add(layer);
     layer.Init();
     layer.hideFlags = HideFlags.HideInInspector;
 }