/// <summary> /// Enable the GameObject, set the text and set up the buttons to work in the context they are in. /// </summary> internal void SetText(ActorResponseAllowableActions actor, bool pending, bool member) { gameObject.SetActive(true); _actorName.text = actor.Actor.Name; _addButton.onClick.RemoveAllListeners(); _removeButton.onClick.RemoveAllListeners(); _addButton.gameObject.SetActive(actor.CanAdd); if (actor.CanAdd) { _addButton.onClick.AddListener(() => SUGARManager.UserGroup.AddGroup(actor.Actor.Id)); } _removeButton.gameObject.SetActive(actor.CanRemove); if (actor.CanRemove) { if (pending) { _removeButton.onClick.AddListener(() => SUGARManager.UserGroup.ManageGroupRequest(actor.Actor.Id, false)); } else { _removeButton.onClick.AddListener(() => SUGARManager.UserGroup.RemoveGroup(actor.Actor.Id)); } } GetComponent <Button>().onClick.RemoveAllListeners(); GetComponent <Button>().onClick.AddListener(() => SUGARManager.GroupMember.Display(actor.Actor)); }
/// <summary> /// Enable the GameObject, set the text and set up the buttons to work in the context they are in. /// </summary> internal void SetText(ActorResponseAllowableActions actor, bool pending, bool own = false) { gameObject.SetActive(true); _actorName.text = actor.Actor.Name; _addButton.onClick.RemoveAllListeners(); _removeButton.onClick.RemoveAllListeners(); _addButton.gameObject.SetActive(actor.CanAdd); if (actor.CanAdd) { if (pending) { _addButton.onClick.AddListener(() => SUGARManager.UserFriend.ManageFriendRequest(actor.Actor.Id, true)); } else { _addButton.onClick.AddListener(() => SUGARManager.UserFriend.AddFriend(actor.Actor.Id)); } } _removeButton.gameObject.SetActive(actor.CanRemove); if (actor.CanRemove) { if (pending) { _removeButton.onClick.AddListener(() => SUGARManager.UserFriend.ManageFriendRequest(actor.Actor.Id, false, own)); } else { _removeButton.onClick.AddListener(() => SUGARManager.UserFriend.RemoveFriend(actor.Actor.Id)); } } }
/// <summary> /// Enable the GameObject, set the text and set up the event listener on the button. /// </summary> internal void SetText(ActorResponseAllowableActions actor) { gameObject.SetActive(true); _actorName.text = actor.Actor.Name; _addButton.onClick.RemoveAllListeners(); _addButton.gameObject.SetActive(actor.CanAdd); if (actor.CanAdd) { _addButton.onClick.AddListener(delegate { SUGARManager.GroupMember.AddFriend(actor.Actor.Id); }); } }