Пример #1
0
 // start point, called by invoke
 public void Bind()
 {
     try
     {
         //WriteLine( "CSAICInterface.Bind >>>" );
         
         initai = new _InitAI( InitAI );
         InitAIInstancePointer = Marshal.GetFunctionPointerForDelegate( initai );
         SetInitAICallback( InitAIInstancePointer );
         
         update = new _Update( Update );
         UpdateInstancePointer = Marshal.GetFunctionPointerForDelegate( update );
         SetUpdateCallback( UpdateInstancePointer );
         
         gotchatmsg = new _GotChatMsg( GotChatMsg );
         GotChatMsgInstancePointer = Marshal.GetFunctionPointerForDelegate( gotchatmsg );
         SetGotChatMsgCallback( GotChatMsgInstancePointer );
         
         unitcreated = new _UnitCreated( UnitCreated );
         UnitCreatedInstancePointer = Marshal.GetFunctionPointerForDelegate( unitcreated );
         SetUnitCreatedCallback( UnitCreatedInstancePointer );
         
         unitfinished = new _UnitFinished( UnitFinished );
         UnitFinishedInstancePointer = Marshal.GetFunctionPointerForDelegate( unitfinished );
         SetUnitFinishedCallback( UnitFinishedInstancePointer );
         
         unitidle = new _UnitIdle( UnitIdle );
         UnitIdleInstancePointer = Marshal.GetFunctionPointerForDelegate( unitidle );
         SetUnitIdleCallback( UnitIdleInstancePointer );
         
         unitmovefailed = new _UnitMoveFailed( UnitMoveFailed );
         UnitMoveFailedInstancePointer = Marshal.GetFunctionPointerForDelegate( unitmovefailed );
         SetUnitMoveFailedCallback( UnitMoveFailedInstancePointer );
         
         unitdamaged = new _UnitDamaged( UnitDamaged );
         UnitDamagedInstancePointer = Marshal.GetFunctionPointerForDelegate( unitdamaged );
         SetUnitDamagedCallback( UnitDamagedInstancePointer );
         
         unitdestroyed = new _UnitDestroyed( UnitDestroyed );
         UnitDestroyedInstancePointer = Marshal.GetFunctionPointerForDelegate( unitdestroyed );
         SetUnitDestroyedCallback( UnitDestroyedInstancePointer );
         
         enemyenterlos = new _EnemyEnterLOS( EnemyEnterLOS );
         EnemyEnterLOSInstancePointer = Marshal.GetFunctionPointerForDelegate( enemyenterlos );
         SetEnemyEnterLOSCallback( EnemyEnterLOSInstancePointer );
         
         enemyleavelos = new _EnemyLeaveLOS( EnemyLeaveLOS );
         EnemyLeaveLOSInstancePointer = Marshal.GetFunctionPointerForDelegate( enemyleavelos );
         SetEnemyLeaveLOSCallback( EnemyLeaveLOSInstancePointer );
         
         enemyenterradar = new _EnemyEnterRadar( EnemyEnterRadar );
         EnemyEnterRadarInstancePointer = Marshal.GetFunctionPointerForDelegate( enemyenterradar );
         SetEnemyEnterRadarCallback( EnemyEnterRadarInstancePointer );
         
         enemyleaveradar = new _EnemyLeaveRadar( EnemyLeaveRadar );
         EnemyLeaveRadarInstancePointer = Marshal.GetFunctionPointerForDelegate( enemyleaveradar );
         SetEnemyLeaveRadarCallback( EnemyLeaveRadarInstancePointer );
         
         enemydamaged = new _EnemyDamaged( EnemyDamaged );
         EnemyDamagedInstancePointer = Marshal.GetFunctionPointerForDelegate( enemydamaged );
         SetEnemyDamagedCallback( EnemyDamagedInstancePointer );
         
         enemydestroyed = new _EnemyDestroyed( EnemyDestroyed );
         EnemyDestroyedInstancePointer = Marshal.GetFunctionPointerForDelegate( enemydestroyed );
         SetEnemyDestroyedCallback( EnemyDestroyedInstancePointer );
                     
        // WriteLine( "CSAICInterface.Bind <<<" );
     }
     catch(Exception e )
     {
         sw = new StreamWriter("outbind.log", false );
         WriteLine( e.ToString() );
         sw.Flush();
         sw.Close();
     }
 }
Пример #2
0
        // start point, called by invoke
        public void Bind()
        {
            try
            {
                //WriteLine( "CSAICInterface.Bind >>>" );

                initai = new _InitAI(InitAI);
                InitAIInstancePointer = Marshal.GetFunctionPointerForDelegate(initai);
                SetInitAICallback(InitAIInstancePointer);

                update = new _Update(Update);
                UpdateInstancePointer = Marshal.GetFunctionPointerForDelegate(update);
                SetUpdateCallback(UpdateInstancePointer);

                gotchatmsg = new _GotChatMsg(GotChatMsg);
                GotChatMsgInstancePointer = Marshal.GetFunctionPointerForDelegate(gotchatmsg);
                SetGotChatMsgCallback(GotChatMsgInstancePointer);

                unitcreated = new _UnitCreated(UnitCreated);
                UnitCreatedInstancePointer = Marshal.GetFunctionPointerForDelegate(unitcreated);
                SetUnitCreatedCallback(UnitCreatedInstancePointer);

                unitfinished = new _UnitFinished(UnitFinished);
                UnitFinishedInstancePointer = Marshal.GetFunctionPointerForDelegate(unitfinished);
                SetUnitFinishedCallback(UnitFinishedInstancePointer);

                unitidle = new _UnitIdle(UnitIdle);
                UnitIdleInstancePointer = Marshal.GetFunctionPointerForDelegate(unitidle);
                SetUnitIdleCallback(UnitIdleInstancePointer);

                unitmovefailed = new _UnitMoveFailed(UnitMoveFailed);
                UnitMoveFailedInstancePointer = Marshal.GetFunctionPointerForDelegate(unitmovefailed);
                SetUnitMoveFailedCallback(UnitMoveFailedInstancePointer);

                unitdamaged = new _UnitDamaged(UnitDamaged);
                UnitDamagedInstancePointer = Marshal.GetFunctionPointerForDelegate(unitdamaged);
                SetUnitDamagedCallback(UnitDamagedInstancePointer);

                unitdestroyed = new _UnitDestroyed(UnitDestroyed);
                UnitDestroyedInstancePointer = Marshal.GetFunctionPointerForDelegate(unitdestroyed);
                SetUnitDestroyedCallback(UnitDestroyedInstancePointer);

                enemyenterlos = new _EnemyEnterLOS(EnemyEnterLOS);
                EnemyEnterLOSInstancePointer = Marshal.GetFunctionPointerForDelegate(enemyenterlos);
                SetEnemyEnterLOSCallback(EnemyEnterLOSInstancePointer);

                enemyleavelos = new _EnemyLeaveLOS(EnemyLeaveLOS);
                EnemyLeaveLOSInstancePointer = Marshal.GetFunctionPointerForDelegate(enemyleavelos);
                SetEnemyLeaveLOSCallback(EnemyLeaveLOSInstancePointer);

                enemyenterradar = new _EnemyEnterRadar(EnemyEnterRadar);
                EnemyEnterRadarInstancePointer = Marshal.GetFunctionPointerForDelegate(enemyenterradar);
                SetEnemyEnterRadarCallback(EnemyEnterRadarInstancePointer);

                enemyleaveradar = new _EnemyLeaveRadar(EnemyLeaveRadar);
                EnemyLeaveRadarInstancePointer = Marshal.GetFunctionPointerForDelegate(enemyleaveradar);
                SetEnemyLeaveRadarCallback(EnemyLeaveRadarInstancePointer);

                enemydamaged = new _EnemyDamaged(EnemyDamaged);
                EnemyDamagedInstancePointer = Marshal.GetFunctionPointerForDelegate(enemydamaged);
                SetEnemyDamagedCallback(EnemyDamagedInstancePointer);

                enemydestroyed = new _EnemyDestroyed(EnemyDestroyed);
                EnemyDestroyedInstancePointer = Marshal.GetFunctionPointerForDelegate(enemydestroyed);
                SetEnemyDestroyedCallback(EnemyDestroyedInstancePointer);

                // WriteLine( "CSAICInterface.Bind <<<" );
            }
            catch (Exception e)
            {
                sw = new StreamWriter("outbind.log", false);
                WriteLine(e.ToString());
                sw.Flush();
                sw.Close();
            }
        }