hotfix lua
parent
e67bf61141
commit
1b49020695
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"version":100
|
||||
}
|
|
@ -1,18 +1,21 @@
|
|||
package com.ljsd.jieling.logic.fight;
|
||||
|
||||
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import org.luaj.vm2.Globals;
|
||||
import org.luaj.vm2.LuaTable;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.luaj.vm2.lib.jse.JsePlatform;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Logger;
|
||||
import java.io.*;
|
||||
|
||||
public class CheckFight {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger("CheckFightLog");
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CheckFight.class);
|
||||
|
||||
private LuaValue transCoderObj;
|
||||
|
||||
|
@ -28,17 +31,41 @@ public class CheckFight {
|
|||
return CheckFight.Instance.instance;
|
||||
}
|
||||
|
||||
private int hotFixVersion = 0;
|
||||
|
||||
static class LuaHotFixBean{
|
||||
private int version;
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void luaHotFix(){
|
||||
LuaHotFixBean luaHotFixBean = STableManager.getJsonFilePathInJsonConf("lua-hotfix.json", LuaHotFixBean.class);
|
||||
if(luaHotFixBean!=null && hotFixVersion < luaHotFixBean.getVersion()){
|
||||
LOGGER.info("the curhotFixVersion={},the new hotFixVersion={} will hotifx ",hotFixVersion,luaHotFixBean.getVersion());
|
||||
init("luafight/BattleMain.lua");
|
||||
LOGGER.info("the luahotfix done");
|
||||
hotFixVersion = luaHotFixBean.getVersion();
|
||||
}
|
||||
}
|
||||
|
||||
public void init(String path){
|
||||
String luaFileName = null;
|
||||
try {
|
||||
luaFileName = getPath(path);
|
||||
// System.out.println("lua path : "+luaFileName);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Globals globals = JsePlatform.debugGlobals();
|
||||
transCoderObj = globals.loadfile(luaFileName).call();
|
||||
LuaHotFixBean luaHotFixBean = STableManager.getJsonFilePathInJsonConf("lua-hotfix.json", LuaHotFixBean.class);
|
||||
if(luaHotFixBean!=null){
|
||||
hotFixVersion = luaHotFixBean.getVersion();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.ljsd.jieling.logic.OnlineUserManager;
|
|||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
||||
import com.ljsd.jieling.logic.fight.CheckFight;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -42,6 +43,7 @@ public class MinuteTask extends Thread {
|
|||
everyFiveTask();
|
||||
everyMondyFiveClockTask();
|
||||
fiveMinuteOnlineSend();
|
||||
CheckFight.getInstance().luaHotFix();
|
||||
LOGGER.info("MinuteTask end...");
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("e",e);
|
||||
|
|
Loading…
Reference in New Issue