/// <summary>
 /// The set action.
 /// </summary>
 /// <param name="actionMsg">
 /// The action.
 /// </param>
 public void SetAction(WhenDone actionMsg)
 {
     this.IsCancelled = false;
     this.Ticks       = 0;
     timer.Start();
     this.action = EnumHelper <WhenDone> .GetDisplay(actionMsg);
 }
コード例 #2
0
ファイル: Coroutine.cs プロジェクト: m0rphi23/ExileApi
 public bool Done(bool force = false)
 {
     if (Priority == CoroutinePriority.Critical)
     {
         return(false);
     }
     Running = false;
     IsDone  = true;
     WhenDone?.Invoke(this, EventArgs.Empty);
     return(IsDone);
 }
コード例 #3
0
 internal static void sendWhenDone(ArrayList list)
 {
     if (list == null)
     {
         return;
     }
     for (int i = 0; i < list.Count; ++i)
     {
         WhenDone wd = (WhenDone)list[i];
         try { wd.actor._enqueue(wd.future, false); }
         catch (System.Exception e) { Err.dumpStack(e); }
     }
 }
コード例 #4
0
        /**
         * Constructor
         *
         * @param hostName      The name of the host
         * @param port          The port
         * @param whenConnected Called once connection established
         */
        public Connection(string hostName, int port, WhenDone whenConnected)
        {
            Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);

            sock.BeginConnect(hostName, port, (result) => {
                sock.EndConnect(result);

                stream = new NetworkStream(sock, true);

                if (result.IsCompleted)
                {
                    whenConnected();
                }
            }, sock);

            form = new BinaryFormatter();
        }
コード例 #5
0
        /**
         * Called to host a game asynchronously
         *
         * @param numPlayers       Number of players to wait for
         * @param whenAllConnected Called when all playes connected
         */
        public void hostGame(uint numPlayers, WhenDone whenAllConnected)
        {
            players = new Connection[numPlayers - 1];

            isHosting = true;

            uint             connPlayers = 0; // Number of players connected
            List <IPAddress> hosts       = new List <IPAddress>();

            Socket servSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);

            servSock.Bind(new IPEndPoint(IPAddress.Any, PORT));
            servSock.Listen(4);
            servSock.BeginAccept((result) => {
                if (result.IsCompleted)
                {
                    Socket cliSock      = servSock.EndAccept(result);
                    IPEndPoint endPoint = (IPEndPoint)cliSock.RemoteEndPoint;
                    hosts.Add(endPoint.Address);
                    players[connPlayers++] = new Connection(servSock.EndAccept(result));
                }

                if (connPlayers == numPlayers - 1)
                {
                    // Send player list message to all players
                    PlayerListMessage msg = new PlayerListMessage();
                    msg.hosts             = hosts.ToArray();
                    foreach (Connection c in players)
                    {
                        c.send(msg);
                    }

                    whenAllConnected();
                }
            }, servSock);
        }
コード例 #6
0
 /**
  * Called to join a game asynchronously
  * @param hostName String containing the hostname of the game to join.
  * @param whenConnected Called when connected
  */
 public void joinGame(String hostName, WhenDone whenConnected)
 {
     Connection host = new Connection(hostName, PORT, () => {
     });
 }
コード例 #7
0
 public void DoWhenFinished()
 {
     WhenDone?.Invoke(this, null);
 }
コード例 #8
0
ファイル: Mobile.cs プロジェクト: karliky/wowwow
		public void FakeCast( int spell, Mobile target, float x, float y, float z, WhenDone trigger )
		{
			int offset = 4;
			Converter.ToBytes( Guid, tempBuff, ref offset );
			Converter.ToBytes( Guid, tempBuff, ref offset );
			Converter.ToBytes( spell, tempBuff, ref offset );
			BaseAbility ba = (BaseAbility)Abilities.abilities[ spell ];
			Converter.ToBytes( (ushort)0x100, tempBuff, ref offset );
			Converter.ToBytes( cast.castingtime, tempBuff, ref offset );
			Converter.ToBytes( cast.type = (ushort)0x40, tempBuff, ref offset );					
			Converter.ToBytes( spellTargetX = x, tempBuff, ref offset );
			Converter.ToBytes( spellTargetY = y, tempBuff, ref offset );
			Converter.ToBytes( spellTargetZ = z, tempBuff, ref offset );
			ToAllPlayerNear( OpCodes.SMSG_SPELL_START, tempBuff, offset );	

			CastFakeSpellTimer cfst = new CastFakeSpellTimer( this, target, spell, cast.castingtime, trigger );
		}
コード例 #9
0
ファイル: Mobile.cs プロジェクト: karliky/wowwow
		public void FakeCast( int spell, Mobile target, WhenDone trigger )
		{
			byte []buff = { 0,0, 0,0, 0xD9, 0xDB, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD9, 0xDB, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
			int offset = 4;
			
			Converter.ToBytes( target.Guid, buff, ref offset );
			Converter.ToBytes( Guid, buff, ref offset );
			Converter.ToBytes( spell, buff, ref offset );
			Converter.ToBytes( 0x100, buff, ref offset );
			Converter.ToBytes( 0, buff, ref offset );
			//if ( lastSeen != null && lastSeen.Player != null )
			ToAllPlayerNear( OpCodes.SMSG_SPELL_START, buff, buff.Length );
			/*else
					if ( this is Character )
					( this as Character ).Player.ToAllPlayerNear( OpCodes.SMSG_SPELL_START, buff, buff.Length );
				else
					if ( SummonedBy != null )
					( SummonedBy as Character ).Player.ToAllPlayerNear( OpCodes.SMSG_SPELL_START, buff, buff.Length );
				else
					if ( target.SummonedBy != null )
					( target.SummonedBy as Character ).Player.ToAllPlayerNear( OpCodes.SMSG_SPELL_START, buff, buff.Length );
					*/
			CastFakeSpellTimer cfst = new CastFakeSpellTimer( this, target, spell, (int)Abilities.abilities[ spell ].CastingTime( this ), trigger );
			//Console.WriteLine( "Begin cast at {0}", DateTime.Now.Ticks );
		}
コード例 #10
0
ファイル: Mobile.cs プロジェクト: karliky/wowwow
		/*
				65 77 E4 00 00 00 00 00 
				65 77 E4 00 00 00 00 00 
				62 1C 00 00 
				02 00 00 00 
				00 00 02 00 
				36 B7 E3 00 00 00 00 00*/
		public void FakeCastSpe( int spell, Mobile target, WhenDone trigger )
		{
			
			int offset = 4;
			
			Converter.ToBytes( Guid, tempBuff, ref offset );
			Converter.ToBytes( Guid, tempBuff, ref offset );
			Converter.ToBytes( spell, tempBuff, ref offset );
			Converter.ToBytes( 2, tempBuff, ref offset );
			Converter.ToBytes( 0x20000, tempBuff, ref offset );
			Converter.ToBytes( target.Guid, tempBuff, ref offset );
			ToAllPlayerNear( OpCodes.SMSG_SPELL_START, tempBuff, offset );
			CastFakeSpellTimerSpe cfst = new CastFakeSpellTimerSpe( this, target, spell, (int)Abilities.abilities[ spell ].CastingTime( this ), trigger );
		}