Exemplo n.º 1
0
        public static bool Event(eScripting eScripting)
        {
            if (Scripting._hLua_X64 != null || Scripting._hLua_X86 != null || Scripting._hCompiled != null)
            {
                if (!Scripting._bLoaded && (eScripting == eScripting.OnRun || eScripting == eScripting.OnFrame))
                {
                    Scripting._bLoaded = true;
                    Scripting.Event(eScripting.OnLoad);
                }
                try
                {
                    if (Scripting._hCompiled != null)
                    {
                        switch (eScripting)
                        {
                        case eScripting.OnClose:
                            Scripting._hCompiled.hInterface.OnClose();
                            break;

                        case eScripting.OnLoad:
                            Scripting._hCompiled.hInterface.OnLoad();
                            break;

                        case eScripting.OnRun:
                            Scripting._hCompiled.hInterface.OnRun();
                            break;
                        }
                    }
                    else if (Scripting._hLua_X64 != null)
                    {
                        LuaInterface_X64.LuaFunction function = Scripting._hLua_X64.LuaEngine.GetFunction(eScripting.ToString());
                        if (function == null)
                        {
                            return(false);
                        }
                        function.Call();
                    }
                    else
                    {
                        LuaInterface_X86.LuaFunction function = Scripting._hLua_X86.LuaEngine.GetFunction(eScripting.ToString());
                        if (function == null)
                        {
                            return(false);
                        }
                        function.Call();
                    }
                    return(true);
                }
                catch (Exception ex)
                {
                    int num = 1;
                    Program.Exception(ex, num != 0);
                    Scripting.Close();
                }
            }
            return(false);
        }
Exemplo n.º 2
0
 private static void _OnHotKey(Keys hKey, KeysModifier hModifier)
 {
     if (Scripting._hLua_X64 == null && Scripting._hLua_X86 == null)
     {
         return;
     }
     foreach (KeyValuePair <string, ArrayList> keyValuePair in Scripting._hHotKey)
     {
         try
         {
             if ((Keys)keyValuePair.Value[0] == hKey)
             {
                 if ((KeysModifier)keyValuePair.Value[1] == hModifier)
                 {
                     if (Scripting._hLua_X64 != null)
                     {
                         LuaInterface_X64.LuaFunction function = Scripting._hLua_X64.LuaEngine.GetFunction(keyValuePair.Key);
                         if (function == null)
                         {
                             break;
                         }
                         function.Call();
                         break;
                     }
                     LuaInterface_X86.LuaFunction function1 = Scripting._hLua_X86.LuaEngine.GetFunction(keyValuePair.Key);
                     if (function1 == null)
                     {
                         break;
                     }
                     function1.Call();
                     break;
                 }
             }
         }
         catch (Exception ex)
         {
         }
     }
 }