public void rotationSelector(TextureEditGUI gui, ref Rotation rotation, ref bool mirror) { GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandHeight(true)); GUILayout.Label("Direction"); int selection = (int) rotation; int oldSelection = selection; selection = GUILayout.SelectionGrid(selection, _rotationGrid, 2); bool oldMirror = mirror; mirror = GUILayout.Toggle(mirror, "Mirror"); if (oldMirror != mirror) gui.setRemakePreview(); if (oldSelection != selection) { rotation = (Rotation)selection; gui.setRemakePreview(); } GUILayout.EndVertical(); }
public void positionSelector(TextureEditGUI gui, ref IntVector2 position) { bool repeatOK = false; bool buttonPressed = false; int button = 0; int delta = 1; if ((Time.time - Global.LastRepeat) > Global.AutoRepeatGap) repeatOK = true; if (gui.speedSelection < 0 || gui.speedSelection > 1) gui.speedSelection = 0; if (gui.speedSelection == 1) { button = 4; delta = 10; } GUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(120)); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Position"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(3); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.RepeatButton(_posButtons[button], GUILayout.Width(25), GUILayout.Height(25))) { buttonPressed = true; Global.LastButtonPress = Time.time; if (repeatOK) position.y += delta; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(3); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.RepeatButton(_posButtons[button + 2], GUILayout.Width(25), GUILayout.Height(25))) { buttonPressed = true; Global.LastButtonPress = Time.time; if (repeatOK) position.x -= delta; } GUILayout.Space(5); if (GUILayout.Button("O", GUILayout.Width(25), GUILayout.Height(25))) { position = gui.centrePosition(); gui.setRemakePreview(); } GUILayout.Space(5); if (GUILayout.RepeatButton(_posButtons[button + 3], GUILayout.Width(25), GUILayout.Height(25))) { buttonPressed = true; Global.LastButtonPress = Time.time; if (repeatOK) position.x += delta; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(3); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.RepeatButton(_posButtons[button + 1], GUILayout.Width(25), GUILayout.Height(25))) { buttonPressed = true; Global.LastButtonPress = Time.time; if (repeatOK) position.y -= delta; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(3); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); gui.speedSelection = GUILayout.SelectionGrid(gui.speedSelection, _speedGrid, 2); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); if (buttonPressed && repeatOK) { Global.LastRepeat = Global.LastButtonPress; gui.setRemakePreview(); Global.AutoRepeatGap = Global.AutoRepeatGap * 0.8f; if (Global.AutoRepeatGap < 0.04f) Global.AutoRepeatGap = 0.04f; } }
public void normalMapOptionSelector(TextureEditGUI gui, ref NormalOption normalOption) { GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandHeight(true)); GUILayout.Label("Normal Option"); int selection = (int)normalOption; int oldSelection = selection; selection = GUILayout.SelectionGrid(selection, _normalOptionGrid, 2); if (oldSelection != selection) { normalOption = (NormalOption)selection; gui.setRemakePreview(); } GUILayout.EndVertical(); }
public void colorSelector(TextureEditGUI gui, ref ValueSelector<byte, ByteField> redSelector, ref ValueSelector<byte, ByteField> greenSelector, ref ValueSelector<byte, ByteField> blueSelector, ref ValueSelector<byte, ByteField> alphaSelector) { if (redSelector.draw()) gui.setRemakePreview(); GUILayout.Space(10f); if (greenSelector.draw()) gui.setRemakePreview(); GUILayout.Space(10f); if (blueSelector.draw()) gui.setRemakePreview(); GUILayout.Space(10f); if (alphaSelector.draw()) gui.setRemakePreview(); }
public void blendMethodSelector(TextureEditGUI gui, ref BlendMethod blendMethod) { GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandHeight(true)); GUILayout.Label("Blend Method"); int selection = (int)blendMethod; int oldSelection = selection; selection = GUILayout.SelectionGrid(selection, _blendMethodGrid, 2); if (oldSelection != selection) { blendMethod = (BlendMethod)selection; gui.setRemakePreview(); } GUILayout.EndVertical(); }
public void alphaOptionSelector(TextureEditGUI gui, ref AlphaOption alphaOption) { GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandHeight(true)); GUILayout.Label("Alpha Option"); int selection = (int) alphaOption; int oldSelection = selection; selection = GUILayout.SelectionGrid(selection, _alphaOptionGrid, 1); if (oldSelection != selection) { alphaOption = (AlphaOption) selection; gui.setRemakePreview(); } GUILayout.EndVertical(); }