示例#1
0
 public BattleForm(Settings config)
 {
     InitializeComponent();
     //this.Height = 342;
     if (!config.TieInstalled)
     {
         MessageBox.Show("TIE95 installation not found, Battle function not available", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
         return;
     }
     else
     {
         _installPath = config.TiePath;
         // dummy bitmap to create a 256 color palette
         //palette definition
         // start with EMPIRE.PLTTstandard
         Pltt standard = (Pltt)(new LfdFile(_installPath + "\\RESOURCE\\EMPIRE.LFD").Resources["PLTTstandard"]);
         // then open up TOURDESK for the rest
         LfdFile tourdesk = new LfdFile(_installPath + "\\RESOURCE\\TOURDESK.LFD");
         Pltt    toddesk  = (Pltt)tourdesk.Resources["PLTTtoddesk"];
         _systemPalette = Pltt.ConvertToPalette(new Pltt[] { standard, toddesk });
         Delt galaxy = (Delt)tourdesk.Resources["DELTgalaxy"];
         galaxy.Palette       = _systemPalette;
         _galaxyImage         = galaxy.Image;
         picGalaxy.Image      = _galaxyImage;
         picGalaxy.Size       = _galaxyImage.Size;
         numFrameLeft.Maximum = _galaxyImage.Width - 1;
         numFrameTop.Maximum  = _galaxyImage.Height - 1;
     }
     _battlePath = _installPath + "\\RESOURCE\\Battle1.lfd";
     opnMission.InitialDirectory = _installPath + "\\MISSION";
     try { loadFile(_battlePath); }
     catch (Exception x)
     {
         MessageBox.Show(x.Message + " Battle function not available", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
 }
示例#2
0
 public OfficerPreviewForm(Questions questions)
 {
     try
     {
         string path = new Settings().TiePath + "\\RESOURCE\\";
         _empire = new LfdFile(path + "EMPIRE.LFD");
         _talk   = new LfdFile(path + "TALK.LFD");
     }
     catch (System.IO.FileNotFoundException)
     {
         MessageBox.Show("TIE resource files not found, preview unavailable", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Close();
     }
     _questions = questions;
     InitializeComponent();
     #region Pltt assignments
     Pltt         standard = (Pltt)_empire.Resources["PLTTstandard"];
     Pltt         offcr21  = (Pltt)_talk.Resources["PLTToffcr21"];
     Pltt         offbak   = (Pltt)_talk.Resources["PLTToffbak"];
     Pltt         ssrobe9  = (Pltt)_talk.Resources["PLTTssrobe9"];
     Pltt         ssbak    = (Pltt)_talk.Resources["PLTTssbak"];
     Pltt         doffbak  = (Pltt)_talk.Resources["PLTTdoffbak"];
     Pltt         dssbak   = (Pltt)_talk.Resources["PLTTdssbak"];
     ColorPalette brf_off  = Pltt.ConvertToPalette(new Pltt[] { standard, offcr21, offbak });
     ColorPalette brf_ss   = Pltt.ConvertToPalette(new Pltt[] { standard, ssrobe9, ssbak });
     ColorPalette dbrf_off = Pltt.ConvertToPalette(new Pltt[] { standard, offcr21, doffbak });
     ColorPalette dbrf_ss  = Pltt.ConvertToPalette(new Pltt[] { standard, ssrobe9, dssbak });
     ((Delt)_talk.Resources["DELToffbak"]).Palette = brf_off;
     Delt temp = (Delt)_talk.Resources["DELTofftxt"];
     temp.Palette = brf_off;
     temp.Image.MakeTransparent(Color.Black);
     ((Delt)_talk.Resources["DELTdoffbak"]).Palette = dbrf_off;
     temp         = (Delt)_talk.Resources["DELTdofftxt"];
     temp.Palette = dbrf_off;
     temp.Image.MakeTransparent(Color.Black);
     temp         = (Delt)_talk.Resources["DELToffcr21"];
     temp.Palette = brf_off;
     temp.Image.MakeTransparent(Color.Black);
     ((Anim)_talk.Resources["ANIMeyes"]).SetPalette(brf_off);
     ((Anim)_talk.Resources["ANIMmouth"]).SetPalette(brf_off);
     ((Delt)_talk.Resources["DELTssbak"]).Palette = brf_ss;
     temp         = (Delt)_talk.Resources["DELTsstxt"];
     temp.Palette = brf_ss;
     temp.Image.MakeTransparent(Color.Black);
     ((Delt)_talk.Resources["DELTdssbak"]).Palette = dbrf_ss;
     temp         = (Delt)_talk.Resources["DELTdsstxt"];
     temp.Palette = dbrf_ss;
     temp.Image.MakeTransparent(Color.Black);
     temp         = (Delt)_talk.Resources["DELTssrobe9"];
     temp.Palette = brf_ss;
     temp.Image.MakeTransparent(Color.Black);
     ((Anim)_talk.Resources["ANIMssface"]).SetPalette(brf_ss);
     // offcr21, eyes, mouth, ssrobe9 and ssface technically change between brf and dbrf, but not really
     ((LfdReader.Font)_empire.Resources[_fontID]).SetColor(_normalText);
     #endregion
     #region array declarations
     _opts[0] = optPreOff;
     _opts[1] = optPreSec;
     _opts[2] = optPostOff;
     _opts[3] = optPostSec;
     for (int i = 0; i < 4; i++)
     {
         _opts[i].CheckedChanged += new EventHandler(optsArr_CheckedChanged);
     }
     _opts[0].Checked = true;
     #endregion
 }
 public OfficerPreviewForm(Questions questions, int officer, int question, Settings config)
 {
     try
     {
         string path = config.TiePath + "\\RESOURCE\\";
         _empire = new LfdFile(path + "EMPIRE.LFD");
         _talk   = new LfdFile(path + "TALK.LFD");
     }
     catch (System.IO.FileNotFoundException)
     {
         MessageBox.Show("TIE resource files not found, preview unavailable", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Close();
     }
     _questions = questions;
     InitializeComponent();
     #region Pltt assignments
     Pltt         standard = (Pltt)_empire.Resources["PLTTstandard"];
     Pltt         offcr21  = (Pltt)_talk.Resources["PLTToffcr21"];
     Pltt         offbak   = (Pltt)_talk.Resources["PLTToffbak"];
     Pltt         ssrobe9  = (Pltt)_talk.Resources["PLTTssrobe9"];
     Pltt         ssbak    = (Pltt)_talk.Resources["PLTTssbak"];
     Pltt         doffbak  = (Pltt)_talk.Resources["PLTTdoffbak"];
     Pltt         dssbak   = (Pltt)_talk.Resources["PLTTdssbak"];
     ColorPalette brf_off  = Pltt.ConvertToPalette(new Pltt[] { standard, offcr21, offbak });
     ColorPalette brf_ss   = Pltt.ConvertToPalette(new Pltt[] { standard, ssrobe9, ssbak });
     ColorPalette dbrf_off = Pltt.ConvertToPalette(new Pltt[] { standard, offcr21, doffbak });
     ColorPalette dbrf_ss  = Pltt.ConvertToPalette(new Pltt[] { standard, ssrobe9, dssbak });
     ((Delt)_talk.Resources["DELToffbak"]).Palette = brf_off;
     Delt temp = (Delt)_talk.Resources["DELTofftxt"];
     temp.Palette = brf_off;
     temp.Image.MakeTransparent(Color.Black);
     ((Delt)_talk.Resources["DELTdoffbak"]).Palette = dbrf_off;
     temp         = (Delt)_talk.Resources["DELTdofftxt"];
     temp.Palette = dbrf_off;
     temp.Image.MakeTransparent(Color.Black);
     temp         = (Delt)_talk.Resources["DELToffcr21"];
     temp.Palette = brf_off;
     temp.Image.MakeTransparent(Color.Black);
     ((Anim)_talk.Resources["ANIMeyes"]).SetPalette(brf_off);
     ((Anim)_talk.Resources["ANIMmouth"]).SetPalette(brf_off);
     ((Delt)_talk.Resources["DELTssbak"]).Palette = brf_ss;
     temp         = (Delt)_talk.Resources["DELTsstxt"];
     temp.Palette = brf_ss;
     temp.Image.MakeTransparent(Color.Black);
     ((Delt)_talk.Resources["DELTdssbak"]).Palette = dbrf_ss;
     temp         = (Delt)_talk.Resources["DELTdsstxt"];
     temp.Palette = dbrf_ss;
     temp.Image.MakeTransparent(Color.Black);
     temp         = (Delt)_talk.Resources["DELTssrobe9"];
     temp.Palette = brf_ss;
     temp.Image.MakeTransparent(Color.Black);
     ((Anim)_talk.Resources["ANIMssface"]).SetPalette(brf_ss);
     // offcr21, eyes, mouth, ssrobe9 and ssface technically change between brf and dbrf, but not really
     ((LfdReader.Font)_empire.Resources[_fontID]).SetColor(_normalText);
     #endregion
     #region array declarations
     _opts[0] = optPreOff;
     _opts[1] = optPreSec;
     _opts[2] = optPostOff;
     _opts[3] = optPostSec;
     for (int i = 0; i < 4; i++)
     {
         _opts[i].CheckedChanged += new EventHandler(optsArr_CheckedChanged);
     }
     #endregion
     _activeColor = _normalText;
     if (officer < 0 || officer >= 4)
     {
         officer = 0;
     }
     _opts[officer].Checked = true;
     if (question >= 0 && question <= 4)
     {
         _selectedIndex = -1;  //Prevent "selecting" the wrong question when drawing the selection highlight.
         loadBackAndQuestions();
         for (int i = 0; i < _indexes.Length; i++)
         {
             if (question == _indexes[i])
             {
                 displayQuestion(i);  //This will set the actual _selectedIndex
             }
         }
     }
 }