Ejemplo n.º 1
0
 public static void Init()
 {
     ScriptManager = new ScriptManager();
     ScriptManager.LoadAllScripts();
     Player.Init();
     Dialog.Init();
     GameObject.Init();
     Vehicle.Init();
     World.Init();
 }
Ejemplo n.º 2
0
        public static void UnInit()
        {
            ScriptManager.UnloadAllScripts();
            ScriptManager = null;

            Player.UnInit();
            Dialog.UnInit();
            GameObject.UnInit();
            Vehicle.UnInit();
            World.UnInit();
        }
Ejemplo n.º 3
0
        public void LoadAllScripts()
        {
            try
            {
                CoreAsmLocation = Assembly.GetExecutingAssembly().CodeBase;//coreasmloc;
                //AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(currentDomain_AssemblyResolve);
                //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomain_UnhandledException);
                //AppDomain.CurrentDomain.DomainUnload += new System.EventHandler(currentDomain_DomainUnload);
                GameDirectory = System.Environment.CurrentDirectory;
                ScriptFileDirectory = Path.Combine(GameDirectory , "Scripts");
                ScriptFilePattern = new string[] { "*.dll", "*.cs", "*.vb" };
                RunningScripts = new System.Collections.Generic.List<ScriptBase>();
                //System.AppDomain currentDomain = AppDomain.CurrentDomain;
                Instance = this;
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }

            FindScriptAssemblies();

            for (int i = 0; i < RunningScripts.Count; i++)
            {
                if (RunningScripts[i] == null) continue;
                RunningScripts[i].OnLoad();
                if (OnScriptLoad != null) OnScriptLoad(this, new ScriptEventArgs(RunningScripts[i]));
            }
        }