コード例 #1
0
ファイル: frmMace.cs プロジェクト: RavetcoFX/mace-minecraft
        private void ShowHelp(object sender, HelpEventArgs hlpevent)
        {
            string strHelp = String.Empty;

            switch (((Control)sender).Name)
            {
            case "btnAbout":
                strHelp = "You just clicked a question mark with a question mark. The world will now implode.";
                break;

            case "btnGenerateCity":
                strHelp = "This button will create a new world in your MineCraft saves directory, with a randomly generated city at the spawn point.\n\nMace doesn't interact with MineCraft directly, so you don't need MineCraft open.";
                break;

            case "picMace":
                strHelp = "Hiring all those graphics artists was definitely worth it.";
                break;
            }
            if (strHelp.Length == 0)
            {
                if (MessageBox.Show("Sorry, no help is available for this control :(\n\nWould you like to fire a random member of the Help Department?", "Help", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    Random randSeeds = new Random();
                    RNG.SetSeed(randSeeds.Next());
                    MessageBox.Show("Thank you for submitting this request. We have now fired " + RNG.RandomFileLine(Path.Combine("Resources", "HelpDepartment.txt")) + "\n\nYou monster.", "Requested granted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show(strHelp, "Help", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #2
0
ファイル: frmMace.cs プロジェクト: RavetcoFX/mace-minecraft
        private void picMace_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                MessageBox.Show(BlockInfo.Stone.ID.ToString());
                Debug.WriteLine((int)FenceGateState.OPEN);
                Debug.WriteLine((int)DoorState.SWUNG);
                DateTime dtNow = new DateTime();
                dtNow = DateTime.Now;
                RNG.SetSeed(dtNow.Millisecond);
                string[] strFlagFiles = Directory.GetFiles("Resources", "Flag_*.txt");
                string   strFlag      = RNG.RandomItemFromArray(strFlagFiles);
                string[] strFlagLines = File.ReadAllLines(strFlag);

                MessageBox.Show(String.Join(" ", strFlagLines));

                string strNames = String.Empty;
                for (int x = 0; x < 50; x++)
                {
                    string strStart    = RNG.RandomFileLine(Path.Combine("Resources", "Adjectives.txt"));
                    string strEnd      = RNG.RandomFileLine(Path.Combine("Resources", "Nouns.txt"));
                    string strCityName = strStart + strEnd;
                    strNames += strCityName + "\r\n";
                }
                MessageBox.Show(strNames);
            }
        }