|
@@ -5,30 +5,25 @@ namespace NTERA.Interop
|
|
{
|
|
{
|
|
public class GameInstance
|
|
public class GameInstance
|
|
{
|
|
{
|
|
- private Process emuera;
|
|
|
|
|
|
+ public IConsole Console { get; protected set; }
|
|
|
|
+ public IScriptEngine ScriptEngine { get; set; }
|
|
|
|
|
|
- public void Initialize(IConsole console)
|
|
|
|
|
|
+ public void Run(IConsole console, IScriptEngine scriptEngine)
|
|
{
|
|
{
|
|
|
|
+ Console = console;
|
|
GlobalStatic.Console = console;
|
|
GlobalStatic.Console = console;
|
|
- //GlobalStatic.MainWindow = _window;
|
|
|
|
- emuera = new Process(console);
|
|
|
|
- GlobalStatic.Process = emuera;
|
|
|
|
- //ClearDisplay();
|
|
|
|
- if (!emuera.Initialize())
|
|
|
|
- {
|
|
|
|
- //state = ConsoleState.Error;
|
|
|
|
- //OutputLog(null);
|
|
|
|
- //PrintFlush(false);
|
|
|
|
- //RefreshStrings(true);
|
|
|
|
|
|
+
|
|
|
|
+ ScriptEngine = scriptEngine;
|
|
|
|
+
|
|
|
|
+ if (!ScriptEngine.Initialize(Console))
|
|
return;
|
|
return;
|
|
- }
|
|
|
|
- CallEmueraProgram("");
|
|
|
|
- //RefreshStrings(true);
|
|
|
|
|
|
+
|
|
|
|
+ ScriptEngine.Start();
|
|
}
|
|
}
|
|
|
|
|
|
public void GiveInput(string input)
|
|
public void GiveInput(string input)
|
|
{
|
|
{
|
|
- InputRequest currentRequest = GlobalStatic.Console.CurrentRequest;
|
|
|
|
|
|
+ InputRequest currentRequest = Console.CurrentRequest;
|
|
|
|
|
|
if (GlobalStatic.Console.CurrentRequest != null)
|
|
if (GlobalStatic.Console.CurrentRequest != null)
|
|
{
|
|
{
|
|
@@ -46,43 +41,22 @@ namespace NTERA.Interop
|
|
{
|
|
{
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
+
|
|
if (currentRequest.IsSystemInput)
|
|
if (currentRequest.IsSystemInput)
|
|
- emuera.InputSystemInteger(inputValue);
|
|
|
|
|
|
+ ScriptEngine.InputSystemInteger(inputValue);
|
|
else
|
|
else
|
|
- emuera.InputInteger(inputValue);
|
|
|
|
|
|
+ ScriptEngine.InputInteger(inputValue);
|
|
break;
|
|
break;
|
|
case InputType.StrValue:
|
|
case InputType.StrValue:
|
|
if (string.IsNullOrEmpty(input) && currentRequest.HasDefValue)// && !IsRunningTimer)
|
|
if (string.IsNullOrEmpty(input) && currentRequest.HasDefValue)// && !IsRunningTimer)
|
|
input = currentRequest.DefStrValue;
|
|
input = currentRequest.DefStrValue;
|
|
|
|
|
|
- emuera.InputString(input ?? "");
|
|
|
|
|
|
+ ScriptEngine.InputString(input ?? "");
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
GlobalStatic.Console.GiveInput(input);
|
|
GlobalStatic.Console.GiveInput(input);
|
|
}
|
|
}
|
|
-
|
|
|
|
- private void CallEmueraProgram(string str)
|
|
|
|
- {
|
|
|
|
- //if (!DoInputToEmueraProgram(str))
|
|
|
|
- // return;
|
|
|
|
- //if (state == ConsoleState.Error)
|
|
|
|
- // return;
|
|
|
|
- //state = ConsoleState.Running;
|
|
|
|
- emuera.DoScript();
|
|
|
|
-// if (state == ConsoleState.Running)
|
|
|
|
-// {
|
|
|
|
-////RunningならProcessは処理を継続するべき
|
|
|
|
-// state = ConsoleState.Error;
|
|
|
|
-// PrintError("Emuera error: Unable to determine program status");
|
|
|
|
-// }
|
|
|
|
- //if (state == ConsoleState.Error && !noOutputLog)
|
|
|
|
- // OutputLog(Program.ExeDir + "emuera.log");
|
|
|
|
- //PrintFlush(false);
|
|
|
|
- ////1819 Refreshは呼び出し側で行う
|
|
|
|
- ////RefreshStrings(false);
|
|
|
|
- //NewGeneration();
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|