private void UpdateFlagsCheckBoxes() { var l = CurrentLodLight; var tfam = (l.TimeFlags >> 0) & 0xFFF; var tfpm = (l.TimeFlags >> 12) & 0xFFF; var sf1 = l.StateFlags1; var sf2 = l.StateFlags2; for (int i = 0; i < TimeFlagsAMCheckedListBox.Items.Count; i++) { TimeFlagsAMCheckedListBox.SetItemCheckState(i, ((tfam & (1u << i)) > 0) ? CheckState.Checked : CheckState.Unchecked); } for (int i = 0; i < TimeFlagsPMCheckedListBox.Items.Count; i++) { TimeFlagsPMCheckedListBox.SetItemCheckState(i, ((tfpm & (1u << i)) > 0) ? CheckState.Checked : CheckState.Unchecked); } for (int i = 0; i < StateFlags1CheckedListBox.Items.Count; i++) { StateFlags1CheckedListBox.SetItemCheckState(i, ((sf1 & (1u << i)) > 0) ? CheckState.Checked : CheckState.Unchecked); } for (int i = 0; i < StateFlags2CheckedListBox.Items.Count; i++) { StateFlags2CheckedListBox.SetItemCheckState(i, ((sf2 & (1u << i)) > 0) ? CheckState.Checked : CheckState.Unchecked); } }
private void UpdateFlagsCheckBoxes() { var l = selectedLight; var tfam = (l.TimeFlags >> 0) & 0xFFF; var tfpm = (l.TimeFlags >> 12) & 0xFFF; for (int i = 0; i < TimeFlagsAMCheckedListBox.Items.Count; i++) { TimeFlagsAMCheckedListBox.SetItemCheckState(i, ((tfam & (1u << i)) > 0) ? CheckState.Checked : CheckState.Unchecked); } for (int i = 0; i < TimeFlagsPMCheckedListBox.Items.Count; i++) { TimeFlagsPMCheckedListBox.SetItemCheckState(i, ((tfpm & (1u << i)) > 0) ? CheckState.Checked : CheckState.Unchecked); } }
private void LoadLodLight() { if (CurrentLodLight == null) { ////Panel.Enabled = false; AddToProjectButton.Enabled = false; DeleteButton.Enabled = false; PositionTextBox.Text = string.Empty; DirectionTextBox.Text = string.Empty; TypeComboBox.SelectedItem = LightType.Point; IntensityUpDown.Value = 0; ColourRUpDown.Value = 0; ColourGUpDown.Value = 0; ColourBUpDown.Value = 0; ColourLabel.BackColor = System.Drawing.Color.White; FalloffTextBox.Text = ""; FalloffExponentTextBox.Text = ""; HashTextBox.Text = ""; InnerAngleUpDown.Value = 0; OuterAngleUpDown.Value = 0; CoronaIntensityUpDown.Value = 0; TimeStateFlagsTextBox.Text = ""; foreach (int i in TimeFlagsAMCheckedListBox.CheckedIndices) { TimeFlagsAMCheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } foreach (int i in TimeFlagsPMCheckedListBox.CheckedIndices) { TimeFlagsPMCheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } foreach (int i in StateFlags1CheckedListBox.CheckedIndices) { StateFlags1CheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } foreach (int i in StateFlags2CheckedListBox.CheckedIndices) { StateFlags2CheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } } else { populatingui = true; var l = CurrentLodLight; ////Panel.Enabled = true; AddToProjectButton.Enabled = !ProjectForm.YmapExistsInProject(CurrentLodLight.Ymap); DeleteButton.Enabled = !AddToProjectButton.Enabled; PositionTextBox.Text = FloatUtil.GetVector3String(l.Position); DirectionTextBox.Text = FloatUtil.GetVector3String(l.Direction); TypeComboBox.SelectedItem = l.Type; IntensityUpDown.Value = l.Colour.A; ColourRUpDown.Value = l.Colour.R; ColourGUpDown.Value = l.Colour.G; ColourBUpDown.Value = l.Colour.B; ColourLabel.BackColor = System.Drawing.Color.FromArgb(l.Colour.R, l.Colour.G, l.Colour.B); FalloffTextBox.Text = FloatUtil.ToString(l.Falloff); FalloffExponentTextBox.Text = FloatUtil.ToString(l.FalloffExponent); HashTextBox.Text = l.Hash.ToString(); InnerAngleUpDown.Value = l.ConeInnerAngle; OuterAngleUpDown.Value = l.ConeOuterAngleOrCapExt; CoronaIntensityUpDown.Value = l.CoronaIntensity; TimeStateFlagsTextBox.Text = l.TimeAndStateFlags.ToString(); UpdateFlagsCheckBoxes(); populatingui = false; if (ProjectForm.WorldForm != null) { ProjectForm.WorldForm.SelectObject(CurrentLodLight); } } }