Пример #1
0
        protected override void OnClick(EventArgs e)
        {
            if (InactiveMods.instance.SelectedNode != null)
            {
                TreeNode node = InactiveMods.instance.SelectedNode;
                ActiveMods.instance.ActivateMod(node.Text);
                InactiveMods.instance.Nodes.Remove(node);

                Audio.PlaySound("sfx_decision", false);
            }
        }
Пример #2
0
        protected override void OnClick(EventArgs e)
        {
            Audio.PlaySound("sfx_back", false);
            MainForm.instance.Controls.Clear();
            MainForm.instance.InitStartMenu();

            if (stopAudio)
            {
                Audio.Stop();
            }
        }
Пример #3
0
 private void Play(bool loop)
 {
     Audio.Stop();
     if (lastClicked == TreeViewType.Bgm)
     {
         Audio.PlaySound(bgm.SelectedNode.Text, loop);
     }
     else
     {
         Audio.PlaySound(sfx.SelectedNode.Text, loop);
     }
 }
Пример #4
0
 protected override void OnClick(EventArgs e)
 {
     if (DevToolsForm.instance == null)
     {
         Audio.PlaySound("sfx_decision", false);
         new DevToolsForm();
     }
     else
     {
         Audio.PlaySound("sfx_denied", false);
     }
 }
Пример #5
0
        protected override void OnClick(EventArgs e)
        {
            if (ActiveMods.instance.SelectedNode != null && ActiveMods.instance.SelectedNode.Text != "base oneshot")
            {
                TreeNode node = ActiveMods.instance.SelectedNode;

                InactiveMods.instance.Nodes.Add((TreeNode)node.Clone());
                ActiveMods.instance.Nodes.Remove(node);

                Audio.PlaySound("sfx_back", false);
            }
        }
Пример #6
0
        public void RefreshMods()
        {
            StringBuilder sb = new StringBuilder("samuel"); // i can't remember why i made this but i'm scared to remove it in case it'll break everything beyond repair

            Nodes.Clear();

            // create the mods directory if it doesn't exist
            if (!Directory.Exists(Static.modsPath))
            {
                Directory.CreateDirectory(Static.modsPath);
            }
            if (!Program.doneSetup)
            {
                MessageBox.Show("A base oneshot could not be found. Please open the setup page and follow the instructions.");
                MainForm.instance.Controls.Clear();
                MainForm.instance.InitStartMenu();
                return;
            }

            Static.baseOneShotPath = File.ReadAllText(Static.appDataPath + "path.molly");
            Logger.WriteLine("oneshot path is " + Static.baseOneShotPath);

            LoadingBar loadingBar = new LoadingBar(MainForm.instance, showProgressBar: false);

            // now we extract any existing zip files
            foreach (FileInfo zip in new DirectoryInfo(Static.modsPath).GetFiles())
            {
                loadingBar.SetLoadingStatus(string.Format("attempting to extract {0},\nplease wait a moment", zip.Name));
                Logger.WriteLine($"attempting to extract {zip.FullName}");
                try
                {
                    if (zip.Extension == ".zip")
                    {
                        ZipFile.ExtractToDirectory(zip.FullName, Static.modsPath + "/" + zip.Name.Replace(".zip", ""));
                    }
                }
                catch (Exception ex)
                {
                    string message = zip.Name + " was detected as a possible zip file,\nbut an exception was encountered while trying to extract it:\n---------------\n"
                                     + ex.Message + "\n---------------\n" + ex.ToString() +
                                     "\nThis exception will be ignored but trying to use this mod may cause issues.";

                    MessageBox.Show(message);
                }

                // delete the corresponding zip file
                File.Delete(zip.FullName);
            }

            // add the mods to the treeview
            string[] mods = Directory.GetDirectories(Static.modsPath);
            foreach (string s in mods)
            {
                string modName = s.Substring(s.LastIndexOf("Mods") + 5); // create the name of the mod to add to the treeview

                // check if the mod is valid. if not, warn the player
                if (!ChangesManage.ConfirmValid(s))
                {
                    Audio.PlaySound("sfx_denied", false);
                    MessageBox.Show($"Could not confirm that {modName} is a valid OneShot mod or add-on." +
                                    "\nThis could be because the contents of the mod are not in the root of the directory." +
                                    "\nPlease double check that this is the case, and if so, move them." +
                                    "\n\nOneShot ModLoader will ignore this just in case and continue as if it were valid, but there are no guarantees it will install correctly.");
                }

                if (!ActiveMods.instance.Nodes.ContainsKey(modName) && modName != "base oneshot")
                {
                    Nodes.Add(modName, modName);
                }
            }

            ActiveMods.instance.RefreshMods();

            loadingBar.text.Dispose();
        }
Пример #7
0
 protected override void OnClick(EventArgs e)
 {
     Audio.PlaySound("sfx_decision", false);
     MainForm.instance.Controls.Clear();
     MainForm.instance.InitSetupMenu();
 }
Пример #8
0
 protected override void OnMouseEnter(EventArgs e)
 {
     Glow(this);
     Audio.PlaySound("sfx_select", false);
 }