Ejemplo n.º 1
0
        private void ParseEventGbx(XmlRpc.GbxCallbackEventArgs e)
        {
            if (e.Response.MethodName == "ManiaPlanet.PlayerChat" &&
                e.Response.Params.Count == 4)
            {
                try
                {
                    Structs.PlayerChat PC = new Structs.PlayerChat();
                    PC.PlayerUid       = (int)e.Response.Params[0];
                    PC.Login           = (string)e.Response.Params[1];
                    PC.Text            = (string)e.Response.Params[2];
                    PC.IsRegisteredCmd = (bool)e.Response.Params[3];

                    if (OnPlayerChat != null)
                    {
                        OnPlayerChat(PC);
                    }
                }
                catch { }
            }
            else if (e.Response.MethodName == "ManiaPlanet.PlayerConnect" &&
                     e.Response.Params.Count == 2)
            {
                try
                {
                    Structs.PlayerConnect PC = new Structs.PlayerConnect();
                    PC.Login       = (string)e.Response.Params[0];
                    PC.IsSpectator = (bool)e.Response.Params[1];

                    if (OnPlayerConnect != null)
                    {
                        OnPlayerConnect(PC);
                    }
                }
                catch { }
            }
            else if (e.Response.MethodName == "ManiaPlanet.PlayerDisconnect" &&
                     e.Response.Params.Count == 1)
            {
                try
                {
                    Structs.PlayerDisconnect PD = new Structs.PlayerDisconnect();
                    PD.Login = (string)e.Response.Params[0];

                    if (OnPlayerDisconnect != null)
                    {
                        OnPlayerDisconnect(PD);
                    }
                }
                catch { }
            }
            else if (e.Response.MethodName == "ManiaPlanet.VoteUpdated" &&
                     e.Response.Params.Count == 4)
            {
                try
                {
                    Structs.VoteUpdated VU = new Structs.VoteUpdated();
                    VU.StateName = (string)e.Response.Params[0];
                    VU.Login     = (string)e.Response.Params[1];
                    VU.CmdName   = (string)e.Response.Params[2];
                    VU.CmdParam  = (string)e.Response.Params[3];

                    if (OnVoteUpdated != null)
                    {
                        OnVoteUpdated(VU);
                    }
                }
                catch { }
            }
            else if (e.Response.MethodName == "ManiaPlanet.ModeScriptCallback" &&
                     e.Response.Params.Count == 2)
            {
                try
                {
                    Structs.ModeScriptCallback MSC = new Structs.ModeScriptCallback();
                    MSC.Param1 = (string)e.Response.Params[0];
                    MSC.Param2 = (string)e.Response.Params[1];

                    if (OnModeScriptCallback != null)
                    {
                        OnModeScriptCallback(MSC);
                    }
                }
                catch { }
            }
            else
            {
                // Unhandled callback
            }
        }
Ejemplo n.º 2
0
        private void ParseEventGbx(XmlRpc.GbxCallbackEventArgs e)
        {
            if (e.Response.MethodName == "ManiaPlanet.PlayerChat" &&
                e.Response.Params.Count == 4)
            {
                try
                {

                    Structs.PlayerChat PC = new Structs.PlayerChat();
                    PC.PlayerUid = (int)e.Response.Params[0];
                    PC.Login = (string)e.Response.Params[1];
                    PC.Text = (string)e.Response.Params[2];
                    PC.IsRegisteredCmd = (bool)e.Response.Params[3];

                    if (OnPlayerChat != null)
                        OnPlayerChat(PC);

                }
                catch { }
            }
            else if (e.Response.MethodName == "ManiaPlanet.PlayerConnect" &&
                    e.Response.Params.Count == 2)
            {
                try
                {

                    Structs.PlayerConnect PC = new Structs.PlayerConnect();
                    PC.Login = (string)e.Response.Params[0];
                    PC.IsSpectator = (bool)e.Response.Params[1];

                    if (OnPlayerConnect != null)
                        OnPlayerConnect(PC);

                }
                catch { }
            }
            else if (e.Response.MethodName == "ManiaPlanet.PlayerDisconnect" &&
                    e.Response.Params.Count == 1)
            {
                try
                {

                    Structs.PlayerDisconnect PD = new Structs.PlayerDisconnect();
                    PD.Login = (string)e.Response.Params[0];

                    if (OnPlayerDisconnect != null)
                        OnPlayerDisconnect(PD);

                }
                catch { }
            }
            else if (e.Response.MethodName == "ManiaPlanet.VoteUpdated" &&
                    e.Response.Params.Count == 4)
            {
                try
                {

                    Structs.VoteUpdated VU = new Structs.VoteUpdated();
                    VU.StateName = (string)e.Response.Params[0];
                    VU.Login = (string)e.Response.Params[1];
                    VU.CmdName = (string)e.Response.Params[2];
                    VU.CmdParam = (string)e.Response.Params[3];

                    if (OnVoteUpdated != null)
                        OnVoteUpdated(VU);

                }
                catch { }
            }
            else if (e.Response.MethodName == "ManiaPlanet.ModeScriptCallback" &&
                    e.Response.Params.Count == 2)
            {
                try
                {

                    Structs.ModeScriptCallback MSC = new Structs.ModeScriptCallback();
                    MSC.Param1 = (string)e.Response.Params[0];
                    MSC.Param2 = (string)e.Response.Params[1];

                    if (OnModeScriptCallback != null)
                        OnModeScriptCallback(MSC);

                }
                catch { }
            }
            else
            {
                // Unhandled callback
            }
        }