Skip to content

Show users reactions, popup system#1641

Open
Rastub wants to merge 12 commits into
mainfrom
ShowUserPopUp_System_V2
Open

Show users reactions, popup system#1641
Rastub wants to merge 12 commits into
mainfrom
ShowUserPopUp_System_V2

Conversation

@Rastub

@Rastub Rastub commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

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:
Screenshot 2026-06-23 135642

sorry it took long, getting the right data was pain

Rastub added 10 commits June 1, 2026 15:22
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
@Rastub Rastub requested a review from BillTheBeast June 23, 2026 11:00
- fixed the reaction content sizing for other devices
- some code cleaning
ClosePopup();
}


public void reactiontext()
private void reactiontext()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metodin nimi pitäisi alkaa isolla.

@@ -103,7 +100,7 @@ public void reactiontext()

}

ReactionAmounText.text = $"{activeChildren} reaktiota";
_reactionAmounText.text = $"{activeChildren} reaktiota";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"message" attribuuttia ei käytetä, joten sen varmaankin voisi poistaa.

}
}

private void ShowUsers(ChatMessage message)
private void ShowUsers(ChatReactionHandler reactionHandler, ChatMessage message)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tätä reactionHandleriä ei käytetä, joten se voidaan tod.näk. poistaa tästä.


_longClick = true;

Invoke("ResetLongClick", 2);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tarvitseeko tätä edes siirtää eri parentin alle, jos se tuhotaan tähän perään samantien.


GenarateReactionObjects(_reactionPaneldata._reactionsContent);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BillTheBeast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants