Example #1
0
        private bool InputMsg(Dictionary <string, object> json)
        {
            long input    = -1;
            long clientId = -1;
            long action   = -1;

            if (json.ContainsKey("key"))
            {
                input = (long)json["key"];
            }

            if (json.ContainsKey("act"))
            {
                action = (long)json["act"];
            }

            if (json.ContainsKey("id"))
            {
                clientId = (long)json["id"];
            }

            if (clientId == -1 || input == -1)
            {
                Logger.Log("Problem parsing input packet", Logger.LogPrio.Warning);
                return(false);
            }

            int playerHandle = m_ServerManager.GetPlayerHandle((int)clientId);

            m_GameSimulation.InputUpdate(playerHandle, (int)input, (int)action, (int)clientId);

            return(true);
        }