@Override public void onLoad() { // 设置默认字体大小为20号字 LFont.setDefaultFont(LFont.getFont(20)); TArray<ListItem> list = new TArray<ListItem>(); ListItem item = new ListItem(); item.name = "表格1"; item.list.add("ffffff"); item.list.add("gggggggg"); item.list.add("hhhhhhhhh"); list.add(item); ListItem item2 = new ListItem(); item2.name = "表格2"; item2.list.add("zzzzzz"); item2.list.add("kkkkkkkk"); item2.list.add("xxxxxxxxx"); list.add(item2); LTable table = new LTable(LFont.getDefaultFont(), 60, 60, 300, 300); table.setData(list, 100); add(table); add(MultiScreenTest.getBackButton(this)); }
public boolean removeAll(TArray<? extends T> array, boolean identity) { if (array.size == 0) { return true; } int size = this.size; int startSize = size; T[] items = this.items; if (identity) { for (int i = 0, n = array.size; i < n; i++) { T item = array.get(i); for (int ii = 0; ii < size; ii++) { if (item == items[ii]) { removeIndex(ii); size--; break; } } } } else { for (int i = 0, n = array.size; i < n; i++) { T item = array.get(i); for (int ii = 0; ii < size; ii++) { if (item.equals(items[ii])) { removeIndex(ii); size--; break; } } } } return size != startSize; }
public void close() { this.visible = false; int size = barCaches.size; for (int i = 0; i < size; i++) { StatusBar bar = barCaches.get(i); if (bar != null) { bar.close(); bar = null; } } barCaches.clear(); barCaches = null; }
public void remove(String name) { if (!StringUtils.isEmpty(name)) { String funName = name.trim().toLowerCase(); _system_functs.remove(funName); _rocFunctions.remove(funName); } }
/** * 添加自定义函数到脚本中 * * @param name * @param rfunction */ public void add(String name, IRocFunction rfunction) { if (!StringUtils.isEmpty(name)) { String funName = name.trim().toLowerCase(); _system_functs.add(funName); _rocFunctions.put(funName, rfunction); } }
public StatusBar addBar(int value, int maxValue, int x, int y, int w, int h) { synchronized (barCaches) { StatusBar bar = new StatusBar(value, maxValue, x, y, w, h); barCaches.add(bar); return bar; } }
public boolean removeBar(StatusBar bar) { if (bar == null) { return false; } synchronized (barCaches) { return barCaches.remove(bar); } }
@Override public void remove() { if (!allowRemove) { throw new RuntimeException("Remove not allowed."); } index--; array.removeIndex(index); }
public void reset() { _system_functs.clear(); _system_functs.add("trim"); _system_functs.add("rtrim"); _system_functs.add("isnumber"); _system_functs.add("ischinese"); _system_functs.add("indexof"); _system_functs.add("jump"); }
public void parse(XMLElement element) { TArray<XMLElement> properties = element.list("property"); if (properties == null) { properties = element.getParent().list("property"); } for (int p = 0; p < properties.size; p++) { XMLElement property = properties.get(p); String name = property.getAttribute("name", ""); String value = property.getAttribute("value", ""); if (MathUtils.isNan(value)) { if (value.indexOf('.') != -1) { put(name, Float.parseFloat(value)); } else { put(name, Integer.parseInt(value)); } } else { put(name, value); } } }
/** * 删除指定集合中的所有角色 * * @param objects */ public void removeObjects(TArray<Actor> objects) { if (isClose) { return; } synchronized (objects) { Iterator<Actor> iter = objects.iterator(); while (iter.hasNext()) { Actor actor = iter.next(); this.removeObject(actor); } } }
public void createUI(GLEx g) { if (!visible) { return; } int size = barCaches.size; if (size > 0) { synchronized (barCaches) { for (int i = 0; i < size; i++) { StatusBar bar = barCaches.get(i); if (bar != null && bar.visible) { bar.createUI(g); } } } } }
public void update(long elapsedTime) { if (!visible) { return; } int size = barCaches.size; if (size > 0) { synchronized (barCaches) { for (int i = 0; i < size; i++) { StatusBar bar = barCaches.get(i); if (bar != null && bar.visible) { bar.update(elapsedTime); } } } } }
private void parse(String text) throws Exception { if (displays == null) { displays = new ObjectMap<String, Display>(DEFAULT_MAX_CHAR); } else { displays.clear(); } StringTokenizer br = new StringTokenizer(text, LSystem.LS); info = br.nextToken(); common = br.nextToken(); page = br.nextToken(); ObjectMap<Short, TArray<Short>> kerning = new ObjectMap<Short, TArray<Short>>(64); TArray<CharDef> charDefs = new TArray<CharDef>(DEFAULT_MAX_CHAR); int maxChar = 0; boolean done = false; for (; !done; ) { String line = br.nextToken(); if (line == null) { done = true; } else { if (line.startsWith("chars c")) { } else if (line.startsWith("char")) { CharDef def = parseChar(line); if (def != null) { maxChar = MathUtils.max(maxChar, def.id); charDefs.add(def); } } if (line.startsWith("kernings c")) { } else if (line.startsWith("kerning")) { StringTokenizer tokens = new StringTokenizer(line, " ="); tokens.nextToken(); tokens.nextToken(); short first = Short.parseShort(tokens.nextToken()); tokens.nextToken(); int second = Integer.parseInt(tokens.nextToken()); tokens.nextToken(); int offset = Integer.parseInt(tokens.nextToken()); TArray<Short> values = kerning.get(new Short(first)); if (values == null) { values = new TArray<Short>(); kerning.put(new Short(first), values); } values.add(new Short((short) ((offset << 8) | second))); } } } this.chars = new CharDef[maxChar + 1]; for (Iterator<CharDef> iter = charDefs.iterator(); iter.hasNext(); ) { CharDef def = iter.next(); chars[def.id] = def; } for (Entries<Short, TArray<Short>> iter = kerning.entries(); iter.hasNext(); ) { Entry<Short, TArray<Short>> entry = iter.next(); short first = entry.key; TArray<Short> valueList = entry.value; short[] valueArray = new short[valueList.size]; int i = 0; for (Iterator<Short> valueIter = valueList.iterator(); valueIter.hasNext(); i++) { valueArray[i] = (valueIter.next()).shortValue(); } chars[first].kerning = valueArray; } }
public void clear() { synchronized (barCaches) { barCaches.clear(); } }
public void addBar(StatusBar bar) { synchronized (barCaches) { barCaches.add(bar); } }