public void UnSubscribe(object sender, RoutedEventArgs e)
 {
     foreach (Mod mod in lsView.SelectedItems)
     {
         if (mod.Source == SourceEnum.Steam)
         {
             File.AppendAllText("unsubscribedMods", $"{mod.Id}{Environment.NewLine}");
             SteamWorkshop.Unsubscribe(ulong.Parse(mod.Id));
         }
     }
 }
示例#2
0
        static void SteamLogin()
        {
            steamClient = new SteamClient();

            #region callbacks
            manager = new CallbackManager(steamClient);
            manager.Subscribe <SteamClient.ConnectedCallback>(OnConnected);
            manager.Subscribe <SteamClient.DisconnectedCallback>(OnDisconnected);
            manager.Subscribe <SteamUser.LoggedOnCallback>(OnLoggedOn);
            manager.Subscribe <SteamUser.UpdateMachineAuthCallback>(UpdateMachineAuthCallback); // If steam guard auth succeeded
            manager.Subscribe <SteamUser.AccountInfoCallback>(OnAccountInfo);
            manager.Subscribe <SteamUser.LoggedOffCallback>(OnLoggedOff);
            manager.Subscribe <SteamFriends.FriendMsgCallback>(OnChatMessage);
            manager.Subscribe <SteamFriends.FriendAddedCallback>(OnFriendAdded);
            manager.Subscribe <SteamFriends.FriendsListCallback>(OnFriendsList);
            manager.Subscribe <SteamGameCoordinator.MessageCallback>(OnGCMessage);
            #endregion

            #region Handlers
            steamUser            = steamClient.GetHandler <SteamUser>();
            steamFriends         = steamClient.GetHandler <SteamFriends>();
            steamCloud           = steamClient.GetHandler <SteamCloud>();
            steamGameServer      = steamClient.GetHandler <SteamGameServer>();
            steamMasterServer    = steamClient.GetHandler <SteamMasterServer>();
            steamGameCoordinator = steamClient.GetHandler <SteamGameCoordinator>();
            steamScreenshots     = steamClient.GetHandler <SteamScreenshots>();
            steamTrading         = steamClient.GetHandler <SteamTrading>();
            steamUFM             = steamClient.GetHandler <SteamUnifiedMessages>();
            steamUserStats       = steamClient.GetHandler <SteamUserStats>();
            steamWorkShop        = steamClient.GetHandler <SteamWorkshop>();
            #endregion

            isRunning = true;

            Console.Title = "Steam Bot - Connecting...";

            steamClient.Connect();

            while (isRunning)
            {
                manager.RunWaitCallbacks(TimeSpan.FromSeconds(1));
            }
            Console.ReadKey();
        }
        private void commitAddModButton_Click(object sender, EventArgs e)
        {
            List <string> temp = new List <string>();

            temp.Add(modSearchTermTextBox.Text);
            PublishedFileDetailsResponse wsFile = SteamWorkshop.GetSteamModDetails(temp);

            if (wsFile.publishedfiledetails == null)
            {
                MessageBox.Show("Mod was not found. Please try again.");
                return;
            }
            PublishedFileDetail wsDetail = wsFile.publishedfiledetails[0];
            Mod newMod = new Mod()
            {
                Name = wsDetail.title, Id = Convert.ToUInt32(modSearchTermTextBox.Text), LastUpdate = SteamWorkshop.FromUnixTime(wsDetail.time_updated)
            };

            Profiles.currentProfile.mods[Profiles.currentProfile.mods.Count + 1] = newMod;
            Profiles.currentProfile.save();
            ConfigUI.LoadProfileMods(Profiles.currentProfile.mods);
            Close();
        }
示例#4
0
            private static bool Prefix(scnCLS __instance, scrCamera ___camera, bool ___disablePlanets,
                                       string ___levelToSelect, ref float ___holdTimer, ref float ___autoscrollTimer, bool ___changingLevel,
                                       ref float ___levelTransitionTimer, ref bool ___instantSelect, string ___newSongKey,
                                       ref Coroutine ___loadSongCoroutine, Dictionary <string, bool> ___loadedLevelIsDeleted, Dictionary <string, LevelData> ___loadedLevels)
            {
                if (_infoGameObject == null)
                {
                    _infoGameObject = new GameObject();
                }

                void Invoke(MethodBase methodBase, params object[] parameters)
                {
                    methodBase.Invoke(__instance, parameters);
                }

                if (Input.GetKeyDown(KeyCode.Alpha7))
                {
                    scnCLS.loadSongMode = (scnCLS.loadSongMode + 1) % 3;
                    if (scnCLS.loadSongMode == 0)
                    {
                        MonoBehaviour.print((object)"loading all");
                    }
                    if (scnCLS.loadSongMode == 1)
                    {
                        MonoBehaviour.print((object)"not loading mp3s");
                    }
                    if (scnCLS.loadSongMode == 2)
                    {
                        MonoBehaviour.print((object)"loading none");
                    }
                }

                float num1 = (float)Screen.width * 1f / (float)Screen.height;
                float num2 = __instance.canvasScaler.referenceResolution.x /
                             __instance.canvasScaler.referenceResolution.y;

                __instance.canvasScaler.matchWidthOrHeight = (double)num1 >= (double)num2 ? 1f : 0.0f;
                ___camera.camobj.orthographicSize          = 5f * Mathf.Max(1f, num2 / num1);
                __instance.signContainer.LocalMoveY(___camera.camobj.orthographicSize - 1.4f);
                SteamIntegration.Instance.CheckCallbacks();
                SteamWorkshop.CheckDownloadInfo();
                if (___disablePlanets)
                {
                    __instance.controller.responsive = false;
                }
                if (Input.GetKeyDown(KeyCode.I) || Input.GetKeyDown(KeyCode.Escape) &&
                    Main.settings.KeyBindSettings.ClsKeyBindSettings.MapInfo)
                {
                    if (_infoBehavior != null)
                    {
                        Object.DestroyImmediate(_infoBehavior);
                        _infoBehavior = null;
                        scrController.instance.paused      = false;
                        scrController.instance.audioPaused = false;
                        scrController.instance.enabled     = true;
                        Time.timeScale = 1.0f;
                    }
                    else if (!__instance.controller.paused && !Input.GetKeyDown(KeyCode.Escape))
                    {
                        _infoBehavior = _infoGameObject.AddComponent <InfoBehavior>();
                        _infoBehavior.SetMap(___loadedLevels[___levelToSelect], ___levelToSelect);
                        scrController.instance.paused      = true;
                        scrController.instance.audioPaused = true;
                        scrController.instance.enabled     = false;
                        Time.timeScale = 0.0f;
                    }

                    return(false);
                }
                if (!__instance.controller.paused)
                {
                    if (Input.GetKeyDown(KeyCode.LeftArrow) &&
                        Main.settings.KeyBindSettings.ClsKeyBindSettings.EnterMap)
                    {
                        if (___loadedLevelIsDeleted[___levelToSelect])
                        {
                            return(false);
                        }
                        __instance.EnterLevel();
                        return(false);
                    }

                    if (Input.GetKeyDown(KeyCode.E) && Main.settings.KeyBindSettings.ClsKeyBindSettings.Editor)
                    {
                        if (___loadedLevelIsDeleted[___levelToSelect])
                        {
                            return(false);
                        }
                        string levelPath = Path.Combine(__instance.loadedLevelDirs[___levelToSelect],
                                                        "main.adofai");
                        GCS.sceneToLoad         = "scnEditor";
                        GCS.customLevelPaths    = new string[1];
                        GCS.customLevelPaths[0] = levelPath;
                        GCS.standaloneLevelMode = false;
                        shouldSkipPlay          = true;
                        __instance.controller.StartLoadingScene(WipeDirection.StartsFromRight);
                        __instance.editor.SwitchToEditMode();
                        return(false);
                    }


                    if (Input.GetKeyDown(KeyCode.R) && Main.settings.KeyBindSettings.ClsKeyBindSettings.Reload)
                    {
                        Invoke(_refresh, false);
                        return(false);
                    }

                    if (Input.GetKeyDown(KeyCode.S))
                    {
                        Invoke(_toggleSpeedTrial);
                        return(false);
                    }

                    if (Input.GetKeyDown(KeyCode.W) && Main.settings.KeyBindSettings.ClsKeyBindSettings.Workshop)
                    {
                        SteamWorkshop.OpenWorkshop();
                        return(false);
                    }

                    if (Input.GetKeyDown(KeyCode.Delete))
                    {
                        Invoke(_deleteLevel, ___levelToSelect);
                        return(false);
                    }

                    if (!__instance.controller.moving)
                    {
                        if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.DownArrow))
                        {
                            ___holdTimer += Time.deltaTime;
                        }
                        else
                        {
                            ___holdTimer       = 0.0f;
                            ___autoscrollTimer = 0.0f;
                        }

                        if ((double)___holdTimer > (double)__instance.secondsForHold)
                        {
                            ___autoscrollTimer += Time.deltaTime *
                                                  ((double)___holdTimer > (double)__instance.secondsForHoldExtra
                                                      ? 2f
                                                      : 1f);
                            if ((double)___autoscrollTimer > (double)__instance.autoScrollInterval)
                            {
                                if (Input.GetKey(KeyCode.UpArrow))
                                {
                                    Invoke(_shiftPlanet, false);
                                }
                                else
                                {
                                    Invoke(_shiftPlanet, true);
                                }
                                ___autoscrollTimer = 0.0f;
                            }
                        }
                        else if (Input.GetKeyDown(KeyCode.UpArrow))
                        {
                            Invoke(_shiftPlanet, false);
                        }
                        else if (Input.GetKeyDown(KeyCode.DownArrow))
                        {
                            Invoke(_shiftPlanet, true);
                        }
                    }
                }

                if (___changingLevel)
                {
                    if ((double)___levelTransitionTimer >= (___instantSelect
                        ? (double)__instance.portalTransitionTimeInstant
                        : (double)__instance.portalTransitionTimeNormal))
                    {
                        __instance.DisplayLevel(___levelToSelect);
                        LevelData loadedLevel = __instance.loadedLevels[___levelToSelect];
                        if (!string.IsNullOrEmpty(loadedLevel.songFilename))
                        {
                            string path = Path.Combine(__instance.loadedLevelDirs[___levelToSelect],
                                                       loadedLevel.songFilename);
                            ___newSongKey = Path.GetFileName(path) + "*external";
                            if (!path.ToLower().EndsWith(".mp3"))
                            {
                                ___loadSongCoroutine =
                                    __instance.StartCoroutine(
                                        (IEnumerator)_loadSong.Invoke(__instance, new[] { path, ___newSongKey }));
                            }
                        }

                        ___instantSelect = false;
                    }
                    else
                    {
                        ___levelTransitionTimer += Time.deltaTime;
                    }
                }

                __instance.portalAndSign.MoveY(___camera.yGlobal);
                return(false);
            }
示例#5
0
 void Awake()
 {
     singleton          = this;
     subscribedItemList = new List <PublishedFileId_t>();
 }
示例#6
0
            public static void Postfix(scnCLS __instance,
                                       bool ___searchMode, string ___levelToSelect,
                                       Dictionary <string, bool> ___loadedLevelIsDeleted, Dictionary <string, LevelDataCLS> ___loadedLevels)
            {
                if (_infoObject == null)
                {
                    _infoObject = new GameObject();
                }

                var settings = MiscModule.Settings;

                if (settings.KeyBinding.CLS.instantJoinKeyActive && !scrController.instance.paused && !___searchMode &&
                    settings.KeyBinding.CLS.instantJoinKey.Down())
                {
                    if (___loadedLevelIsDeleted[___levelToSelect])
                    {
                        return;
                    }
                    __instance.EnterLevel();
                }

                if (settings.KeyBinding.CLS.reloadKeyActive && !scrController.instance.paused && !___searchMode &&
                    settings.KeyBinding.CLS.reloadKey.Down())
                {
                    __instance.Refresh();
                }

                if (settings.KeyBinding.CLS.workshopKeyActive && !scrController.instance.paused && !___searchMode &&
                    settings.KeyBinding.CLS.workshopKey.Down())
                {
                    SteamWorkshop.OpenWorkshop();
                }

                if (Input.GetKeyDown(KeyCode.Escape) ||
                    MiscModule.Settings.KeyBinding.CLS.infoKeyActive &&
                    MiscModule.Settings.KeyBinding.CLS.infoKey.Down() && !___searchMode)
                {
                    if (_levelInfo != null)
                    {
                        Object.DestroyImmediate(_levelInfo);
                        _levelInfo = null;
                        scrController.instance.paused      = false;
                        scrController.instance.audioPaused = false;
                        scrController.instance.enabled     = true;
                        Time.timeScale = 1.0f;
                    }
                    else if (!__instance.controller.paused && !Input.GetKeyDown(KeyCode.Escape))
                    {
                        _levelInfo = _infoObject.AddComponent <LevelInfoBehaviour>();
                        _levelInfo.SetMap(___loadedLevels[___levelToSelect], ___levelToSelect);
                        scrController.instance.paused      = true;
                        scrController.instance.audioPaused = true;
                        scrController.instance.enabled     = false;
                        Time.timeScale = 0.0f;
                    }
                }

                if (MiscModule.Settings.KeyBinding.CLS.editorKeyActive &&
                    MiscModule.Settings.KeyBinding.CLS.editorKey.Down() && !___searchMode &&
                    !scrController.instance.paused)
                {
                    if (___loadedLevelIsDeleted[___levelToSelect])
                    {
                        return;
                    }
                    string levelPath = Path.Combine(__instance.loadedLevelDirs[___levelToSelect],
                                                    "main.adofai");
                    GCS.sceneToLoad         = "scnEditor";
                    GCS.customLevelPaths    = new string[1];
                    GCS.customLevelPaths[0] = levelPath;
                    GCS.standaloneLevelMode = false;
                    editor = true;
                    __instance.controller.StartLoadingScene(WipeDirection.StartsFromRight);
                    // __instance.editor.SwitchToEditMode();
                    return;
                }
            }