Exemplo n.º 1
0
        /// <summary>
        /// Sends an entity action to be executed on the server
        /// </summary>
        public static void SendEntityActionToServer(ServerBlockActions actionID, long entID, Action <byte[]> callback = null, bool uniqueCallback = true)
        {
            int callbackID = -1;

            if ((actionID & ServerBlockActions.RequireReply) == ServerBlockActions.RequireReply)
            {
                if (callback != null)
                {
                    callbackID = instance.callbackManager.RegisterCallback(callback, uniqueCallback);

                    if (callbackID == -1)
                    {
                        return;
                    }
                }
                else
                {
                    throw new Exception($"Callback missing for {actionID}");
                }
            }

            instance.clientOutgoing.Add(new ClientMessage(actionID, callbackID, entID));
        }
Exemplo n.º 2
0
 public ClientMessage(ServerBlockActions actionID, int callbackID, long entID)
 {
     this.actionID   = (ulong)actionID;
     this.callbackID = callbackID;
     this.entID      = entID;
 }