void LateUpdate() { VTile t = tile.GetTile(); VLayer l = t.GetLayer(layerIndex); VAnimation a = t.GetAnimation(animationIndex); bool active = layerIndex == t.GetLayerIndex() && animationIndex == t.GetAnimationIndex() && frameIndex == t.GetFrameIndex(); cachedVChunk = t.GetChunk(layerIndex, animationIndex, frameIndex); if (GetChunk().IsDirty() || t.GetPalette().IsDirty() || l.IsDirty() || a.IsDirty()) { Refresh(); } bool visible = l.GetVisible() && animationIndex == t.GetAnimationIndex() && frameIndex == t.GetFrameIndex(); gameObject.layer = (visible && (active || (!l.GetOutline() && !l.GetTransparent()))) ? 10 : 0; if (Tool.editing && active) { visible = false; } if (mr) { mr.enabled = visible; } }
void Layers() { GUILayout.BeginVertical("box", GUILayout.Width(200)); showLayers = GUILayout.Toggle(showLayers, "Layers", "boxhead"); int layerIndex = ed.tile.GetLayerIndex(); if (showLayers) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("+", GUILayout.Width(20))) { actQueue.Enqueue(new AddLayerAct("Layer " + ed.tile.GetLayerCount())); } GUILayout.EndHorizontal(); for (int i = ed.tile.GetLayerCount() - 1; i >= 0; i--) { VLayer layer = ed.tile.GetLayer(i); GUILayout.BeginHorizontal(); layerIndex = GUILayout.Toggle(layerIndex == i, layerIndex == i ? "" : "", "button", GUILayout.Width(20)) ? i : layerIndex; string name = GUILayout.TextField(layer.GetName(), GUILayout.Width(60)); bool vis = GUILayout.Toggle(layer.GetVisible(), "V", "button", GUILayout.Width(20)); bool trans = GUILayout.Toggle(layer.GetTransparent(), "T", "button", GUILayout.Width(20)); bool line = GUILayout.Toggle(layer.GetOutline(), "O", "button", GUILayout.Width(20)); GUILayout.FlexibleSpace(); if (ed.tile.GetLayerCount() > 1) { if (GUILayout.Button("-", GUILayout.Width(20))) { actQueue.Enqueue(new RemoveLayerAct(i)); } } else { GUILayout.Space(25f); } GUILayout.EndHorizontal(); if (name != layer.GetName() || vis != layer.GetVisible() || trans != layer.GetTransparent() || line != layer.GetOutline()) { actQueue.Enqueue(new ChangeLayerInfoAct(i, name, vis, trans, line)); } } } GUILayout.EndVertical(); if (repaint) { boxRects.Add(GUILayoutUtility.GetLastRect()); } if (layerIndex != ed.tile.GetLayerIndex()) { actQueue.Enqueue(new ChangeLayerIndexAct(layerIndex)); } }
public override bool IsNoOp() { VLayer layer = Edit.use.tile.GetLayer(layerIndex); return(name == layer.GetName() && visible == layer.GetVisible() && transparent == layer.GetTransparent() && outline == layer.GetOutline()); }