示例#1
0
        /// <summary>
        ///     Save the updated information locally and online
        /// </summary>
        public void SaveChanges()
        {
            var parameters = DataParams.Build();

            var handshake = new InformationProtocol(Protocol.Data)
                            .SetHandler("finderProfileUpdate", InformationProtocol.HandlerType.Update)
                            .AddParameter("action", "update")
                            .AddParameter("name", PlayerPrefs.GetString("name"))
                            .AddParameter("uid", PlayerPrefs.GetString("uid"));

            foreach (var field in _fields)
            {
                var key   = field.name;
                var value = field.GetComponentInChildren <InputField>().text;

                if (string.IsNullOrEmpty(value))
                {
                    Warning.SetActive(true);
                    return;
                }

                if (field)
                {
                    parameters.Append(key, value);
                }
                handshake.AddParameter(key, value);
            }

            _profileTable.Update(parameters, "");
            handshake.Send();
            FindObjectOfType <ProfileManagement>().OpenView();
        }
示例#2
0
        /// <summary>
        ///     Event for the final button of the profile setup:
        ///     - Inserts the user's information into the database
        ///     - Creates a table for liked profiles
        ///     - Opens the finder screen and closes the profile setup screen
        /// </summary>
        public void Finish()
        {
            var profileSetup  = GetComponentInParent <ProfileSetup>();
            var finderProfile = new DataTable(FinderController.ProfileTable);

            finderProfile.AddProperty(new DataProperty("Name", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("Age", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("City", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("PhoneNumber", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("FavMovie", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("FavMusic", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("FavFood", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("FavSport", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("FavGame", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("FavVacation", DataProperty.DataPropertyType.VARCHAR));
            AppData.Instance().Registry.Register(finderProfile);

            var fields = FormContent.GetComponentsInChildren <Text>().Where(x => x.tag == "InputName");

            var handshake = new InformationProtocol(Protocol.Data)
                            .SetHandler("finderProfileUpdate", InformationProtocol.HandlerType.Update)
                            .AddParameter("action", "insert")
                            .AddParameter("name", PlayerPrefs.GetString("name"))
                            .AddParameter("uid", PlayerPrefs.GetString("uid"));

            var parameters = DataParams.Build();

            foreach (var field in fields)
            {
                var key   = field.name;
                var value = field.GetComponentInChildren <InputField>().text;

                if (string.IsNullOrEmpty(value))
                {
                    Warning.SetActive(true);
                    return;
                }

                parameters.Append(key, value);
                handshake.AddParameter(key, value);
            }

            finderProfile.Insert(parameters);
            handshake.Send(request => {
                var likeTable = new DataTable(FinderController.LikeTable);
                likeTable.AddProperty(new DataProperty("ProfileID", DataProperty.DataPropertyType.VARCHAR));
                AppData.Instance().Registry.Register(likeTable);

                profileSetup.gameObject.SetActive(false);
                profileSetup.FinderController.gameObject.SetActive(true);
            });
        }
示例#3
0
        /// <summary>
        ///     Attempts to send the tracking update request
        ///     Performs the instantiated  request using a HTTP POST request to serialize the data.
        /// </summary>
        public void RequestSend()
        {
            var handshake = new InformationProtocol(Protocol.Tracking)
                            .AddParameter("creation_query", _source.GenerateBuildQuery())
                            .AddParameter("table_name", _source.Name)
                            .AddParameter("player_name", PlayerPrefs.GetString("name"))
                            .AddParameter("player_uuid", PlayerPrefs.GetString("uid"));

            _source.Select("*", "", reader => {
                while (reader.Read())
                {
                    _source.Properties.ForEach(property => {
                        handshake.AddParameter(property.Name + "[]", reader[property.Name].ToString());
                    });
                }
                handshake.Send(callback => { _source.Drop(); });
            });
        }