Show users reactions, popup system#1641
Conversation
added a scroll bar to popup reactionfield so that it wont go over the tab (still haven't gotten reactionfield buttons work at ShowUserPopUp on the popup, it sorta works but it only updates the messagebox reactionfield)
system now updates correct reactions
- LineOrder place changed so that it wont increase when there isnt new reaction added - Forgot to add " if(Popup.gameObject.activeSelf)" for 288
Reactions are now updated on Reaction PopUp
- Changed all ChatShowUsersPopUpData variable's into private - fixed an issue where reaction selection did not update properly
- Fixed an issue where other user adding reaction from a other message wont update the popup - Fixed an issue where reaction selection gets updated when other user is adding their own reaction
- System now updates the ReactionData both main player and other users reactions data (removing system for it, isn't here yet)
- ReactionData now removes correct user ID in toggle system (right now the system only works to main user directly not other users yet)
- System now updates the info even if its main player or other players I finally got the thing work after so long of grinding the code
- Cleared some code and did some adjustment to some parts
- fixed the reaction content sizing for other devices - some code cleaning
| ClosePopup(); | ||
| } | ||
|
|
||
|
|
||
| public void reactiontext() | ||
| private void reactiontext() |
There was a problem hiding this comment.
Metodin nimi pitäisi alkaa isolla.
| @@ -103,7 +100,7 @@ public void reactiontext() | |||
|
|
|||
| } | |||
|
|
|||
| ReactionAmounText.text = $"{activeChildren} reaktiota"; | |||
| _reactionAmounText.text = $"{activeChildren} reaktiota"; | |||
There was a problem hiding this comment.
Korvaa tämä TextLanguageSelectorCaller skriptin metodilla. (Eli lisää tähän teksti objektiin tuo skripti ja sit voit pistää tuon tekstin sen sisään ja vain lähettää tuon muuttuvan arvot sille.)
| _userInfo = _userInfo.OrderBy(m => m._order).ToList(); | ||
| _OrderButtonText.text = "Old"; | ||
| _orderButtonText.text = "Old"; |
There was a problem hiding this comment.
Kannattaa varmaankin lisätä tarkistus siitä että mikä kieli on käytössä ja jos kyseessä on suomi niin sit, tässä lukee Uusi.
Sama tuohon seuraavaan vaihtoehtoon.
| addedReaction.ResetReactions(); | ||
|
|
||
|
|
||
| AddReaction(reaction, (Mood)Enum.Parse(typeof(Mood), reaction.emoji), messageid, _reactionPaneldata._reactionField, message); |
There was a problem hiding this comment.
_reactionPaneldata._reactionField on ilmiselvästi virheellisesti nimetty, koska alaviiva nimen edessä tarkoittaa yksityistä globaalia muuttujaa, mutta tuo reactionField on selvästikin julkinen jolloin siinä ei pitäisi olla alaviivaa ja ekan kirjaimen pitäisi olla isolla.
| } | ||
| })); | ||
|
|
||
| _selectedMessage.SetMessageInactive(); | ||
| GenarateReactionObjects(_reactionPaneldata._reactionsContent); |
There was a problem hiding this comment.
Sama huomautus kuin aikaisemmin nimeämis asioista..
| } | ||
|
|
||
| /// <summary> | ||
| /// Adds the chosen reaction to the selected message. | ||
| /// </summary> | ||
| public void AddReaction(ServerReactions _reaction, Mood mood, string message_id, GameObject ReactionPanel = null, ChatMessage message = null) |
There was a problem hiding this comment.
Poista alaviiva _reaction muuttujan nimestä.
| @@ -312,145 +284,133 @@ public void AddReaction(ServerReactions _reaction, Mood mood, string message_id, | |||
| /// Toggles the added reactions as selected and unselected. | |||
| /// </summary> | |||
| /// <param name="reactionHandler"></param> | |||
| public void ToggleReaction(ChatReactionHandler reactionHandler, ChatMessage message, ServerReactions _reaction) | |||
| public void ToggleReaction(ChatReactionHandler reactionHandler, ServerReactions _reaction, ChatMessage message) | |||
There was a problem hiding this comment.
"message" attribuuttia ei käytetä, joten sen varmaankin voisi poistaa.
| } | ||
| } | ||
|
|
||
| private void ShowUsers(ChatMessage message) | ||
| private void ShowUsers(ChatReactionHandler reactionHandler, ChatMessage message) |
There was a problem hiding this comment.
Tätä reactionHandleriä ei käytetä, joten se voidaan tod.näk. poistaa tästä.
|
|
||
| _longClick = true; | ||
|
|
||
| Invoke("ResetLongClick", 2); |
There was a problem hiding this comment.
Yleensä suosittelen olemaan käyttämästä suoria string nimiä kun metodeja kutsutaan, koska jos sen metodinnimi muuttuu syystä tai toisesta tämä ei päivity oikein ja ei edes huomauta että ei toimi ennen kuin yrität käyttää sitä. Vaihtamalla tähän nameof operaattorin tämä korjaantuu, sillä nyt koodi osaa seurata sitä metodin varsinaista nimeä ja kertoa jos jokin on pielessä.
| } | ||
|
|
||
| private void ResetLongClick() | ||
| { | ||
| _longClick = false; | ||
| } | ||
|
|
||
| private void RemoveReaction(ChatReactionHandler reaction) | ||
| private void RemoveReaction(ChatReactionHandler reaction, ChatMessage message) |
There was a problem hiding this comment.
"message" attribuuttia ei käytetä, voi mahdollisesti poistaa.
| //Checks if the set gameObject is on or not | ||
| HorizontalLayoutGroup reactionsField = _reactionPaneldata._reactionField.GetComponent<HorizontalLayoutGroup>(); | ||
| HorizontalLayoutGroup reactionsField = _reactionPaneldata._reactionField.GetComponent<HorizontalLayoutGroup>(); | ||
| reaction.transform.SetParent(null); |
There was a problem hiding this comment.
Tarvitseeko tätä edes siirtää eri parentin alle, jos se tuhotaan tähän perään samantien.
|
|
||
| GenarateReactionObjects(_reactionPaneldata._reactionsContent); |
There was a problem hiding this comment.
Tarvitseeko tätä edes kutsua jos ainoa mitä tämän metodin pitäisi tehdä on poistaa tuo reaktio, mikä tuossa ylempänä jo tehtiin.
|
|
||
| StartCoroutine(GetPlayerData(player => | ||
| //Clearns the list empty (with those what has players ID) so that new data can be added | ||
| private void ClearList(ServerReactions _reaction) |
There was a problem hiding this comment.
Tämä metodihan ei varsinaisesti tyhjennä mitään vaan poistaa reaktion valinnan. Kannattaisiko uudelleennimetä?
| @@ -159,6 +159,9 @@ public void ReactionChatCall(ServerReactions EmojiId, ChatMessage message) | |||
| //Gets the set data we need to get to import saved reactions | |||
| MessageReactionsHandler ChildsScript = ReactionObject.GetComponent<MessageReactionsHandler>(); | |||
| ChildsScript.AddReaction(EmojiId, (Mood)Enum.Parse(typeof(Mood), EmojiId.emoji), _id, ReactionsPanel, message); | |||
|
|
|||
| //Used for ChatShowUsersPopUpData | |||
| ChildsScript._reactionData.Add(EmojiId); | |||
There was a problem hiding this comment.
Eikös tämän pitäisi olla tuon AddReaction metodin sisällä eikä tässä? Tällöin tuon ReaktioDatan voi myös pistää yksityiseksi.
BillTheBeast
left a comment
There was a problem hiding this comment.
Noiden huomioiden lisäksi popupin sisältä ei tällä hetkellä voi poistaa valittua reaktiota ainoastaan lisätä uusi tai vaihtaa olemassa oleva. Tuo kannattaa korjata.
- Added Language system to the popup - more code cleaning
Here's the popup system for the chat to see who's had send what reaction, it still doesn't have users avatars yet (so it will use messages avatar in place)
And fixed the reaction selection to work properly
Looks smt like this:

sorry it took long, getting the right data was pain