/* */ package NET.worlds.scape; /* */ /* */ import java.io.IOException; /* */ import java.io.PrintStream; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class SetPoint2Action /* */ extends SlidePropertyAction /* */ { /* 18 */ private Point2 _value = null; /* */ /* */ private Point2 _start; /* */ /* */ /* */ public Persister trigger(Event e, Persister seqID) /* */ { /* 25 */ Persister ret = null; /* 26 */ Point2 val = null; /* 27 */ if (useParam()) { /* 28 */ String p = param(); /* 29 */ if (p == null) { /* 30 */ this._value = null; /* */ } else { /* 32 */ float x = 0.0F;float y = 0.0F; /* 33 */ boolean ok = true; /* 34 */ int comma = p.indexOf(','); /* 35 */ if (comma == -1) { /* 36 */ ok = false; /* */ } else { /* */ try { /* 39 */ x = Float.valueOf(p.substring(0, comma)).floatValue(); /* 40 */ p = p.substring(comma + 1); /* 41 */ y = Float.valueOf(p).floatValue(); /* */ } /* */ catch (NumberFormatException nfe) { /* 44 */ ok = false; /* */ } /* */ } /* 47 */ if (!ok) { /* 48 */ x = 0.0F; /* 49 */ y = 0.0F; /* 50 */ System.out.println(getName() + " unable to parse " + /* 51 */ paramName()); /* */ } /* 53 */ this._value = new Point2(x, y); /* */ } /* */ } /* 56 */ if (this._value == null) { /* 57 */ if ((!$assertionsDisabled) && (slide())) throw new AssertionError(); /* */ } /* */ else { /* 60 */ if (slide()) { /* 61 */ if (seqID == null) { /* 62 */ start(); /* 63 */ this._start = ((Point2)get()); /* */ } /* 65 */ float frac = fraction(); /* 66 */ if ((frac < 1.0D) && (this._start != null)) { /* 67 */ val = new Point2(this._value); /* 68 */ val.x = ((this._value.x - this._start.x) * frac + this._start.x); /* 69 */ val.y = ((this._value.y - this._start.y) * frac + this._start.y); /* 70 */ ret = this; /* */ } /* */ } /* 73 */ if (val == null) /* 74 */ val = this._value; /* */ } /* 76 */ set(val); /* 77 */ return ret; /* */ } /* */ /* */ public Object properties(int index, int offset, int mode, Object value) /* */ throws NoSuchPropertyException /* */ { /* 83 */ Object ret = null; /* 84 */ switch (index - offset) { /* */ case 0: /* 86 */ if (mode == 0) { /* 87 */ ret = Point2PropertyEditor.make(new Property(this, index, /* 88 */ "Set To").allowSetNull()); /* 89 */ if (this._value == null) { /* 90 */ ret = MaybeNullPropertyEditor.make((Property)ret, /* 91 */ new Point2()); /* */ } /* */ } /* 94 */ else if (mode == 1) { /* 95 */ ret = this._value; /* 96 */ } else if (mode == 2) { /* 97 */ this._value = ((Point2)value); /* 98 */ } else if (mode == 4) { /* 99 */ this._value = null; } /* 100 */ break; /* */ default: /* 102 */ ret = super.properties(index, offset + 1, mode, value); /* */ } /* 104 */ return ret; /* */ } /* */ /* 107 */ private static Object classCookie = new Object(); /* */ /* */ public void saveState(Saver s) throws IOException /* */ { /* 111 */ s.saveVersion(1, classCookie); /* 112 */ super.saveState(s); /* 113 */ s.saveMaybeNull(this._value); /* */ } /* */ /* */ public void restoreState(Restorer r) throws IOException, TooNewException /* */ { /* 118 */ switch (r.restoreVersion(classCookie)) { /* */ case 1: /* 120 */ super.restoreState(r); /* 121 */ this._value = ((Point2)r.restoreMaybeNull()); /* 122 */ break; /* */ /* */ default: /* 125 */ throw new TooNewException(); /* */ } /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\SetPoint2Action.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */