private void FillData(int i_SlotIndex, string i_PlayerName, Sprite i_Portrait, Color i_TeamColor, string i_StatLabel, string i_StatValue, string i_ParticipationLabel, string i_ParticipationValue) { if (!IsValidSlotIndex(i_SlotIndex)) { return; } if (m_StatsPanels == null) { return; } tnStatsPanel statsPanel = m_StatsPanels[i_SlotIndex]; if (statsPanel == null) { return; } statsPanel.gameObject.SetActive(true); statsPanel.SetPlayerName(i_PlayerName); statsPanel.SetPortrait(i_Portrait); statsPanel.SetTeamColor(i_TeamColor); statsPanel.SetStatLabel(i_StatLabel); statsPanel.SetStatValue(i_StatValue); statsPanel.SetPartecipationLabel(i_ParticipationLabel); statsPanel.SetPartecipationValue(i_ParticipationValue); }
private void Internal_ClearEntry(int i_Index) { tnStatsPanel entry = GetEntry(i_Index); if (entry == null) { return; } entry.gameObject.SetActive(false); }
public void DisableAllEntries() { if (m_Entries == null) { return; } for (int index = 0; index < m_Entries.Length; ++index) { tnStatsPanel entry = m_Entries[index]; if (entry == null) { continue; } entry.gameObject.SetActive(false); } }
// INTERNALS private void Internal_SetEntry(int i_Index, string i_PlayerName, Sprite i_Portrait, string i_StatLabel, string i_StatValue, string i_PartecipationLabel, string i_PartecipationValue, Color i_TeamColor) { tnStatsPanel entry = GetEntry(i_Index); if (entry == null) { return; } entry.gameObject.SetActive(true); entry.SetPlayerName(i_PlayerName); entry.SetPortrait(i_Portrait); entry.SetStatLabel(i_StatLabel); entry.SetStatValue(i_StatValue); entry.SetPartecipationLabel(i_PartecipationLabel); entry.SetPartecipationValue(i_PartecipationValue); entry.SetTeamColor(i_TeamColor); }
// MonoBehaviour's interface protected override void Awake() { base.Awake(); if (m_ContentRoot != null) { if (m_StatsEntryPrefab != null) { int entryCount = Mathf.Max(1, m_MaxEntries); m_Entries = new tnStatsPanel[entryCount]; for (int index = 0; index < m_Entries.Length; ++index) { tnStatsPanel entry = Instantiate <tnStatsPanel>(m_StatsEntryPrefab); entry.transform.SetParent(m_ContentRoot, false); m_Entries[index] = entry; } DisableAllEntries(); } } }
// MonoBehaviour's INTERFACE void Awake() { // Create stats panels. if (m_StatsRootPanel == null) { return; } if (m_StatsPanelPrefab == null) { return; } m_StatsPanels = new tnStatsPanel[s_MaxPanels]; for (int panelIndex = 0; panelIndex < m_StatsPanels.Length; ++panelIndex) { tnStatsPanel statsPanel = Instantiate <tnStatsPanel>(m_StatsPanelPrefab); statsPanel.transform.SetParent(m_StatsRootPanel, false); m_StatsPanels[panelIndex] = statsPanel; } }
// INTERNALS private void InternalSetStats(tnBaseMatchController i_MathController) { if (m_StatsPanels == null) { return; } // Disable all slots. for (int slotIndex = 0; slotIndex < m_StatsPanels.Length; ++slotIndex) { tnStatsPanel statsPanel = m_StatsPanels[slotIndex]; if (statsPanel != null) { statsPanel.gameObject.SetActive(false); } } if (i_MathController == null) { return; } int charactersCount = i_MathController.charactersCount; int statsCount = Mathf.Max(1, charactersCount /* / 2*/); // Select N random stats. int[] statsIndices = SelectStats(statsCount); for (int index = 0; index < statsIndices.Length; ++index) { // Get target stat index. int statIndex = statsIndices[index]; // Select the best character for this stat. StatType statType = (StatType)statIndex; switch (statType) { case StatType.Shots: FillShotsData(index, i_MathController); break; case StatType.ShotsOnTarget: FillShotsOnTarget(index, i_MathController); break; case StatType.DistanceRun: FillDistanceRunData(index, i_MathController); break; case StatType.DashCount: FillDashCountData(index, i_MathController); break; case StatType.BallTouches: FillBallTouchesData(index, i_MathController); break; case StatType.AttractTime: FillAttractTimeData(index, i_MathController); break; case StatType.Tackles: FillTacklesData(index, i_MathController); break; case StatType.GoalScored: FillGoalScoredData(index, i_MathController); break; } } }