AssignSlot() 공개 메소드

public AssignSlot ( int id ) : bool
id int
리턴 bool
예제 #1
0
        static bool AssignSlot(ClientConnection conn, int id)
        {
            if (!conn.AssignSlot(id))
            {
                return(false);
            }

            conn.State = SlotState.ASSIGNING_SLOT;
            conn.ResetTimeout();

            var slot = Terraria.Netplay.Clients[id] as ServerSlot;

            slot.remoteAddress = conn.RemoteAddress;
            slot.conn          = conn;

            conn.Player.whoAmi = id;
            Main.player[id]    = conn.Player;

            var age = conn.Age;

            if (age > TimeSpan.FromMilliseconds(500))
            {
                ProgramLog.Log("Slot {1} assigned to {0} after {2}.", slot.remoteAddress, id, age);
            }
            else
            {
                ProgramLog.Log("Slot {1} assigned to {0}.", slot.remoteAddress, id);
            }

            return(true);
        }
        static bool AssignSlot(ClientConnection conn, int id)
        {
            if (!conn.AssignSlot(id))
                return false;

            conn.State = SlotState.ASSIGNING_SLOT;
            conn.ResetTimeout();

            var slot = Terraria.Netplay.Clients[id] as ServerSlot;
            slot.remoteAddress = conn.RemoteAddress;
            slot.conn = conn;

            conn.Player.whoAmi = id;
            Main.player[id] = conn.Player;

            var age = conn.Age;
            if (age > TimeSpan.FromMilliseconds(500))
                ProgramLog.Log("Slot {1} assigned to {0} after {2}.", slot.remoteAddress, id, age);
            else
                ProgramLog.Log("Slot {1} assigned to {0}.", slot.remoteAddress, id);

            return true;
        }