summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/SetColorAction.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/scape/SetColorAction.java')
-rw-r--r--NET/worlds/scape/SetColorAction.java131
1 files changed, 131 insertions, 0 deletions
diff --git a/NET/worlds/scape/SetColorAction.java b/NET/worlds/scape/SetColorAction.java
new file mode 100644
index 0000000..deac3ef
--- /dev/null
+++ b/NET/worlds/scape/SetColorAction.java
@@ -0,0 +1,131 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import java.awt.Color;
+/* */ import java.io.IOException;
+/* */ import java.io.PrintStream;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class SetColorAction
+/* */ extends SlidePropertyAction
+/* */ {
+/* 18 */ private Color _value = null;
+/* */
+/* */ private Color _start;
+/* */
+/* */
+/* */ public Persister trigger(Event e, Persister seqID)
+/* */ {
+/* 25 */ Persister ret = null;
+/* 26 */ Color val = null;
+/* 27 */ if (useParam()) {
+/* */ try {
+/* 29 */ this._value = new Color(Integer.valueOf(param()).intValue());
+/* */ }
+/* */ catch (NumberFormatException nfe) {
+/* 32 */ System.out.println(getName() + " unable to parse " +
+/* 33 */ paramName());
+/* 34 */ this._value = null;
+/* */ }
+/* */ }
+/* 37 */ if (this._value == null) {
+/* 38 */ if ((!$assertionsDisabled) && (slide())) throw new AssertionError();
+/* */ }
+/* */ else {
+/* 41 */ if (slide()) {
+/* 42 */ if (seqID == null) {
+/* 43 */ start();
+/* 44 */ this._start = ((Color)get());
+/* */ }
+/* 46 */ float frac = fraction();
+/* 47 */ if (frac < 1.0D) {
+/* 48 */ int red = (int)((this._value.getRed() - this._start.getRed()) *
+/* 49 */ frac) + this._start.getRed();
+/* 50 */ int grn = (int)((this._value.getGreen() - this._start.getGreen()) *
+/* 51 */ frac) + this._start.getGreen();
+/* 52 */ int blu = (int)((this._value.getBlue() - this._start.getBlue()) *
+/* 53 */ frac) + this._start.getBlue();
+/* 54 */ val = new Color(red, grn, blu);
+/* 55 */ ret = this;
+/* */ }
+/* */ }
+/* 58 */ if (val == null)
+/* 59 */ val = this._value;
+/* */ }
+/* 61 */ set(val);
+/* 62 */ return ret;
+/* */ }
+/* */
+/* */ public Object properties(int index, int offset, int mode, Object value)
+/* */ throws NoSuchPropertyException
+/* */ {
+/* 68 */ Object ret = null;
+/* 69 */ switch (index - offset) {
+/* */ case 0:
+/* 71 */ if (mode == 0) {
+/* 72 */ ret = ColorPropertyEditor.make(new Property(this, index,
+/* 73 */ "Set To").allowSetNull());
+/* 74 */ if (this._value == null) {
+/* 75 */ ret = MaybeNullPropertyEditor.make((Property)ret,
+/* 76 */ Color.black);
+/* */ }
+/* */ }
+/* 79 */ else if (mode == 1) {
+/* 80 */ ret = this._value;
+/* 81 */ } else if (mode == 2) {
+/* 82 */ this._value = ((Color)value);
+/* 83 */ } else if (mode == 4) {
+/* 84 */ this._value = null; }
+/* 85 */ break;
+/* */ default:
+/* 87 */ ret = super.properties(index, offset + 1, mode, value);
+/* */ }
+/* 89 */ return ret;
+/* */ }
+/* */
+/* 92 */ private static Object classCookie = new Object();
+/* */
+/* */ public void saveState(Saver s) throws IOException
+/* */ {
+/* 96 */ s.saveVersion(1, classCookie);
+/* 97 */ super.saveState(s);
+/* 98 */ if (this._value == null) {
+/* 99 */ s.saveBoolean(false);
+/* */ } else {
+/* 101 */ s.saveBoolean(true);
+/* 102 */ s.saveInt(this._value.getRed());
+/* 103 */ s.saveInt(this._value.getGreen());
+/* 104 */ s.saveInt(this._value.getBlue());
+/* */ }
+/* */ }
+/* */
+/* */ public void restoreState(Restorer r) throws IOException, TooNewException
+/* */ {
+/* 110 */ switch (r.restoreVersion(classCookie)) {
+/* */ case 1:
+/* 112 */ super.restoreState(r);
+/* 113 */ if (r.restoreBoolean()) {
+/* 114 */ int red = r.restoreInt();
+/* 115 */ int grn = r.restoreInt();
+/* 116 */ int blu = r.restoreInt();
+/* 117 */ this._value = new Color(red, grn, blu);
+/* */ }
+/* 119 */ break;
+/* */
+/* */ default:
+/* 122 */ throw new TooNewException();
+/* */ }
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\SetColorAction.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file