Exemple #1
0
        public static bool isLevelOnline(LevelNameAndPathPair TestLevel)
        {
            if (!SteamworksManager.IsSteamBuild_)
            {
                return(true);
            }
            var levelSetsManager = G.Sys.LevelSets_;

            foreach (var Level in levelSetsManager.OfficialLevelNameAndPathPairs_)
            {
                if (Level.levelPath_ == TestLevel.levelPath_)
                {
                    return(true);
                }
            }
            // Checking the private field appears to be the only way to go about this :(
            var retrievedPublishedFileIds = (List <ulong>)PrivateUtilities.getPrivateField(G.Sys.SteamworksManager_.UGC_, "retrievedPublishedFileIds_");

            foreach (var Level in levelSetsManager.WorkshopLevelNameAndPathPairs_)
            {
                if (Level.levelPath_ == TestLevel.levelPath_)
                {
                    var relativePath            = levelSetsManager.GetLevelInfo(Level.levelPath_).relativePath_;
                    WorkshopLevelInfo levelInfo = null;
                    G.Sys.SteamworksManager_.UGC_.TryGetWorkshopLevelData(relativePath, out levelInfo);
                    if (levelInfo != null)
                    {
                        var hasLevelId = retrievedPublishedFileIds.Contains((ulong)levelInfo.levelID_);
                        return(hasLevelId);
                    }
                }
            }
            return(false);
        }
        public static StaticEvent <T> .Delegate removeParticularSubscriber <T>(MonoBehaviour component)
        {
            SubscriberList list = (SubscriberList)PrivateUtilities.getPrivateField(component, "subscriberList_");

            StaticEvent <T> .Delegate func = null;
            var index = 0;

            foreach (var subscriber in list)
            {
                if (subscriber is StaticEvent <T> .Subscriber)
                {
                    func = (StaticEvent <T> .Delegate)PrivateUtilities.getPrivateField(subscriber, "func_");
                    subscriber.Unsubscribe();
                    break;
                }
                index++;
            }
            if (func != null)
            {
                list.RemoveAt(index);
            }
            return(func);
        }