/* */ package NET.worlds.scape; /* */ /* */ import NET.worlds.console.Console; /* */ import NET.worlds.network.URL; /* */ import java.awt.Color; /* */ import java.io.PrintStream; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ class MaterialTexture /* */ extends SuperRoot /* */ implements NonPersister /* */ { /* */ private URL fileName; /* */ private StringTexture stexture; /* 1051 */ private String text = ""; /* 1052 */ private String font = Console.message("MaterialFont"); /* */ /* 1054 */ private int size = 48; /* 1055 */ private Color foregroundColor = Color.white; /* 1056 */ private Color backgroundColor = Color.black; /* */ /* */ MaterialTexture(URL textureName) { /* 1059 */ this.fileName = textureName; /* */ } /* */ /* */ MaterialTexture(StringTexture texture) { /* 1063 */ this.stexture = texture; /* 1064 */ this.text = this.stexture.getText(); /* 1065 */ this.font = this.stexture.getFont(); /* 1066 */ this.size = this.stexture.getSize(); /* 1067 */ this.foregroundColor = this.stexture.getForegroundColor(); /* 1068 */ this.backgroundColor = this.stexture.getBackgroundColor(); /* */ } /* */ /* */ private void setFile(URL name, boolean force) { /* 1072 */ this.fileName = name; /* 1073 */ if ((this.stexture == null) || (force)) { /* 1074 */ this.stexture = null; /* 1075 */ ((Material)getOwner()).loadTexture(name); /* */ } /* */ } /* */ /* */ private void makeString() { /* 1080 */ Material owner = (Material)getOwner(); /* */ /* 1082 */ this.stexture = new StringTexture(this.text, this.font, this.size, this.foregroundColor, /* 1083 */ this.backgroundColor); /* 1084 */ owner.setTexture(this.stexture); /* */ } /* */ /* */ private String getText() { /* 1088 */ return this.text; /* */ } /* */ /* */ private void setText(String text) { /* 1092 */ this.text = text; /* 1093 */ if (this.stexture != null) /* 1094 */ makeString(); /* */ } /* */ /* */ private void setFont(String font) { /* 1098 */ this.font = font; /* 1099 */ if (this.stexture != null) /* 1100 */ makeString(); /* */ } /* */ /* */ private void setSize(int size) { /* 1104 */ if ((size < 1) || (size > 720)) { /* 1105 */ Console.println(Console.message("Font-sizes")); /* */ } else { /* 1107 */ this.size = size; /* 1108 */ if (this.stexture != null) /* 1109 */ makeString(); /* */ } /* */ } /* */ /* */ private void setForegroundColor(Color color) { /* 1114 */ this.foregroundColor = color; /* 1115 */ if (this.stexture != null) /* 1116 */ makeString(); /* */ } /* */ /* */ private void setBackgroundColor(Color color) { /* 1120 */ this.backgroundColor = color; /* 1121 */ if (this.stexture != null) { /* 1122 */ makeString(); /* */ } /* */ } /* */ /* */ /* */ public Object properties(int index, int offset, int mode, Object value) /* */ throws NoSuchPropertyException /* */ { /* 1130 */ Object ret = null; /* 1131 */ switch (index - offset) { /* */ case 0: /* 1133 */ if (mode == 0) { /* 1134 */ ret = BooleanPropertyEditor.make(new Property(this, index, /* 1135 */ "Texture Type (Text String)"), /* 1136 */ "Texture loaded from an image file.", /* 1137 */ "Texture created from a text string."); /* 1138 */ } else if (mode == 1) { /* 1139 */ ret = new Boolean(this.stexture != null); /* 1140 */ } else if (mode == 2) { /* 1141 */ boolean stringTexture = ((Boolean)value).booleanValue(); /* 1142 */ if ((stringTexture) && (this.stexture == null)) { /* 1143 */ makeString(); /* 1144 */ } else if ((!stringTexture) && (this.stexture != null)) /* 1145 */ setFile(this.fileName, true); /* */ } /* 1147 */ break; /* */ case 1: /* 1149 */ if (mode == 0) { /* 1150 */ ret = new Property(this, index, "File"); /* 1151 */ if (this.stexture == null) /* 1152 */ ret = URLPropertyEditor.make((Property)ret, /* 1153 */ TextureDecoder.getAllExts()); /* 1154 */ } else if (mode == 1) { /* 1155 */ ret = this.fileName; /* 1156 */ } else if (mode == 2) { /* 1157 */ setFile((URL)value, false); } /* 1158 */ break; /* */ case 2: /* 1160 */ if (mode == 0) { /* 1161 */ ret = new Property(this, index, "Text"); /* 1162 */ if (this.stexture != null) /* 1163 */ ret = StringPropertyEditor.make((Property)ret); /* 1164 */ } else if (mode == 1) { /* 1165 */ ret = getText(); /* 1166 */ } else if (mode == 2) { /* 1167 */ setText((String)value); } /* 1168 */ break; /* */ case 3: /* 1170 */ if (mode == 0) { /* 1171 */ ret = new Property(this, index, "Font"); /* 1172 */ if (this.stexture != null) /* 1173 */ ret = StringPropertyEditor.make((Property)ret); /* 1174 */ } else if (mode == 1) { /* 1175 */ ret = this.font; /* 1176 */ } else if (mode == 2) { /* 1177 */ setFont((String)value); /* */ } /* 1179 */ if (value != null) { /* 1180 */ System.out.println("Setting font " + (String)value + " in Material.java"); /* */ } /* 1182 */ break; /* */ case 4: /* 1184 */ if (mode == 0) { /* 1185 */ ret = new Property(this, index, "Size"); /* 1186 */ if (this.stexture != null) /* 1187 */ ret = IntegerPropertyEditor.make((Property)ret); /* 1188 */ } else if (mode == 1) { /* 1189 */ ret = new Integer(this.size); /* 1190 */ } else if (mode == 2) { /* 1191 */ setSize(((Integer)value).intValue()); } /* 1192 */ break; /* */ case 5: /* 1194 */ if (mode == 0) { /* 1195 */ ret = new Property(this, index, "Foreground Color"); /* 1196 */ if (this.stexture != null) /* 1197 */ ret = ColorPropertyEditor.make((Property)ret); /* 1198 */ } else if (mode == 1) { /* 1199 */ ret = this.foregroundColor; /* 1200 */ } else if (mode == 2) { /* 1201 */ setForegroundColor((Color)value); } /* 1202 */ break; /* */ case 6: /* 1204 */ if (mode == 0) { /* 1205 */ ret = new Property(this, index, "Background Color"); /* 1206 */ if (this.stexture != null) /* 1207 */ ret = ColorPropertyEditor.make((Property)ret); /* 1208 */ } else if (mode == 1) { /* 1209 */ ret = this.backgroundColor; /* 1210 */ } else if (mode == 2) { /* 1211 */ setBackgroundColor((Color)value); } /* 1212 */ break; /* */ default: /* 1214 */ ret = super.properties(index, offset + 7, mode, value); /* */ } /* 1216 */ return ret; /* */ } /* */ /* */ public String toString() { /* 1220 */ if (this.stexture != null) { /* 1221 */ return this.stexture; /* */ } /* 1223 */ Material owner = (Material)getOwner(); /* 1224 */ URL name = null; /* 1225 */ if (owner != null) /* 1226 */ name = owner.textureName; /* 1227 */ if (name == null) { /* 1228 */ return "File "; /* */ } /* 1230 */ return "File " + name; /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\MaterialTexture.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */