Exemplo n.º 1
0
        //[JB] This function performs the necessary data saving and swapping when selecting a new Briefing.
        private void ChangeBriefingIndex(int briefIndex)
        {
            if(_loading) return;

            if (briefIndex == _currentCollectionIndex) return;
            if (briefIndex > cboBriefIndex1.Items.Count)
                briefIndex = cboBriefIndex1.Items.Count - briefIndex;

            Save();  //Save current changes before switching

            _currentCollectionIndex = briefIndex;
            if (_platform == Settings.Platform.XvT)
            {
                _xvtBriefing = _xvtBriefingCollection[briefIndex];
                //These select lines copied from the constructor to re-load and re-init particular data sets and controls.
                _events = new short[_maxEvents, 6];
                _tags = _xvtBriefing.BriefingTag;
                _strings = _xvtBriefing.BriefingString;
                importStrings();
                txtLength.Text = Convert.ToString(Math.Round(((decimal)_xvtBriefing.Length / _timerInterval), 2));
                lstEvents.Items.Clear();
                importEvents(_xvtBriefing.Events);
                numUnk1.Value = _xvtBriefing.Unknown1;
                numUnk3.Value = _xvtBriefing.Unknown3;
                cboText.SelectedIndex = 0;
                cboFGTag.SelectedIndex = 0;
                cboTextTag.SelectedIndex = 0;
                cboColorTag.SelectedIndex = 0;
            }
            else if (_platform == Settings.Platform.XWA)
            {
                _xwaBriefing = _xwaBriefingCollection[briefIndex];
                //These select lines copied from the constructor to re-load and re-init particular data sets and controls.
                _events = new short[_maxEvents, 6];
                _tags = _xwaBriefing.BriefingTag;
                _strings = _xwaBriefing.BriefingString;
                importStrings();
                txtLength.Text = Convert.ToString(Math.Round(((decimal)_xwaBriefing.Length / _timerInterval), 2));
                lstEvents.Items.Clear();
                importEvents(_xwaBriefing.Events);
                numUnk1.Value = _xwaBriefing.Unknown1;
                numUnk3.Enabled = false;
                txtNotes.Enabled = true;
                txtNotes.Text = _xwaBriefing.BriefingStringsNotes[0];
                cboText.SelectedIndex = 0;
                cboFGTag.SelectedIndex = 0;
                cboTextTag.SelectedIndex = 0;
                cboColorTag.SelectedIndex = 0;
                cboInfoCraft.SelectedIndex = 0;
                cboRCraft.SelectedIndex = 0;
                cboRotateAmount.SelectedIndex = 0;
                cboMoveIcon.SelectedIndex = 0;
                cboNewIcon.SelectedIndex = 0;
                cboNCraft.SelectedIndex = 0;
                cboIconIff.SelectedIndex = 0;
            }

            //Refresh controls
            if(lstEvents.Items.Count > 0)
                lstEvents.SelectedIndex = 0;
            if (tabBrief.SelectedIndex == 0) //Only update the map if the tab is visible.
            {
                hsbTimer.Value = 1;
                hsbTimer.Value = 0;  //Need both changes to force the map to update
            }
            UpdateTitle();
            RefreshTeamList();
        }
Exemplo n.º 2
0
        public BriefingForm(Platform.Xwa.BriefingCollection briefing)
        {
            _loading = true;
            _platform = Settings.Platform.XWA;
            _titleColor = Color.FromArgb(0x63, 0x82, 0xFF);
            _normalColor = Color.FromArgb(0xFF, 0xFF, 0xFF);
            _highlightColor = _titleColor;
            _zoomX = 32;
            _zoomY = _zoomX;
            _xwaBriefingCollection = briefing; //[JB] Added
            _currentCollectionIndex = 0;
            _xwaBriefing = briefing[0];
            _maxEvents = Platform.Xwa.Briefing.EventQuantityLimit;
            _events = new short[_maxEvents, 6];
            InitializeComponent();
            this.Text = "YOGEME Briefing Editor - XWA";
            #region XWA layout change
            label7.Text = "Icon:";
            Height = 480;
            Width = 756;
            tabBrief.Width = 752;
            Point loc = new Point(608, 246);
            pnlShipTag.Location = loc;
            pnlTextTag.Location = loc;
            pnlShipInfo.Location = loc;
            pnlRotate.Location = loc;
            pnlMove.Location = loc;
            pnlNew.Location = loc;
            pnlRegion.Location = loc;
            cmdNewShip.Visible = true;
            cmdMoveShip.Visible = true;
            cmdRotate.Visible = true;
            cmdShipInfo.Visible = true;
            cmdRegion.Visible = true;
            pctBrief.Size = new Size(510, 294);
            pctBrief.Left += 36;
            w = pctBrief.Width;
            h = pctBrief.Height;
            lblTitle.BackColor = Color.FromArgb(0x18, 0x18, 0x18);
            lblTitle.Size = new Size(510, 28);
            lblTitle.Left += 36;
            lblTitle.Top -= 4;
            lblTitle.TextAlign = ContentAlignment.TopCenter;
            lblTitle.ForeColor = _titleColor;
            lblTitle.Text = "*Defined in .LST file*";
            lblTitle.Font = new Font("Arial", 10F, FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            cmdTitle.Enabled = false;
            lblCaption.BackColor = Color.FromArgb(0x20, 0x30, 0x88);
            lblCaption.Font = new Font("Arial", 8F, FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            lblCaption.Size = new Size(510, 40);
            lblCaption.Top += 68;
            lblCaption.Left += 36;
            vsbBRF.Left -= 38;
            vsbBRF.Height = 294;
            tabBrief.Height += 58;
            hsbBRF.Top += 70;
            hsbBRF.Width = 510;
            hsbBRF.Left += 36;
            lblInstruction.Top += 58;
            pnlBottomRight.Top += 58;
            pnlBottomLeft.Top += 58;
            dataT.Height += 58;
            dataS.Height += 58;
            lstEvents.Height += 58;
            cboColorTag.Items.Clear();
            cboColorTag.Items.Add("Green");
            cboColorTag.Items.Add("Red");
            cboColorTag.Items.Add("Yellow");
            cboColorTag.Items.Add("Purple");
            cboColorTag.Items.Add("Pink");
            cboColorTag.Items.Add("Blue");
            cboColor.Items.Clear();
            cboColor.Items.Add("Green");
            cboColor.Items.Add("Red");
            cboColor.Items.Add("Yellow");
            cboColor.Items.Add("Purple");
            cboColor.Items.Add("Pink");
            cboColor.Items.Add("Blue");
            cboEvent.Items.Add("New Icon");
            cboEvent.Items.Add("Show Ship Data");
            cboEvent.Items.Add("Move Icon");
            cboEvent.Items.Add("Rotate Icon");
            cboEvent.Items.Add("Switch to Region");
            cboCraft.Items.AddRange(Platform.Xwa.Strings.CraftType);
            cboNCraft.Items.AddRange(Platform.Xwa.Strings.CraftType);
            #endregion
            importDat(Application.StartupPath + "\\images\\XWA_BRF.dat", 56);
            _tags = _xwaBriefing.BriefingTag;
            _strings = _xwaBriefing.BriefingString;
            importStrings();
            _timerInterval = Platform.Xwa.Briefing.TicksPerSecond;
            txtLength.Text = Convert.ToString(Math.Round(((decimal)_xwaBriefing.Length / _timerInterval), 2));
            hsbTimer.Maximum = _xwaBriefing.Length + 11;
            w = pctBrief.Width;
            h = pctBrief.Height;
            _mapX = 0;
            _mapY = 0;
            lstEvents.Items.Clear();
            _briefData = new BriefData[100];	// this way I don't have to deal with expanding the array
            string[] names = new string[100];
            for (int i=0;i<_briefData.Length;i++) names[i] = "Icon #" + i;
            cboFG.Items.AddRange(names);
            cboFGTag.Items.AddRange(names);
            cboInfoCraft.Items.AddRange(names);
            cboRCraft.Items.AddRange(names);
            cboMoveIcon.Items.AddRange(names);
            cboNewIcon.Items.AddRange(names);
            importEvents(_xwaBriefing.Events);
            hsbTimer.Value = 0;
            numUnk1.Value = _xwaBriefing.Unknown1;
            numUnk3.Enabled = false;
            txtNotes.Enabled = true;
            txtNotes.Text = _xwaBriefing.BriefingStringsNotes[0];
            cboText.SelectedIndex = 0;
            cboFGTag.SelectedIndex = 0;
            cboTextTag.SelectedIndex = 0;
            cboColorTag.SelectedIndex = 0;
            cboInfoCraft.SelectedIndex = 0;
            cboRCraft.SelectedIndex = 0;
            cboRotateAmount.SelectedIndex = 0;
            cboMoveIcon.SelectedIndex = 0;
            cboNewIcon.SelectedIndex = 0;
            cboNCraft.SelectedIndex = 0;
            cboIconIff.SelectedIndex = 0;

            //[JB] Set values for team selection dropdown
            for (int i = 0; i < _xwaBriefingCollection.Count; i++)  //XvT has 8 briefings
            {
                string s = "Briefing " + (i + 1);
                cboBriefIndex1.Items.Add(s);
                cboBriefIndex2.Items.Add(s);
            }
            for(int i = 0; i < 10; i++)  //XWA has 10 teams
                lstTeams.Items.Add((i + 1) + ": " + sharedTeamNames[i]);
            cboBriefIndex1.SelectedIndex = 0;
            cboBriefIndex2.SelectedIndex = 0;
            RefreshTeamList();
            UpdateTitle();

            _loading = false;
            PostLoadInit();
        }