private void LoadBoxOccluder()
        {
            if (CurrentBoxOccluder == null)
            {
                ////Panel.Enabled = false;
                AddToProjectButton.Enabled = false;
                DeleteButton.Enabled       = false;
                CenterTextBox.Text         = string.Empty;
                SizeTextBox.Text           = string.Empty;
                SinCosZTextBox.Text        = string.Empty;
            }
            else
            {
                populatingui = true;
                var b = CurrentBoxOccluder;
                ////Panel.Enabled = true;
                AddToProjectButton.Enabled = !ProjectForm.YmapExistsInProject(CurrentBoxOccluder.Ymap);
                DeleteButton.Enabled       = !AddToProjectButton.Enabled;
                CenterTextBox.Text         = FloatUtil.GetVector3String(b.Position);
                SizeTextBox.Text           = FloatUtil.GetVector3String(b.Size);
                var dir = b.Orientation.Multiply(Vector3.UnitX) * 0.5f;
                SinCosZTextBox.Text = FloatUtil.GetVector2String(new Vector2(dir.X, dir.Y));
                populatingui        = false;

                if (ProjectForm.WorldForm != null)
                {
                    ProjectForm.WorldForm.SelectObject(CurrentBoxOccluder);
                }
            }
        }
        public void UpdateScenarioUI()
        {
            if (CurrentScenario == null)
            {
                populatingui = true;
                //ScenarioYmtPanel.Enabled = false;
                ScenarioYmtNameTextBox.Text         = string.Empty;
                ScenarioYmtVersionTextBox.Text      = string.Empty;
                ScenarioYmtGridMinTextBox.Text      = string.Empty;
                ScenarioYmtGridMaxTextBox.Text      = string.Empty;
                ScenarioYmtGridScaleTextBox.Text    = string.Empty;
                ScenarioYmtGridInfoLabel.Text       = "Total grid points: 0";
                ScenarioYmtExtentsMinTextBox.Text   = string.Empty;
                ScenarioYmtExtentsMaxTextBox.Text   = string.Empty;
                ScenarioYmtFileLocationTextBox.Text = string.Empty;
                ScenarioYmtProjectPathTextBox.Text  = string.Empty;
                populatingui = false;
            }
            else
            {
                var rgn  = CurrentScenario.CScenarioPointRegion;
                var accg = rgn?._Data.AccelGrid ?? new rage__spdGrid2D();
                var bvh  = CurrentScenario.ScenarioRegion?.BVH;
                var emin = bvh?.Box.Minimum ?? Vector3.Zero;
                var emax = bvh?.Box.Maximum ?? Vector3.Zero;

                populatingui = true;
                //ScenarioYmtPanel.Enabled = true;
                ScenarioYmtNameTextBox.Text         = CurrentScenario.Name;
                ScenarioYmtVersionTextBox.Text      = rgn?.VersionNumber.ToString() ?? "";
                ScenarioYmtGridMinTextBox.Text      = FloatUtil.GetVector2String(accg.Min);
                ScenarioYmtGridMaxTextBox.Text      = FloatUtil.GetVector2String(accg.Max);
                ScenarioYmtGridScaleTextBox.Text    = FloatUtil.GetVector2String(accg.Scale);
                ScenarioYmtGridInfoLabel.Text       = "Total grid points: " + (rgn?.Unk_3844724227?.Length ?? 0).ToString();
                ScenarioYmtExtentsMinTextBox.Text   = FloatUtil.GetVector3String(emin);
                ScenarioYmtExtentsMaxTextBox.Text   = FloatUtil.GetVector3String(emax);
                ScenarioYmtFileLocationTextBox.Text = CurrentScenario.RpfFileEntry?.Path ?? "";
                ScenarioYmtProjectPathTextBox.Text  = (ProjectForm.CurrentProjectFile != null) ? ProjectForm.CurrentProjectFile.GetRelativePath(CurrentScenario.FilePath) : CurrentScenario.FilePath;
                populatingui = false;
            }
        }
示例#3
0
        private void UpdateUI()
        {
            if (CurrentZone?.AudioZone == null)
            {
                AddToProjectButton.Enabled = false;
                DeleteButton.Enabled       = false;

                populatingui           = true;
                NameTextBox.Text       = string.Empty;
                ShapeComboBox.Text     = string.Empty;
                InnerPosTextBox.Text   = string.Empty;
                InnerSizeTextBox.Text  = string.Empty;
                InnerAngleTextBox.Text = string.Empty;
                InnerVec1TextBox.Text  = string.Empty;
                InnerVec2TextBox.Text  = string.Empty;
                InnerVec3TextBox.Text  = string.Empty;
                OuterPosTextBox.Text   = string.Empty;
                OuterSizeTextBox.Text  = string.Empty;
                OuterAngleTextBox.Text = string.Empty;
                OuterVec1TextBox.Text  = string.Empty;
                OuterVec2TextBox.Text  = string.Empty;
                OuterVec3TextBox.Text  = string.Empty;
                UnkVec1TextBox.Text    = string.Empty;
                UnkVec2TextBox.Text    = string.Empty;
                UnkVec3TextBox.Text    = string.Empty;
                UnkBytesTextBox.Text   = string.Empty;
                Flags0TextBox.Text     = string.Empty;
                Flags1TextBox.Text     = string.Empty;
                Flags2TextBox.Text     = string.Empty;
                Hash0TextBox.Text      = string.Empty;
                Hash1TextBox.Text      = string.Empty;
                HashesTextBox.Text     = string.Empty;
                ExtParamsTextBox.Text  = string.Empty;
                populatingui           = false;
            }
            else
            {
                AddToProjectButton.Enabled = CurrentZone?.RelFile != null ? !ProjectForm.AudioFileExistsInProject(CurrentZone.RelFile) : false;
                DeleteButton.Enabled       = !AddToProjectButton.Enabled;

                populatingui = true;
                var z = CurrentZone.AudioZone;
                NameTextBox.Text       = z.NameHash.ToString();
                ShapeComboBox.Text     = z.Shape.ToString();
                InnerPosTextBox.Text   = FloatUtil.GetVector3String(z.PlaybackZonePosition);
                InnerSizeTextBox.Text  = FloatUtil.GetVector3String(z.PlaybackZoneSize);
                InnerAngleTextBox.Text = z.PlaybackZoneAngle.ToString();
                InnerVec1TextBox.Text  = FloatUtil.GetVector4String(z.PlaybackZoneVec1);
                InnerVec2TextBox.Text  = FloatUtil.GetVector4String(z.PlaybackZoneVec2);
                InnerVec3TextBox.Text  = FloatUtil.GetVector3String(z.PlaybackZoneVec3);
                OuterPosTextBox.Text   = FloatUtil.GetVector3String(z.ActivationZonePosition);
                OuterSizeTextBox.Text  = FloatUtil.GetVector3String(z.ActivationZoneSize);
                OuterAngleTextBox.Text = z.ActivationZoneAngle.ToString();
                OuterVec1TextBox.Text  = FloatUtil.GetVector4String(z.ActivationZoneVec1);
                OuterVec2TextBox.Text  = FloatUtil.GetVector4String(z.ActivationZoneVec2);
                OuterVec3TextBox.Text  = FloatUtil.GetVector3String(z.ActivationZoneVec3);
                UnkVec1TextBox.Text    = FloatUtil.GetVector4String(z.UnkVec1);
                UnkVec2TextBox.Text    = FloatUtil.GetVector4String(z.UnkVec2);
                UnkVec3TextBox.Text    = FloatUtil.GetVector2String(z.UnkVec3);
                UnkBytesTextBox.Text   = string.Format("{0}, {1}, {2}", z.Unk14, z.Unk15, z.Unk16);
                Flags0TextBox.Text     = z.Flags0.Hex;
                Flags1TextBox.Text     = z.Flags1.Hex;
                Flags2TextBox.Text     = z.Flags2.Hex;
                Hash0TextBox.Text      = z.UnkHash0.ToString();
                Hash1TextBox.Text      = z.UnkHash1.ToString();

                StringBuilder sb = new StringBuilder();
                if (z.Rules != null)
                {
                    foreach (var hash in z.Rules)
                    {
                        sb.AppendLine(hash.ToString());
                    }
                }
                HashesTextBox.Text = sb.ToString();

                sb.Clear();
                if (z.ExtParams != null)
                {
                    foreach (var extparam in z.ExtParams)
                    {
                        sb.Append(extparam.Hash.ToString());
                        sb.Append(", ");
                        sb.Append(FloatUtil.ToString(extparam.Value));
                        sb.AppendLine();
                    }
                }
                ExtParamsTextBox.Text = sb.ToString();

                populatingui = false;

                if (ProjectForm.WorldForm != null)
                {
                    ProjectForm.WorldForm.SelectObject(CurrentZone);
                }
            }
        }
示例#4
0
 public static string FormatVector2Swap(Vector2 v) //for use with WriteItemArray, swaps endianness
 {
     return(FloatUtil.GetVector2String(MetaUtils.SwapBytes(v)));
 }
示例#5
0
 public static string FormatVector2(Vector2 v) //for use with WriteItemArray
 {
     return(FloatUtil.GetVector2String(v));
 }