/// <summary>
 /// Internal method triggering the SteamWorkshopUIBrowse.OnItemDataSet event with exception handling. Required to ensure code execution even if your code throws exceptions.
 /// </summary>
 public void InvokeOnItemDataSet(WorkshopItem p_itemData, SteamWorkshopItemNode p_itemUI)
 {
     InvokeEventHandlerSafely(OnItemDataSet, new SteamWorkshopItemNode.ItemDataSetEventArgs()
     {
         ItemData = p_itemData, ItemUI = p_itemUI
     });
 }
Exemple #2
0
        protected virtual IEnumerator SetNavigationTargetsVertical()
        {
            yield return(new WaitForEndOfFrame());            // wait until all nodes of the list have been loaded

            if (transform.parent != null)
            {
                // find the neighbours
                SteamWorkshopItemNode[] allNodes = transform.parent.GetComponentsInChildren <SteamWorkshopItemNode>();
                int selfIndex = System.Array.IndexOf(allNodes, this);
                if (selfIndex >= 0)
                {
                    SteamWorkshopItemNode self = allNodes[selfIndex];
                    SteamWorkshopItemNode up   = selfIndex > 0 ? allNodes[selfIndex - 1] : null;
                    SteamWorkshopItemNode down = selfIndex < allNodes.Length - 1 ? allNodes[selfIndex + 1] : null;
                    SetNavigationTargetsVertical(self.m_btnDelete, new Selectable[] {
                        up?up.m_btnDelete: null,
                        self.m_btnDelete,
                        down ? down.m_btnDelete : null
                    });
                    SetNavigationTargetsVertical(self.m_btnVotesUp, new Selectable[] {
                        up?up.m_btnVotesUp: null, up ? up.m_btnVotesUpActive : null,
                        self.m_btnVotesUp,
                        down ? down.m_btnVotesUp : null, down ? down.m_btnVotesUpActive : null
                    });
                    SetNavigationTargetsVertical(self.m_btnVotesUpActive, new Selectable[] {
                        up?up.m_btnVotesUp: null, up ? up.m_btnVotesUpActive : null,
                        self.m_btnVotesUpActive,
                        down ? down.m_btnVotesUp : null, down ? down.m_btnVotesUpActive : null
                    });
                    SetNavigationTargetsVertical(self.m_btnVotesDown, new Selectable[] {
                        up?up.m_btnVotesDown: null, up ? up.m_btnVotesDownActive : null,
                        self.m_btnVotesDown,
                        down ? down.m_btnVotesDown : null, down ? down.m_btnVotesDownActive : null
                    });
                    SetNavigationTargetsVertical(self.m_btnVotesDownActive, new Selectable[] {
                        up?up.m_btnVotesDown: null, up ? up.m_btnVotesDownActive : null,
                        self.m_btnVotesDownActive,
                        down ? down.m_btnVotesDown : null, down ? down.m_btnVotesDownActive : null
                    });
                    SetNavigationTargetsVertical(self.m_btnFavorites, new Selectable[] {
                        up?up.m_btnFavorites: null, up ? up.m_btnFavoritesActive : null,
                        self.m_btnFavorites,
                        down ? down.m_btnFavorites : null, down ? down.m_btnFavoritesActive : null
                    });
                    SetNavigationTargetsVertical(self.m_btnFavoritesActive, new Selectable[] {
                        up?up.m_btnFavorites: null, up ? up.m_btnFavoritesActive : null,
                        self.m_btnFavoritesActive,
                        down ? down.m_btnFavorites : null, down ? down.m_btnFavoritesActive : null
                    });
                    SetNavigationTargetsVertical(self.m_btnSubscriptions, new Selectable[] {
                        up?up.m_btnSubscriptions: null, up ? up.m_btnSubscriptionsActive : null,
                        self.m_btnSubscriptions,
                        down ? down.m_btnSubscriptions : null, down ? down.m_btnSubscriptionsActive : null
                    });
                    SetNavigationTargetsVertical(self.m_btnSubscriptionsActive, new Selectable[] {
                        up?up.m_btnSubscriptions: null, up ? up.m_btnSubscriptionsActive : null,
                        self.m_btnSubscriptionsActive,
                        down ? down.m_btnSubscriptions : null, down ? down.m_btnSubscriptionsActive : null
                    });
                    SetNavigationTargetsVertical(self.m_btnPlay, new Selectable[] {
                        up?up.m_btnPlay: null, up ? up.m_btnDownload : null,
                        self.m_btnPlay,
                        down ? down.m_btnPlay : null, down ? down.m_btnDownload : null
                    });
                    SetNavigationTargetsVertical(self.m_btnDownload, new Selectable[] {
                        up?up.m_btnPlay: null, up ? up.m_btnDownload : null,
                        self.m_btnDownload,
                        down ? down.m_btnPlay : null, down ? down.m_btnDownload : null
                    });
                    // automatic navigation in the start and in the end of the list
                    if (selfIndex == 0 || selfIndex == allNodes.Length - 1)
                    {
                        yield return(new WaitForEndOfFrame());

                        SetAutomaticNavigation(m_btnDelete);
                        SetAutomaticNavigation(m_btnVotesUp);
                        SetAutomaticNavigation(m_btnVotesUpActive);
                        SetAutomaticNavigation(m_btnVotesDown);
                        SetAutomaticNavigation(m_btnVotesDownActive);
                        SetAutomaticNavigation(m_btnFavorites);
                        SetAutomaticNavigation(m_btnFavoritesActive);
                        SetAutomaticNavigation(m_btnSubscriptions);
                        SetAutomaticNavigation(m_btnSubscriptionsActive);
                        SetAutomaticNavigation(m_btnPlay);
                        SetAutomaticNavigation(m_btnDownload);
                    }
                }
            }
        }