Ejemplo n.º 1
0
        private void FlagsCheckedListBox_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (populatingui)
            {
                return;
            }
            if (CurrentPortal == null)
            {
                return;
            }

            uint flags = 0;

            for (int i = 0; i < FlagsCheckedListBox.Items.Count; i++)
            {
                if (e.Index == i)
                {
                    if (e.NewValue == CheckState.Checked)
                    {
                        flags += (uint)(1 << i);
                    }
                }
                else
                {
                    if (FlagsCheckedListBox.GetItemChecked(i))
                    {
                        flags += (uint)(1 << i);
                    }
                }
            }
            FlagsTextBox.Text = flags.ToString();
        }
Ejemplo n.º 2
0
        private void FlagsTextBox_TextChanged(object sender, EventArgs e)
        {
            if (populatingui)
            {
                return;
            }
            if (CurrentPortal == null)
            {
                return;
            }

            uint u = 0;

            uint.TryParse(FlagsTextBox.Text, out u);

            for (int i = 0; i < FlagsCheckedListBox.Items.Count; i++)
            {
                var c = ((u & (1u << i)) > 0);
                FlagsCheckedListBox.SetItemCheckState(i, c ? CheckState.Checked : CheckState.Unchecked);
            }

            lock (ProjectForm.ProjectSyncRoot)
            {
                if (CurrentPortal._Data.flags != u)
                {
                    CurrentPortal._Data.flags = u;
                    ProjectForm.SetYtypHasChanged(true);
                }
            }
        }
Ejemplo n.º 3
0
        private void UpdateControls()
        {
            if (CurrentPortal != null)
            {
                populatingui         = true;
                RoomFromTextBox.Text = CurrentPortal._Data.roomFrom.ToString();
                RoomToTextBox.Text   = CurrentPortal._Data.roomTo.ToString();
                FlagsTextBox.Text    = CurrentPortal._Data.flags.ToString();
                for (int i = 0; i < FlagsCheckedListBox.Items.Count; i++)
                {
                    var c = ((CurrentPortal._Data.flags & (1u << i)) > 0);
                    FlagsCheckedListBox.SetItemCheckState(i, c ? CheckState.Checked : CheckState.Unchecked);
                }
                MirrorPriorityTextBox.Text = CurrentPortal._Data.mirrorPriority.ToString();
                OpacityTextBox.Text        = CurrentPortal._Data.opacity.ToString();
                AudioOcclusionTextBox.Text = CurrentPortal._Data.audioOcclusion.ToString();

                var sb = new StringBuilder();
                if (CurrentPortal.Corners != null)
                {
                    foreach (var corner in CurrentPortal.Corners)
                    {
                        if (sb.Length > 0)
                        {
                            sb.AppendLine();
                        }
                        sb.Append(FloatUtil.GetVector3String(corner.XYZ()));
                    }
                }
                CornersTextBox.Text = sb.ToString();
                populatingui        = false;
            }
            else
            {
                RoomFromTextBox.Text       = string.Empty;
                RoomToTextBox.Text         = string.Empty;
                FlagsTextBox.Text          = string.Empty;
                MirrorPriorityTextBox.Text = string.Empty;
                OpacityTextBox.Text        = string.Empty;
                AudioOcclusionTextBox.Text = string.Empty;
                CornersTextBox.Text        = string.Empty;
            }
        }
Ejemplo n.º 4
0
 private void UpdateControls()
 {
     if (CurrentRoom != null)
     {
         populatingui          = true;
         NameTextBox.Text      = CurrentRoom.RoomName;
         MinBoundsTextBox.Text = FloatUtil.GetVector3String(CurrentRoom.BBMin);
         MaxBoundsTextBox.Text = FloatUtil.GetVector3String(CurrentRoom.BBMax);
         FlagsTextBox.Text     = CurrentRoom._Data.flags.ToString();
         for (int i = 0; i < FlagsCheckedListBox.Items.Count; i++)
         {
             var c = ((CurrentRoom._Data.flags & (1u << i)) > 0);
             FlagsCheckedListBox.SetItemCheckState(i, c ? CheckState.Checked : CheckState.Unchecked);
         }
         BlendTextBox.Text            = FloatUtil.ToString(CurrentRoom._Data.blend);
         TimecycleTextBox.Text        = CurrentRoom._Data.timecycleName.ToCleanString();
         Timecycle2TextBox.Text       = CurrentRoom._Data.secondaryTimecycleName.ToCleanString();
         PortalCountTextBox.Text      = CurrentRoom._Data.portalCount.ToString();
         FloorIDTextBox.Text          = CurrentRoom._Data.floorId.ToString();
         ExteriorVisDepthTextBox.Text = CurrentRoom._Data.exteriorVisibiltyDepth.ToString();
         populatingui = false;
     }
     else
     {
         NameTextBox.Text             = string.Empty;
         MinBoundsTextBox.Text        = string.Empty;
         MaxBoundsTextBox.Text        = string.Empty;
         FlagsTextBox.Text            = string.Empty;
         BlendTextBox.Text            = string.Empty;
         TimecycleTextBox.Text        = string.Empty;
         Timecycle2TextBox.Text       = string.Empty;
         PortalCountTextBox.Text      = string.Empty;
         FloorIDTextBox.Text          = string.Empty;
         ExteriorVisDepthTextBox.Text = string.Empty;
     }
 }
        private void _flagsCheckedListBox_SelectedFlagChanged(FlagsCheckedListBox arg)
        {
            var selectedEnum = _flagsCheckedListBox.SelectedEnum;

            _textWriter.WriteLine("Selected Flag Changed: {0}", selectedEnum != null ? ((Test1Enum)selectedEnum).ToString() : string.Empty);
        }