Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
update
  • Loading branch information
cping committed Apr 20, 2019
1 parent 12afad1 commit 4cf9556
Show file tree
Hide file tree
Showing 69 changed files with 267 additions and 192 deletions.
11 changes: 11 additions & 0 deletions Java/Loon-Neo/src/loon/LGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,26 +83,37 @@ public Error(String message, Throwable cause) {

protected static Platform _platform = null;

//单独纹理批处理缓存
private final IntMap<LTextureBatch> _texture_batch_pools;

//mesh缓存
private final ObjectMap<String, Mesh> _texture_mesh_pools;

//纹理惰性加载缓存
private final ObjectMap<String, LTexture> _texture_lazys;

//全部纹理数据
private final TArray<LTexture> _texture_all_list;

//精灵group缓存
private final TArray<Sprites> _sprites_pools;

//桌面group缓存
private final TArray<Desktop> _desktop_pools;

//ifnot缓存
private final TArray<IFont> _font_pools;

//错误接口
public Act<Error> errors = Act.create();

//状态接口
public Act<Status> status = Act.create();

//游戏窗体刷新接口
public Act<LGame> frame = Act.create();

//游戏基本设置
public LSetting setting;

protected LProcess processImpl;
Expand Down
2 changes: 1 addition & 1 deletion Java/Loon-Neo/src/loon/LSetting.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public class LSetting {
/**
* 当前应用版本号
*/
public String version = "unkown";
public String version = LSystem.UNKOWN;

/**
* 允许注销纹理(为false所有纹理都不被注销)
Expand Down
3 changes: 3 additions & 0 deletions Java/Loon-Neo/src/loon/LSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ private LSystem() {

public static final String FLAG_SELECT_TAG = "◆";

public static final String EMPTY = "";

public static final String UNKOWN = "unkown";
// 默认缓存数量
public static final int DEFAULT_MAX_CACHE_SIZE = 32;

Expand Down
44 changes: 24 additions & 20 deletions Java/Loon-Neo/src/loon/Screen.java
Original file line number Diff line number Diff line change
Expand Up @@ -328,25 +328,29 @@ void paint(GLEx g) {
}

void update(LTimerContext c) {
switch (type) {
case DRAW_USER:
screen.alter(c);
break;
case DRAW_SPRITE:
screen.spriteRun = (screen.sprites != null && screen.sprites.size() > 0);
if (screen.spriteRun) {
screen.sprites.update(c.timeSinceLastUpdate);
}
break;
case DRAW_DESKTOP:
screen.desktopRun = (screen.desktop != null && screen.desktop.size() > 0);
if (screen.desktopRun) {
screen.desktop.update(c.timeSinceLastUpdate);
try {
switch (type) {
case DRAW_USER:
screen.alter(c);
break;
case DRAW_SPRITE:
screen.spriteRun = (screen.sprites != null && screen.sprites.size() > 0);
if (screen.spriteRun) {
screen.sprites.update(c.timeSinceLastUpdate);
}
break;
case DRAW_DESKTOP:
screen.desktopRun = (screen.desktop != null && screen.desktop.size() > 0);
if (screen.desktopRun) {
screen.desktop.update(c.timeSinceLastUpdate);
}
break;
case DRAW_EMPTY:
default:
break;
}
break;
case DRAW_EMPTY:
default:
break;
} catch (Throwable cause) {
LSystem.error("Screen update() dispatch failure", cause);
}
}
}
Expand All @@ -360,11 +364,11 @@ public Screen(String name) {
}

public Screen(int w, int h) {
this("unkown", w, h);
this(LSystem.UNKOWN, w, h);
}

public Screen() {
this("unkown", 0, 0);
this(LSystem.UNKOWN, 0, 0);
}

protected void init(String name, int w, int h) {
Expand Down
2 changes: 1 addition & 1 deletion Java/Loon-Neo/src/loon/action/ActionScript.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected final float convertToFloat(String num) {
public TweenTo<ActionTween> start() {
if (_tween != null) {
if (_src != null) {
String result = StringUtils.replace(_src, LSystem.LS, "");
String result = StringUtils.replace(_src, LSystem.LS, LSystem.EMPTY);
String[] list = StringUtils.split(result, "->");
for (String cmd : list) {
if (cmd.length() > 0) {
Expand Down
6 changes: 3 additions & 3 deletions Java/Loon-Neo/src/loon/action/avg/AVGAnm.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void load(String script) {
final String key = op[0].trim();
final String value = op[1].trim();
if ("path".equalsIgnoreCase(key)) {
path = StringUtils.replace(value, "\"", "");
path = StringUtils.replace(value, "\"", LSystem.EMPTY);
if (texture != null) {
texture.close();
texture = null;
Expand All @@ -145,7 +145,7 @@ private void load(String script) {
String[] p = value.split(",");
if (p.length > 2 && p.length < 5) {
for (int i = 0; i < p.length; i++) {
p[i] = p[i].replaceAll("^[\\t ]*", "").replaceAll("[\\t ]*$", "");
p[i] = p[i].replaceAll("^[\\t ]*", "").replaceAll("[\\t ]*$", LSystem.EMPTY);
}
if (p.length == 3) {
color = new LColor(Integer.parseInt(p[0]), Integer.parseInt(p[1]), Integer.parseInt(p[2]));
Expand Down Expand Up @@ -173,7 +173,7 @@ private void load(String script) {
} else if ("pos".equalsIgnoreCase(key)) {
String[] p = value.split(",");
for (int i = 0; i < p.length; i++) {
p[i] = p[i].replaceAll("^[\\t ]*", "").replaceAll("[\\t ]*$", "");
p[i] = p[i].replaceAll("^[\\t ]*", "").replaceAll("[\\t ]*$", LSystem.EMPTY);
}
switch (p.length) {
case 1:
Expand Down
10 changes: 5 additions & 5 deletions Java/Loon-Neo/src/loon/action/avg/AVGCG.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void setBackgroundCG(LTexture backgroundCG) {
private final static String _update(final String n) {
String name = n;
if (StringUtils.startsWith(name, '"')) {
name = StringUtils.replace(name, "\"", "");
name = StringUtils.replace(name, "\"", LSystem.EMPTY);
}
return name;
}
Expand All @@ -97,7 +97,7 @@ public void add(final String resName, AVGChara chara) {
String path = _update(resName);
synchronized (charas) {
chara.setFlag(ISprite.TYPE_FADE_OUT, charaShowDelay);
this.charas.put(path.replaceAll(" ", "").toLowerCase(), chara);
this.charas.put(path.replaceAll(" ", LSystem.EMPTY).toLowerCase(), chara);
}
}

Expand All @@ -112,7 +112,7 @@ public void add(final String resName, float x, float y, float w, float h) {
public void add(final String resName, int x, int y, int w, int h) {
String path = _update(resName);
synchronized (charas) {
String keyName = path.replaceAll(" ", "").toLowerCase();
String keyName = path.replaceAll(" ", LSystem.EMPTY).toLowerCase();
AVGChara chara = (AVGChara) charas.get(keyName);
if (chara == null) {
chara = new AVGChara(path, x, y, w, h);
Expand All @@ -129,7 +129,7 @@ public void add(final String resName, int x, int y, int w, int h) {
public AVGChara remove(final String resName) {
String path = _update(resName);
synchronized (charas) {
final String name = path.replaceAll(" ", "").toLowerCase();
final String name = path.replaceAll(" ", LSystem.EMPTY).toLowerCase();
AVGChara chara = null;
if (style) {
chara = (AVGChara) charas.get(name);
Expand All @@ -150,7 +150,7 @@ public void replace(String res1, String res2) {
String path1 = _update(res1);
String path2 = _update(res2);
synchronized (charas) {
final String name = path1.replaceAll(" ", "").toLowerCase();
final String name = path1.replaceAll(" ", LSystem.EMPTY).toLowerCase();
AVGChara old = null;
if (style) {
old = (AVGChara) charas.get(name);
Expand Down
2 changes: 1 addition & 1 deletion Java/Loon-Neo/src/loon/action/avg/AVGChara.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public AVGChara(final String resName, final int x, final int y) {
public AVGChara(final String resName, final int x, final int y, final int w, final int h) {
String path = resName;
if (StringUtils.startsWith(path, '"')) {
path = resName.replaceAll("\"", "");
path = resName.replaceAll("\"", LSystem.EMPTY);
}
if (path.endsWith(".an")) {
this.x = x;
Expand Down
4 changes: 2 additions & 2 deletions Java/Loon-Neo/src/loon/action/avg/AVGScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public void call() {

@Override
public void parameters(String[] pars) {
parameter = StringUtils.replace(pars[0], "\"", "");
parameter = StringUtils.replace(pars[0], "\"", LSystem.EMPTY);
}
});
/**
Expand Down Expand Up @@ -1024,7 +1024,7 @@ public AVGScreen nextScript() {
}
}
} else {
text = StringUtils.replace(mesFlag, "\"", "");
text = StringUtils.replace(mesFlag, "\"", LSystem.EMPTY);
if (orderFlag != null) {
String[] optSize = StringUtils.split(orderFlag, ',');
if (optSize.length == 4) {
Expand Down
4 changes: 2 additions & 2 deletions Java/Loon-Neo/src/loon/action/avg/drama/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public Command setRead(boolean isRead) {
*/
public String[] getReads() {
String result = readBuffer.toString();
result = StringUtils.replace(result, SELECTS_TAG, "");
result = StringUtils.replace(result, SELECTS_TAG, LSystem.EMPTY);
return StringUtils.split(result, FLAG_CHAR);
}

Expand Down Expand Up @@ -834,7 +834,7 @@ public String doExecute() {
if (!backIfBool && !esleflag) {
// 存在if判断
if (value.length > 1 && IF_TAG.equals(value[1])) {
esleover = esleflag = setupIF(StringUtils.replace(cmd, ELSE_TAG, "").trim(), nowPosFlagName,
esleover = esleflag = setupIF(StringUtils.replace(cmd, ELSE_TAG, LSystem.EMPTY).trim(), nowPosFlagName,
setEnvironmentList, conditionEnvironmentList);
addCommand = false;
// 单纯的else
Expand Down
5 changes: 3 additions & 2 deletions Java/Loon-Neo/src/loon/action/avg/drama/CommandLink.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package loon.action.avg.drama;

import loon.BaseIO;
import loon.LSystem;
import loon.utils.StringKeyValue;

public class CommandLink {
Expand All @@ -10,7 +11,7 @@ public class CommandLink {
private int _lineCount = 0;

public CommandLink(String path) {
this(path, "unkown");
this(path, LSystem.UNKOWN);
}

public CommandLink(String path, String name) {
Expand All @@ -21,7 +22,7 @@ public CommandLink(String path, String name) {
}

public CommandLink() {
_commands = new StringKeyValue(1024, "unkown");
_commands = new StringKeyValue(1024, LSystem.UNKOWN);
}

public CommandLink line(CharSequence c) {
Expand Down
22 changes: 11 additions & 11 deletions Java/Loon-Neo/src/loon/action/avg/drama/RocScript.java
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ private void debug(String s) {

private void debug(String[] strs) {
if (debug) {
String str = "";
String str = LSystem.EMPTY;
if (commands != null) {
for (int i = 0; i < commands.size(); i++)
str += "\t";
Expand Down Expand Up @@ -728,7 +728,7 @@ private void macrosCommand(String context, int id) {

private void println() throws ScriptException {
debug("Println");
String lastDelim = "";
String lastDelim = LSystem.EMPTY;
while (nextItem() && itemType != EOL && itemType != EOP) {
scriptLog.info(analysis());
lastDelim = item;
Expand All @@ -746,7 +746,7 @@ private void println() throws ScriptException {

private void print() throws ScriptException {
debug("Print");
String lastDelim = "";
String lastDelim = LSystem.EMPTY;
while (nextItem() && itemType != EOL && itemType != EOP) {
scriptLog.line(analysis());
lastDelim = item;
Expand Down Expand Up @@ -1015,7 +1015,7 @@ private Object execFunct() throws ScriptException {
return null;
}
nextItem();
String value = "";
String value = LSystem.EMPTY;

if (!item.equals(")")) {
while (item.indexOf(")") == -1) {
Expand All @@ -1032,7 +1032,7 @@ private Object execFunct() throws ScriptException {
if (value.length() > 0 && value.indexOf(",") == -1) {
if (value.indexOf("\"") == -1 && value.indexOf("/") == -1 && !isNumber(value)) {
String tmp = getVarVal(value).toString();
if (!"unkown".equalsIgnoreCase(tmp)) {
if (!LSystem.UNKOWN.equalsIgnoreCase(tmp)) {
value = tmp;
}
}
Expand All @@ -1042,7 +1042,7 @@ private Object execFunct() throws ScriptException {
for (String s : split) {
if (s.indexOf("\"") == -1 && value.indexOf("/") == -1 && !isNumber(s)) {
String tmp = getVarVal(s).toString();
if (!"unkown".equalsIgnoreCase(tmp)) {
if (!LSystem.UNKOWN.equalsIgnoreCase(tmp)) {
sbr.append(tmp.toString());
} else {
sbr.append(s);
Expand All @@ -1059,7 +1059,7 @@ private Object execFunct() throws ScriptException {

}
Object reuslt = _rocFunctions.getValue(this, key, value);
return reuslt == null ? "unkown" : reuslt;
return reuslt == null ? LSystem.UNKOWN : reuslt;
}

Function f = (Function) functs.get(item.toLowerCase());
Expand Down Expand Up @@ -1257,7 +1257,7 @@ private boolean nextCommand() throws ScriptException {

char ch = ' ';

item = "";
item = LSystem.EMPTY;
itemType = NONE;
commType = UNKNCOM;
macroType = -1;
Expand Down Expand Up @@ -1366,7 +1366,7 @@ private boolean nextCommand() throws ScriptException {
itemType = VARIABLE;
}
if (commType == WAIT) {
item = "";
item = LSystem.EMPTY;
int count = 0;
while (textIdx < _temp_contexts.length) {
ch = _temp_contexts[textIdx];
Expand Down Expand Up @@ -1933,7 +1933,7 @@ private Object queryJson(Object value, String vname, String method) {
if (!vname.equals(method)) {
start = vname.indexOf(method);
int size = start + method.length() + 1;
String packName = "";
String packName = LSystem.EMPTY;
if (size >= vname.length()) {
packName = method;
} else {
Expand Down Expand Up @@ -2141,7 +2141,7 @@ private Object getVarVal(String vname) throws ScriptException {
}

if (o == null) {
o = "unkown";
o = LSystem.UNKOWN;
}
debug("Get var: " + o);
return o;
Expand Down
3 changes: 2 additions & 1 deletion Java/Loon-Neo/src/loon/action/collision/Gravity.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package loon.action.collision;

import loon.LRelease;
import loon.LSystem;
import loon.action.ActionBind;
import loon.geom.RectBox;

Expand Down Expand Up @@ -58,7 +59,7 @@ public class Gravity implements LRelease {
public RectBox bounds = new RectBox();

public Gravity(ActionBind o) {
this("unkown", o);
this(LSystem.UNKOWN, o);
}

public Gravity(String name, ActionBind o) {
Expand Down
2 changes: 1 addition & 1 deletion Java/Loon-Neo/src/loon/action/map/TileMapConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static TArray<int[]> loadList(final String fileName) {
StringTokenizer br = new StringTokenizer(result, LSystem.NL);
TArray<int[]> records = new TArray<int[]>(CollectionUtils.INITIAL_CAPACITY);
for (; br.hasMoreTokens();) {
result = StringUtils.replace(br.nextToken().trim(), LSystem.LS, "");
result = StringUtils.replace(br.nextToken().trim(), LSystem.LS, LSystem.EMPTY);
if (!StringUtils.isEmpty(result)) {
String[] stringArray = result.split(",");
int size = stringArray.length;
Expand Down
Loading

0 comments on commit 4cf9556

Please sign in to comment.