Skip to content

UI/raid/implament/online mode#1640

Open
Davetsa wants to merge 36 commits into
mainfrom
Ui/Raid/Implament/OnlineMode
Open

UI/raid/implament/online mode#1640
Davetsa wants to merge 36 commits into
mainfrom
Ui/Raid/Implament/OnlineMode

Conversation

@Davetsa

@Davetsa Davetsa commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the online Raid matchmaking flow and updates the Raid UI/prefab setup around it.

Changes

  • Added Photon-backed Raid matchmaking with room state handling, lobby countdown, participant list, surrender flow, and debug start support.
  • Added shared Raid room data helpers for player/clan metadata, trap slots, inventory seed/size, loot requests, and loot removal events.
  • Added live Raid inventory UI so collected loot can be reviewed and removed during gameplay.
  • Updated loot tracking to support per-player/per-owner loot state, synced removals, weight limits, and live UI refreshes.
  • Added Raid event log UI for loot and trap events, including player/avatar display support.
  • Reworked Raid timer visuals with fill progress, start countdown reset behavior, and loss-state red halo effects.
  • Updated end menu, heart panel, inventory, matchmaking, timer, and event popup prefabs.
  • Added new Raid UI graphics/assets and a solid alpha UI shader.
  • Removed unused/old prefab and script pieces such as EmptySlot, FurnitureSlot, and GraphicsChanger.

Davetsa added 30 commits June 8, 2026 16:46
}

List<ClanWeightLimit> limits = new();
string[] entries = value.Split('|');

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.

Periaatteessahan tästä voisi tehdä omat metodinsa, koska tuo jakajan lisääminenkin on oma metodinsa.

}
}

private static void SetLocalizedText(TextMeshProUGUI textField, string finnishText, string englishText, params string[] additions)

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ässähän voisi tehdä sen oletuksen, että se teksti kenttä sisältää nimenomaan tuon TextLanguageSelectorCallerin, jolloin me voidaan antaa se suoraan metodille ja täten ei tarvitse suorittaa tuota muuntamista erikseen.

Jos haluaa mahdollistaa myös käyttämisen ilman tuota Calleria tekstin lisäämisen, niin silloinhan vain oletetaan että sitä Calleria ei ole ja tehdään toinen metodi overload, joka ottaa vastaan tuon tekstikentän.

{
if (inventoryHandler == null)
{
TryGetComponent(out inventoryHandler);

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ässähän voisi siirtää tuon rivin 86 if lausekkeen tähän ja vaihtaa sen konditionaali tällä tryGetComponentilla, koska tämä palauttaa truen, jos se komponentti löytyy. Tällöin ei tarvitse tehdä turhaan erillistä null-tarkistusta.

Sama pätee tuohon raid_LootTracking hakuun.

@BillTheBeast

Copy link
Copy Markdown
Contributor

Tuo ryöstön käynnistys ruutu käyttää juuri nyt tuota kivihahmoa klaanin logona, mutta tuo kivihahmo on jo poistettu suunnitelmista ja käytetään vain sitä sydäntä edelleen.
Ja näiden sydämien ulkoasuhan on saatavilla pelaajien klaanin tiedoista.
Tuo kannattaa käydä muuttamassa.

float inset = Mathf.Clamp(circumferenceInset, 0f, 0.25f);
float outerRadius = size * (0.5f - inset);
float thicknessRatio = Mathf.Clamp(circumferenceThickness, 0.01f, 0.6f);
float thickness = Mathf.Clamp(size * thicknessRatio, 1f, outerRadius);

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ässä ole ihan pienen pieni riski, että outerRadius voisi olla pienempi kuin 1, jolloin tämä ei taida tehdä enää sitä mitä halutaan.


targetImage = GetComponent<Image>();
Transform haloParent = targetRect.parent != null ? targetRect.parent : targetRect;
GameObject haloObject = new GameObject($"{gameObject.name}_RedHalo", typeof(RectTransform), typeof(LayoutElement));

@BillTheBeast BillTheBeast Jun 24, 2026

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ässä olisi helpompi vain tehdä valmis pohja prefabi, joka voidaan vaan instantietaan tähän sen sijaan että se luodaan koodin sisällä.

Poistaisi tarpeen suurimmalle osalle tästä koodista.

haloImages = new Image[LayerSizeRatios.Length];
for (int i = 0; i < LayerSizeRatios.Length; i++)
{
GameObject layerObject = new GameObject($"Shadow_{i}", typeof(RectTransform), typeof(CanvasRenderer), typeof(Image));

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 kuin rivin 155 kommentti.


haloObject.transform.SetSiblingIndex(targetRect.GetSiblingIndex());

haloRects = new RectTransform[LayerSizeRatios.Length];

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ässä myös voisi olla vain yksi lista, joka sisältää luokan, johon sekä tuo rectTransformin ja Imagen tiedot voidaan laittaa yhteen.

targetRect = transform as RectTransform;
}

if (targetImage == 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.

Tämähän tieto asetetaan paikalleen EnsureHalo metodissa kun objekti pistetään käyttöön, joten tämän ei pitäisi olla koskaan null ja jos se jostain syystä on niin se johtuu siitä että sitä komponentti ei ole. Täten tämä tarkistus ja hakukoodi on todellisuudessa turha.

}

float sizeRatio = LayerSizeRatios[layerIndex];
haloRect.anchorMin = Vector2.zero;

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.

Näistähän voisi kaikki paitsi tuon sizeDeltan poistaa, jos tästä tekisi prefabin kuten ylempänä ehdotin.

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ä skriptiä haetaan niin monta kertaa FindObjectOfType kutsulla, että voisiko olla helpompaa vain tehdä tästä singleton ja hakea tätä sitten Instance kutsulla. Säästäisi huomattavasti resursseja verrattuna Findin käyttämiseen verrattuna.

UpdateHeartLootText();
}

public void ResetLootCount()
{
ListOfCollectedLoot = new List<GameFurniture>();

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ässä luoda uutta listaa vai voisiko vain tyhjentää vanhan listan?

_ownerMaxWeights.Clear();
_ownerCollectedLoot.Clear();
_ownerCollectedLootWeights.Clear();
_collectedLootWeights.Clear();

@BillTheBeast BillTheBeast Jun 24, 2026

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ä loppu ole sama kuin ResetLootCount metodissa, voisit yhtä hyvin kutsua sen sen sijaan että se on kirjoitettuna kahteen kertaan.

if (ownerId == _displayedOwnerId)
{
RefreshDisplayedOwnerValues();
}
}

public void SetLootCount(GameFurniture furniture, float MaxLootWeight, float lootWeightMultiplier = 1f)

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ä MaxLootWeight:hän on sama kuin tässä skriptissä oleva MaxLootWeight. Tarvitseeko sitä antaa ulkopuolelta?

float AddedLootWeight = (float)furniture.Weight * lootWeightMultiplier;
ListOfCollectedLoot.Add(furniture);
_collectedLootWeights.Add(AddedLootWeight);

float NewLootWeight = CurrentLootWeight + AddedLootWeight;

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 nämä kaksi riviä voisi yhdistää?

return configuredMaxWeight;
}

if (fallbackMaxWeight > 0f)

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ä fallbackiä tässä vai voisiko tuo MaxLootWeight arvo olla se fallback?

public event Action CollectedLootChanged;

private readonly List<float> _collectedLootWeights = new();
private readonly Dictionary<string, float> _ownerCurrentWeights = new();

@BillTheBeast BillTheBeast Jun 24, 2026

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.

Käytetäänkö näitä dictionareja oikeasti mihinkään, koska näyttäisi että ainoa arvo mitä oikeasti luetaan on pelaajan oma arvo?

ResolveLootTracker();
if (raid_LootTracking != null)
{
raid_LootTracking.CollectedLootChanged -= OnCollectedLootChanged;

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ä kytköksen erottamista kutsua jos sitä kytköstä ei pitäisi muutenkaan vielä olla olemassa.

using UnityEngine;
using UnityEngine.UI;

public class HeartScript : MonoBehaviour
{
private static readonly Vector2 LossHaloPadding = new Vector2(200f, 200f);
private static readonly Vector2 LossHaloOffset = Vector2.zero;

public Raid_LootTracking raid_LootTracking;

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än tuskin tarvitsee olla julkinen.

private void Awake()
{
ResolveLootTracker();
ResolveRecentLootImages();

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ä on myös UpdateRecentLootImages metodin sisällä, joka kutsutaan tuossa seuraavana, joten tätä ei tarvitse kutsua tässä.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants