The Hyper
The Hyper
CC#
Created by The Hyper on 6/25/2024 in #help
Stopping Invoking the rest of the registered methods if the bool is true
public class InputHandleEvent
{
private List<Func<bool>> registered_methods;
public InputHandleEvent(int initial_event_capacity)
{
registered_methods = new(initial_event_capacity);
}
public void Add(Func<bool> method)
{
registered_methods.Add(method);
}
public void Remove(Func<bool> method)
{
registered_methods.Remove(method);
}

public void Invoke()
{
for (int i = 0, length = registered_methods.Count; i < length; ++i)
{
if (registered_methods[i]())
return;
}
}
}
public class InputHandleEvent
{
private List<Func<bool>> registered_methods;
public InputHandleEvent(int initial_event_capacity)
{
registered_methods = new(initial_event_capacity);
}
public void Add(Func<bool> method)
{
registered_methods.Add(method);
}
public void Remove(Func<bool> method)
{
registered_methods.Remove(method);
}

public void Invoke()
{
for (int i = 0, length = registered_methods.Count; i < length; ++i)
{
if (registered_methods[i]())
return;
}
}
}
is this a bad idea?
16 replies
CC#
Created by The Hyper on 6/25/2024 in #help
Stopping Invoking the rest of the registered methods if the bool is true
nor get the bool value
16 replies
CC#
Created by The Hyper on 6/25/2024 in #help
Stopping Invoking the rest of the registered methods if the bool is true
can't find the "Handled" property
16 replies
CC#
Created by The Hyper on 6/25/2024 in #help
Stopping Invoking the rest of the registered methods if the bool is true
public static event Func<bool>
onKey,
onMouseMotion,
onMouseButton,
onJoypadMotion,
onJoypadButton,
onScreenDrag,
onScreenTouch;

public static void SetInputs(InputEvent input)
{
foreach (var del in onKey.GetInvocationList())
{
if (del)
{

}
}
}
public static event Func<bool>
onKey,
onMouseMotion,
onMouseButton,
onJoypadMotion,
onJoypadButton,
onScreenDrag,
onScreenTouch;

public static void SetInputs(InputEvent input)
{
foreach (var del in onKey.GetInvocationList())
{
if (del)
{

}
}
}
16 replies
CC#
Created by The Hyper on 6/25/2024 in #help
Stopping Invoking the rest of the registered methods if the bool is true
yep
16 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
I didn't know that receive() method was stopping the execution, thanks
61 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
etc etc
61 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
yeah, client interpolation, buffering all the data
61 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
basically trying to yeah
61 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
for rapidly sent informations of the game, such as the player's position, I gotta use udp due to its less latency
61 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
I must use udp
61 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
can't, making a game server
61 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
ohhh
61 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
yeah, I'm just testing and learning networking, but I'm calling the Console.WriteLine() before the doing the networking stuff
61 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
oh wtf
61 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
but not actually receiving any data rn
61 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
only receiving data
61 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
I mean it prints "SERVER PROCESSING" only once
61 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
I made it while(true) and it still runs only once
61 replies
CC#
Created by The Hyper on 4/5/2024 in #help
How to use Console.ReadLine() and do other stuff in the background?
can't find anything close to this in google
61 replies