private void cbuseargstr_CheckedChanged(object sender, EventArgs e) { if (!cbuseargstr.Visible) { return; } scriptnames.Visible = cbuseargstr.Checked; scriptnumbers.Visible = !cbuseargstr.Checked; arg0label.Text = (cbuseargstr.Checked ? "Script Name:" : "Script Number:"); argzeromode = (cbuseargstr.Checked ? ArgZeroMode.SCRIPT_NAME : ArgZeroMode.SCRIPT_NUMBER); }
private void cbuseargstr_CheckedChanged(object sender, EventArgs e) { if (!cbuseargstr.Visible) { return; } bool isacs = (Array.IndexOf(GZGeneral.ACS_SPECIALS, action) != -1); arg0named.Visible = (cbuseargstr.Checked && isacs); arg0str.Visible = (cbuseargstr.Checked && !isacs); arg0int.Visible = (!cbuseargstr.Checked && isacs); arg0.Visible = (!cbuseargstr.Checked && !isacs); Arg0Mode = (cbuseargstr.Checked ? ArgZeroMode.STRING : ArgZeroMode.INT); }
public void UpdateScriptControls() { // Update script-specific stuff if (arginfo[0].Str) { bool isacs = (Array.IndexOf(GZGeneral.ACS_SPECIALS, action) != -1); //mxd. Setup script numbers arg0int.Location = new Point(arg0.Location.X, arg0.Location.Y + 2); arg0int.Items.Clear(); // [ZZ] note: only do this if our action is acs. if (isacs) { foreach (ScriptItem si in General.Map.NumberedScripts.Values) { arg0int.Items.Add(new ColoredComboBoxItem(si, si.IsInclude ? SystemColors.HotTrack : SystemColors.WindowText)); } arg0int.DropDownWidth = Tools.GetDropDownWidth(arg0int); } //mxd. Setup script names if (General.Map.UDMF) { // [ZZ] note: only do this if our action is acs. if (isacs) { arg0named.Items.Clear(); arg0named.Location = arg0int.Location; foreach (ScriptItem nsi in General.Map.NamedScripts.Values) { arg0named.Items.Add(new ColoredComboBoxItem(nsi, nsi.IsInclude ? SystemColors.HotTrack : SystemColors.WindowText)); } arg0named.DropDownWidth = Tools.GetDropDownWidth(arg0named); } else { arg0str.Clear(); arg0str.Location = arg0int.Location; } } else { arg0named.Visible = false; arg0str.Visible = false; cbuseargstr.Visible = false; } // // Update script controls visibility bool showarg0str = (General.Map.UDMF && havearg0str); cbuseargstr.Visible = General.Map.UDMF; cbuseargstr.Checked = showarg0str; arg0named.Visible = showarg0str && isacs; arg0str.Visible = showarg0str && !isacs; arg0int.Visible = (!showarg0str && isacs); arg0.Visible = (!showarg0str && !isacs); // Update named script name if (showarg0str) { Arg0Mode = ArgZeroMode.STRING; arg0str.Text = arg0named.Text = arg0strval; if (isacs && General.Map.NamedScripts.ContainsKey(arg0strval)) { UpdateScriptArguments(General.Map.NamedScripts[arg0strval]); } } // Update numbered script name else if (isacs) { Arg0Mode = ArgZeroMode.INT; int a0 = arg0.GetResult(0); if (General.Map.NumberedScripts.ContainsKey(a0)) { int i = 0; foreach (ScriptItem item in General.Map.NumberedScripts.Values) { if (item.Index == a0) { arg0int.SelectedIndex = i; UpdateScriptArguments(item); break; } i++; } } else { // Unknown script number... arg0int.Text = a0.ToString(); } } } else { arg0.Visible = true; cbuseargstr.Visible = false; arg0named.Visible = false; arg0str.Visible = false; arg0int.Visible = false; cbuseargstr.Checked = false; Arg0Mode = ArgZeroMode.DEFAULT; } }
public void UpdateScriptControls() { // Update script-specific stuff if (Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action) != -1) { // Update script controls visibility bool shownamedscripts = (General.Map.UDMF && havearg0str); cbuseargstr.Visible = General.Map.UDMF; cbuseargstr.Checked = shownamedscripts; scriptnames.Visible = shownamedscripts; scriptnumbers.Visible = !shownamedscripts; // Update named script name if (shownamedscripts) { argzeromode = ArgZeroMode.SCRIPT_NAME; if (General.Map.NamedScripts.ContainsKey(arg0str)) { int i = 0; foreach (ScriptItem item in General.Map.NamedScripts.Values) { if (item.Name == arg0str) { scriptnames.SelectedIndex = i; UpdateScriptArguments(item); break; } i++; } } else { // Unknown script name scriptnames.Text = arg0str; } } else { // Update numbered script name argzeromode = ArgZeroMode.SCRIPT_NUMBER; int a0 = arg0.GetResult(0); if (General.Map.NumberedScripts.ContainsKey(a0)) { int i = 0; foreach (ScriptItem item in General.Map.NumberedScripts.Values) { if (item.Index == a0) { scriptnumbers.SelectedIndex = i; UpdateScriptArguments(item); break; } i++; } } else { // Unknown script number... scriptnumbers.Text = a0.ToString(); } } } else { cbuseargstr.Visible = false; scriptnames.Visible = false; scriptnumbers.Visible = false; cbuseargstr.Checked = false; argzeromode = ArgZeroMode.DEFAULT; } arg0.Visible = (!scriptnames.Visible && !scriptnumbers.Visible); }