public override void OnInspectorGUI() { D2D_Helper.BaseRect = D2D_Helper.Reserve(0.0f); D2D_Helper.BaseRectSet = true; EditorGUI.BeginChangeCheck(); serializedObject.UpdateIfDirtyOrScript(); Target = (T)target; Targets = targets.Select(t => (T)t).ToArray(); Separator(); OnInspector(); Separator(); serializedObject.ApplyModifiedProperties(); if (EditorGUI.EndChangeCheck() == true) { GUI.changed = true; Repaint(); foreach (var t in Targets) { D2D_Helper.SetDirty(t); } } D2D_Helper.BaseRectSet = false; }
public void MarkAsDirty() { #if UNITY_EDITOR if (dirty == false) { D2D_Helper.SetDirty(this); } #endif dirty = true; }
public virtual void OnSceneGUI() { Target = (T)target; OnScene(); if (GUI.changed == true) { D2D_Helper.SetDirty(target); } }
public void MarkAsDirty() { #if UNITY_EDITOR if (dirty == false) { D2D_Helper.SetDirty(this); } #endif dirty = true; cachedSolidPixelCount = -1; }
public void ReplaceAlphaWith(D2D_Pixels newPixels) { DeserializeAlphaTex(); #if UNITY_EDITOR if (alphaTex != null) { D2D_Helper.Record(alphaTex, "Modify Alpha Tex"); } #endif if (newPixels != null) { // Remake texture? if (alphaTex == null || alphaTex.width != newPixels.Width || alphaTex.height != newPixels.Height) { DestroyAlphaTex(); alphaTex = newPixels.Apply(TextureFormat.Alpha8); alphaScaleX = D2D_Helper.Reciprocal(alphaTex.width - 1); alphaScaleY = D2D_Helper.Reciprocal(alphaTex.height - 1); alphaTex.wrapMode = TextureWrapMode.Clamp; } // Copy settings over? else { alphaTex.SetPixels32(newPixels.Pixels); alphaTex.Apply(); } UpdateRect(0, alphaTex.width, 0, alphaTex.height); } else { DestroyAlphaTex(); UpdateRect(0, 0, 0, 0); } cachedSolidPixelCount = 0; alphaTexData = null; alphaTexWidth = 0; alphaTexHeight = 0; Dirty = true; NotifyChanges(); #if UNITY_EDITOR D2D_Helper.SetDirty(this); #endif }
private void DrawAlphaTex() { var newAlphaTex = (Texture2D)EditorGUI.ObjectField(D2D_Helper.Reserve(), "Alpha Tex", Target.AlphaTex, typeof(Texture2D), false); if (newAlphaTex != Target.AlphaTex) { D2D_Helper.Record(Targets, "Replace Destructible Sprite Alpha"); foreach (var t in Targets) { t.ReplaceAlphaWith(newAlphaTex); D2D_Helper.SetDirty(t); } } }
private void DestroyAllCells() { if (cells.Count > 0) { foreach (var cell in cells) { cell.Destroy(); } cells.Clear(); #if UNITY_EDITOR D2D_Helper.SetDirty(this); #endif } }