ScutGame / Scut

Scut is a free, open source, stable game server framework, which support C#/Python/Lua script, and support Unity3d, Cocos2dx, FlashAir client access.
1.33k stars 577 forks source link

ZyGames.Test stress test tool is not work #13

Open kybird opened 8 years ago

kybird commented 8 years ago

version 6.7.9.10

it will not work. because it doesn't have model script..

ScriptEngines.cs

        private static ScriptRuntimeScope InitScriptRuntimeScope()
        {
            //star compile
            if (Interlocked.Exchange(ref _isCompiling, 1) == 0)
            {
                ScriptRuntimeDomain runtimeDomain = null;
                try
                {
                    string runtimePath = MathUtils.RuntimePath ?? MathUtils.RuntimeBinPath;
                    AppDomain.CurrentDomain.AppendPrivatePath(ScriptCompiler.ScriptPath);
                    runtimeDomain = new ScriptRuntimeDomain(typeof(ScriptRuntimeDomain).Name, new[] { _settupInfo.RuntimePrivateBinPath, ScriptCompiler.ScriptPath });
                    foreach (var assemblyName in _settupInfo.ReferencedAssemblyNames)
                    {
                        //排除System的dll
                        if (string.IsNullOrEmpty(assemblyName) ||
                            !Path.IsPathRooted(assemblyName)) continue;
                        string key = Path.GetFileNameWithoutExtension(assemblyName);
                        runtimeDomain.LoadAssembly(key, assemblyName);
                    }
                    var scope = runtimeDomain.CreateScope(_settupInfo);

                    // FAILED HERE BECAUSE IT DOES NOT HAVE MODEL SCRIPT
                    if (scope == null || scope.ModelAssembly == null) return scope;

                    bool isFirstRun = _runtimeDomain == null;
                    if (!isFirstRun && _settupInfo.ModelChangedBefore != null)
                    {
                        _settupInfo.ModelChangedBefore(_runtimeDomain.Scope.ModelAssembly);
                    }
                    runtimeDomain.MainInstance = runtimeDomain.Scope.Execute(_settupInfo.ScriptMainProgram, _settupInfo.ScriptMainTypeName) as IMainScript;
                   // NEVER COME HERE
                    _runtimeDomain = runtimeDomain;

Remark the IF statement or Add Dummy entity in Model folder