예제 #1
0
        public void loadProfileAttribute(List <ProfileAttributeType> profileAttributeType, Profile profile)
        {
            System.Web.UI.HtmlControls.HtmlGenericControl br = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
            divProfileAttribute.Controls.Add(br);
            foreach (ProfileAttributeType type in profileAttributeType)
            {
                if (_presenter.IsAttributeVisible((int)type.PrivacyFlagTypeID))
                {
                    System.Web.UI.HtmlControls.HtmlGenericControl brTab = new System.Web.UI.HtmlControls.HtmlGenericControl("br");

                    ProfileAttribute attribute = _presenter.GetProfileAttributeByProfileIDAndType(profile, type);
                    if (attribute == null)
                    {
                        attribute                        = new ProfileAttribute();
                        attribute.ProfileID              = profile.ProfileID;
                        attribute.ProfileAttributeName   = type.Type;
                        attribute.ProfileAttributeTypeID = type.ProfileAttributeTypeID;
                    }
                    divProfileAttribute.Controls.Add(new LiteralControl("<div class=\"divContainerTitle\">"));
                    divProfileAttribute.Controls.Add(new LiteralControl(type.Type));
                    divProfileAttribute.Controls.Add(new LiteralControl("<div class=\"divContainerRow\">"));
                    divProfileAttribute.Controls.Add(new LiteralControl(attribute.Response));
                    divProfileAttribute.Controls.Add(new LiteralControl("</div></div>"));
                }
            }
        }
 void AnswerQuestion(ProfileAttribute attr, string answer, GameObject requester, GameObject questioned)
 {
     if (this.gameObject.Equals(requester) && isLocalPlayer)
     {
         state.AddCollectedData(new KeyValuePair<ProfileAttribute, string>(attr, answer));
         GameObject.Find("Notification").GetComponent<Notification>().Notify(questioned.GetComponent<PlayerState>().username + " has answered your question about " + ProfileAttributeExt.ToFriendlyString(attr));
     }
 }
    void AskQuestion(ProfileAttribute attr, GameObject requester, GameObject questioned)
    {
        if (this.gameObject.Equals(questioned) && isLocalPlayer)
        {
            state.CmdIsAnswering(true);
            Transform panel = AnswerCanvas.transform.Find("AnswerPanel");
            Text questionsGUIText = panel.transform.Find("AnswerPlayerIDText").GetComponent<Text>();
            PlayerState requesterPlayerState = requester.GetComponent<PlayerState>();
            questionsGUIText.text = requesterPlayerState.username;

            Transform AnswerPanel = panel.Find("Panel").Find("ScrollView").Find("AnswerPanel");
            foreach (Transform trans in AnswerPanel)
            {
                Destroy(trans.gameObject);
            }

            Profile profile = serverLogic.Profiles[questioned.GetComponent<PlayerState>().ProfileIndex];
            string answerTruth = profile[(int)attr];
            GameObject truthButton = Instantiate(ButtonPrefab) as GameObject;
            //Debug.Log(questioned.GetComponent<PlayerState>().ProfileIndex + "|" + questioned.GetComponent<PlayerState>().username + "|" + "Waarheid (" + ProfileAttributeExt.ToFriendlyString(attr) + "=" + answerTruth + ")");
            truthButton.transform.Find("Text").GetComponent<Text>().text = "Waarheid (" + ProfileAttributeExt.ToFriendlyString(attr) + "=" + answerTruth + ")";
            truthButton.transform.SetParent(AnswerPanel);
            Button tButton = truthButton.GetComponent<Button>();
            tButton.onClick.AddListener(() =>
            {
                CmdAnswerQuestion(attr, answerTruth, requester, questioned);
                AnswerCanvas.SetActive(false);
                state.CmdIsAnswering(false);
                if (!state.isQuestioning)
                    state.CmdCommunicationWithId(NetworkInstanceId.Invalid.Value);
            });

            GameObject lieButton = Instantiate(ButtonPrefab) as GameObject;
            lieButton.transform.Find("Text").GetComponent<Text>().text = "Leugen";
            lieButton.transform.SetParent(AnswerPanel);
            Button lButton = lieButton.GetComponent<Button>();
            lButton.onClick.AddListener(() =>
            {
                GameObject logic = GameObject.Find("Game");

                string data = logic.GetComponent<ServerLogic>().Profiles[rnd.Next() % (logic.GetComponent<ServerLogic>().Profiles.Count - 1)][(int)attr];
                if(data == requesterPlayerState.GetProfile()[(int)attr])
                    data = logic.GetComponent<ServerLogic>().Profiles[logic.GetComponent<ServerLogic>().Profiles.Count - 1][(int)attr];

                CmdAnswerQuestion(attr, data + " ", requester, questioned);
                AnswerCanvas.SetActive(false);
                state.CmdIsAnswering(false);
                if (!state.isQuestioning)
                    state.CmdCommunicationWithId(NetworkInstanceId.Invalid.Value);
            });

            state.CmdIsWaitingforQuestion(false);
            if (!state.isAnswering)
                state.CmdCommunicationWithId(NetworkInstanceId.Invalid.Value);

            AnswerCanvas.SetActive(true);
        }
    }
예제 #4
0
        public void AddProfileAttribute(List <ProfileAttributeType> _listProfileAttributeType, Profile profile)
        {
            ProfileAttribute profileAttribute;

            foreach (ProfileAttributeType proAttributeType in _listProfileAttributeType)
            {
                profileAttribute                        = new ProfileAttribute();
                profileAttribute.ProfileID              = profile.ProfileID;
                profileAttribute.ProfileAttributeName   = proAttributeType.Type;
                profileAttribute.ProfileAttributeTypeID = proAttributeType.ProfileAttributeTypeID;
                _profileAttributeService.SaveProfileAttribute(profileAttribute);
            }
        }
예제 #5
0
 public void SaveProfileAttribute(ProfileAttribute attribute)
 {
     using (SPKTDataContext spktDC = conn.GetContext())
     {
         if (attribute.ProfileAttributeID > 0)
         {
             spktDC.ProfileAttributes.Attach(attribute, true);
         }
         else
         {
             attribute.CreateDate = DateTime.Now;
             spktDC.ProfileAttributes.InsertOnSubmit(attribute);
         }
         spktDC.SubmitChanges();
     }
 }
예제 #6
0
        public async Task InitializeAsync()
        {
            await Task.Run(() =>
            {
                _profileAttribute = _typeInfo.GetCustomAttribute <ProfileAttribute>();
                _tagsAttributes   = _typeInfo.GetCustomAttributes <TagsAttribute>().ToList();

                if (_tagsAttributes.Any())
                {
                    Tags = _tagsAttributes.SelectMany(t => t.TagNames).ToList();
                }
                else
                {
                    Tags = Enumerable.Empty <string>().ToList();
                }

                Name = _profileAttribute.ProfileName;
            });
        }
        /// <summary>
        /// Converts NetDocuments.Rest.Client.DTO.NdDocumentAttribute object to NetDocuments.Client.COM.Models.ProfileAttribute.
        /// </summary>
        /// <param name="attribute">NetDocuments.Rest.Client.DTO.NdDocumentAttribute object to convert.</param>
        /// <returns>NetDocuments.Client.COM.Models.ProfileAttribute object.</returns>
        public static ProfileAttribute ToProfileAttribute(this NdDocumentAttribute attribute)
        {
            var profileAttribute = new ProfileAttribute
            {
                Id = attribute.Id
            };

            if (attribute.Values?.FirstOrDefault() != null)
            {
                profileAttribute.Value = attribute.Values.FirstOrDefault();
            }
            else if (attribute.Value != null)
            {
                profileAttribute.Value = attribute.Value;
            }
            else
            {
                profileAttribute.Value = attribute.DateValue.ToShortDateString();
            }

            return(profileAttribute);
        }
예제 #8
0
 public void send_updateProfileAttribute(int reqSeq, ProfileAttribute attr, string value)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("updateProfileAttribute", TMessageType.Call, seqid_));
   updateProfileAttribute_args args = new updateProfileAttribute_args();
   args.ReqSeq = reqSeq;
   args.Attr = attr;
   args.Value = value;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
예제 #9
0
 public IAsyncResult send_updateProfileAttribute(AsyncCallback callback, object state, int reqSeq, ProfileAttribute attr, string value)
예제 #10
0
      public void updateProfileAttribute(int reqSeq, ProfileAttribute attr, string value)
      {
        #if !SILVERLIGHT
        send_updateProfileAttribute(reqSeq, attr, value);
        recv_updateProfileAttribute();

        #else
        var asyncResult = Begin_updateProfileAttribute(null, null, reqSeq, attr, value);
        End_updateProfileAttribute(asyncResult);

        #endif
      }
예제 #11
0
 public IAsyncResult Begin_updateProfileAttribute(AsyncCallback callback, object state, int reqSeq, ProfileAttribute attr, string value)
 {
   return send_updateProfileAttribute(callback, state, reqSeq, attr, value);
 }
예제 #12
0
 public void send_storeUpdateProfileAttribute(int seq, ProfileAttribute profileAttribute, string value)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("storeUpdateProfileAttribute", TMessageType.Call, seqid_));
   storeUpdateProfileAttribute_args args = new storeUpdateProfileAttribute_args();
   args.Seq = seq;
   args.ProfileAttribute = profileAttribute;
   args.Value = value;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
예제 #13
0
 public IAsyncResult send_storeUpdateProfileAttribute(AsyncCallback callback, object state, int seq, ProfileAttribute profileAttribute, string value)
예제 #14
0
 public void SaveAttribute(ProfileAttribute attribute)
 {
     _profileAttributeService.SaveProfileAttribute(attribute);
 }
예제 #15
0
 public IAsyncResult Begin_storeUpdateProfileAttribute(AsyncCallback callback, object state, int seq, ProfileAttribute profileAttribute, string value)
 {
   return send_storeUpdateProfileAttribute(callback, state, seq, profileAttribute, value);
 }
 void RpcAskQuestion(ProfileAttribute attr, GameObject requester, GameObject questioned)
 {
     questioned.GetComponent<PlayerController>().AskQuestion(attr, requester, questioned);
 }
 void CmdOnExchangeComplete(ProfileAttribute attribute, string data)
 {
     // [TODO] ... Add pair to collectedData.
 }
 void RpcAnswerQuestion(ProfileAttribute attr, string answer, GameObject requester, GameObject questioned)
 {
     requester.GetComponent<PlayerController>().AnswerQuestion(attr, answer, requester, questioned);
 }
 void CmdAskQuestion(ProfileAttribute attr, GameObject requester, GameObject questioned)
 {
     RpcAskQuestion(attr, requester, questioned);
 }
 void CmdAnswerQuestion(ProfileAttribute attr, string answer, GameObject requester, GameObject questioned)
 {
     RpcAnswerQuestion(attr, answer, requester, questioned);
 }
예제 #21
0
 public void SaveProfileAttribute(ProfileAttribute profileAttribute)
 {
     _profileAttributeRepository.SaveProfileAttribute(profileAttribute);
 }
예제 #22
0
      public void storeUpdateProfileAttribute(int seq, ProfileAttribute profileAttribute, string value)
      {
        #if !SILVERLIGHT
        send_storeUpdateProfileAttribute(seq, profileAttribute, value);
        recv_storeUpdateProfileAttribute();

        #else
        var asyncResult = Begin_storeUpdateProfileAttribute(null, null, seq, profileAttribute, value);
        End_storeUpdateProfileAttribute(asyncResult);

        #endif
      }
 public void RpcSetKey(ProfileAttribute p)
 {
     gameObject.GetComponent<TextMesh> ().text = p.ToFriendlyString();
     Key = p;
 }
예제 #24
0
        public void loadProfileAttribute(List <ProfileAttributeType> profileAttributeType, List <VisibilityLevel> ListVisibilityLevel, List <PrivacyFlag> PrivacyFlags, Profile profile)
        {
            #region MyRegion
            //foreach (ProfileAttributeType pt in profileAttributeType)
            //{
            //    ProfileAttributeControl ctr = new ProfileAttributeControl(profile, pt, _presenter._profileAttributeRepository);
            //    ProfileAttribute.Controls.Add(ctr);
            //}

            /* ProfileAttributeControlFull ctr = new ProfileAttributeControlFull(profile, profileAttributeType);
             * ProfileAttribute.Controls.Add(ctr);*/
            //SPKTCore.Core.DataAccess.IProfileAttributeRepository _Repository = new SPKTCore.Core.DataAccess.Impl.ProfileAttributeRepository();
            // List<ProfileAttribute> listAttribute = new List<ProfileAttribute>();
            // listAttribute = _Repository.GetProfileAttributesByProfileID(profile.ProfileID);
            // if (listAttribute.Count != profileAttributeType.Count)
            // {
            //     _presenter.AddProfileAttribute(profileAttributeType, profile);
            // }
            // System.Web.UI.HtmlControls.HtmlGenericControl br = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
            // ProfileAttribute.Controls.Add(br);
            // foreach (ProfileAttribute proAttribute in listAttribute)
            // {
            //     System.Web.UI.HtmlControls.HtmlGenericControl brTab = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
            //     Label lbl = new Label();
            //     lbl.Width = 150;
            //     lbl.Height = 18;
            //     lbl.ForeColor = System.Drawing.Color.Blue;
            //     lbl.ID = "lbl" + proAttribute.ProfileAttributeID.ToString();
            //     lbl.Text = proAttribute.ProfileAttributeName;
            //     TextBox txt = new TextBox();
            //     txt.Width = 150;
            //     txt.Height = 18;
            //     lbl.ForeColor = System.Drawing.Color.CornflowerBlue;
            //     txt.ID = "txt" + proAttribute.ProfileAttributeID.ToString();
            //     txt.Text = proAttribute.Response;
            //     ProfileAttribute.Controls.Add(lbl);
            //     ProfileAttribute.Controls.Add(txt);
            //     ProfileAttribute.Controls.Add(brTab);
            #endregion


            System.Web.UI.HtmlControls.HtmlGenericControl br = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
            divProfileAttribute.Controls.Add(br);
            foreach (ProfileAttributeType type in profileAttributeType)
            {
                System.Web.UI.HtmlControls.HtmlGenericControl brTab = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
                Label lbl = new Label();
                lbl.Width     = 150;
                lbl.ForeColor = System.Drawing.Color.Blue;
                lbl.ID        = "lbl" + type.ProfileAttributeTypeID.ToString();
                lbl.Text      = type.Type;
                TextBox txt = new TextBox();
                txt.Width     = 150;
                lbl.ForeColor = System.Drawing.Color.CornflowerBlue;
                DropDownList ddlVisibility = new DropDownList();
                ddlVisibility.ID = "ddlVisibility" + type.PrivacyFlagTypeID.ToString();
                foreach (VisibilityLevel level in ListVisibilityLevel)
                {
                    ListItem li = new ListItem(level.Name, level.VisibilityLevelID.ToString());
                    if (!IsPostBack)
                    {
                        li.Selected = _presenter.IsFlagSelected((int)type.PrivacyFlagTypeID, level.VisibilityLevelID, PrivacyFlags);
                    }
                    ddlVisibility.Items.Add(li);
                }
                ProfileAttribute attribute = _presenter.GetProfileAttributeByProfileIDAndType(profile, type);
                if (attribute == null)
                {
                    attribute                        = new ProfileAttribute();
                    attribute.ProfileID              = profile.ProfileID;
                    attribute.ProfileAttributeName   = type.Type;
                    attribute.ProfileAttributeTypeID = type.ProfileAttributeTypeID;
                    _presenter.SaveAttribute(attribute);
                }
                ;
                divProfileAttribute.Controls.Add(lbl);
                divProfileAttribute.Controls.Add(txt);
                divProfileAttribute.Controls.Add(ddlVisibility);
                divProfileAttribute.Controls.Add(brTab);
                txt.ID   = "txt" + attribute.ProfileAttributeID.ToString();
                txt.Text = attribute.Response;
            }
        }