Exemplo n.º 1
0
        private DataFromClient ParseParameters(string url, out string callback)
        {
            callback = "invalid";
            var data = new DataFromClient();

            try
            {
                var querystring = url.Substring(url.IndexOf('?'));
                var parameters = HttpUtility.ParseQueryString(querystring);

                if (parameters != null)
                {
                    callback = parameters["callback"];
                    data.weapons = parameters["w"];

                    if(parameters["xy"] != null && parameters["xy"] != String.Empty)
                        data.xy = double.Parse(parameters["xy"]);
                    if (parameters["xz"] != null && parameters["xz"] != String.Empty)
                        data.xy = double.Parse(parameters["xz"]);
                    if (parameters["yz"] != null && parameters["yz"] != String.Empty)
                        data.xy = double.Parse(parameters["yz"]);
                }
            }
            catch
            {
                data = null;
            }

            return data;
        }
Exemplo n.º 2
0
        private void setData(DataFromClient data)
        {
            if (data != null)
            {
                this.player.UpdateWeapon(data.weapons);

                if (this.player._contollerDirection == null)
                {
                    this.player._contollerDirection = new ControllerDirection();
                }

                this.player._contollerDirection.xy = data.xy;
                this.player._contollerDirection.xz = data.xz;
                this.player._contollerDirection.yz = data.yz;
            }
            else
            {
                this.player.UpdateWeapon(String.Empty);
            }
        }