Beispiel #1
0
        void PopulateUIFromDir()
        {
            files = Directory.GetFiles(spcdir, "*.spc");

            for (int i = 0; i < files.Length; i++)
            {
                listbox.AddItem(Path.GetFileNameWithoutExtension(files[i]));
            }
        }
Beispiel #2
0
        void PopulateFileList()
        {
            file_listbox.Clear();

            string[]      dir  = Directory.GetDirectories(curdir);
            List <string> dirs = new List <string>();

            if (curdir != mapdir)
            {
                dirs.Add("Up One Level");
            }
            foreach (string d in dir)
            {
                string dl = Path.GetFileName(d).ToLower();

                if (curdir == mapdir)
                {
                    if (!Game.Instance.IsBroodWar &&
                        dl == "broodwar")
                    {
                        continue;
                    }

                    if (dl == "replays")
                    {
                        continue;
                    }
                }

                dirs.Add(d);
            }

            directories = dirs.ToArray();

            files = Directory.GetFiles(curdir, "*.sc*");

            Elements[CURRENTDIR_ELEMENT_INDEX].Text = Path.GetFileName(curdir);

            for (int i = 0; i < directories.Length; i++)
            {
                file_listbox.AddItem(String.Format("[{0}]", Path.GetFileName(directories[i])));
            }

            for (int i = 0; i < files.Length; i++)
            {
                string lower = files[i].ToLower();
                if (lower.EndsWith(".scm") || lower.EndsWith(".scx"))
                {
                    file_listbox.AddItem(Path.GetFileName(files[i]));
                }
            }
        }
Beispiel #3
0
        protected override void ResourceLoader()
        {
            base.ResourceLoader();

            for (int i = 0; i < Elements.Count; i++)
            {
                Console.WriteLine("{0}: {1} '{2}'", i, Elements[i].Type, Elements[i].Text);
            }

            Elements[OK_ELEMENT_INDEX].Activate +=
                delegate() {
                if (Ok != null)
                {
                    Ok();
                }
            };

            ListBoxElement list     = (ListBoxElement)Elements[HELPLIST_ELEMENT_INDEX];
            Tbl            help_txt = (Tbl)mpq.GetResource(Builtins.rez_HelpTxtTbl);

            for (int i = 0; i < help_txt.Strings.Length; i++)
            {
                list.AddItem(help_txt.Strings[i]);
            }
        }
Beispiel #4
0
        protected override void ResourceLoader()
        {
            base.ResourceLoader();

            for (int i = 0; i < Elements.Count; i++)
            {
                Console.WriteLine("{0}: {1} '{2}'", i, Elements[i].Type, Elements[i].Text);
            }

            titles       = new string[num_choices];
            descriptions = new string[num_choices];

            for (int i = 0; i < num_choices; i++)
            {
                titles[i]       = GlobalResources.Instance.GluAllTbl[title_startidx + i];
                descriptions[i] = GlobalResources.Instance.GluAllTbl[description_startidx + i];
            }
            listbox = (ListBoxElement)Elements[LISTBOX_ELEMENT_INDEX];

            foreach (string s in titles)
            {
                listbox.AddItem(s);
            }

            listbox.SelectedIndex = 0;
            HandleSelectionChanged(0);

            listbox.SelectionChanged += HandleSelectionChanged;

            Elements[OK_ELEMENT_INDEX].Activate +=
                delegate() {
                if (listbox.SelectedItem == "Battle.net")
                {
                    ShowDialog(new OkDialog(this, mpq,
                                            "insert battle.net code here"));
                }
                else
                {
                    ShowDialog(new OkDialog(this, mpq,
                                            "scsharp will only support battle.net play"));
                }
            };

            Elements[CANCEL_ELEMENT_INDEX].Activate +=
                delegate() {
                Game.Instance.SwitchToScreen(UIScreenType.MainMenu);
            };
        }
		protected override void ResourceLoader ()
		{
			base.ResourceLoader ();

			for (int i = 0; i < Elements.Count; i ++)
				Console.WriteLine ("{0}: {1} '{2}'", i, Elements[i].Type, Elements[i].Text);

			titles = new string[num_choices];
			descriptions = new string[num_choices];

			for (int i = 0; i < num_choices; i ++) {
				titles[i] = GlobalResources.Instance.GluAllTbl[ title_startidx + i ];
				descriptions[i] = GlobalResources.Instance.GluAllTbl[ description_startidx + i ];
			}
			listbox = (ListBoxElement)Elements[LISTBOX_ELEMENT_INDEX];

			foreach (string s in titles)
				listbox.AddItem (s);

			listbox.SelectedIndex = 0;
			HandleSelectionChanged (0);

			listbox.SelectionChanged += HandleSelectionChanged;

			Elements[OK_ELEMENT_INDEX].Activate +=
				delegate () {
					if (listbox.SelectedItem == "Battle.net")
						ShowDialog (new OkDialog (this, mpq,
									  "insert battle.net code here"));
					else
						ShowDialog (new OkDialog (this, mpq,
									  "scsharp will only support battle.net play"));
				};

			Elements[CANCEL_ELEMENT_INDEX].Activate +=
				delegate () {
					Game.Instance.SwitchToScreen (UIScreenType.MainMenu);
				};
		}