Example #1
0
        public Mission()
        {
            TreeViewNodes = null;
            TreeViewStatements = null;
            FlowLayoutPanelMain = null;
            FormMain = null;
            LabelMain = null;
            StatusStripMain = null;
            ToolStripObjectsTotal = null;
            ContextMenuStripForLabels = null;

            AssignFlowPanel();
            AssignNodeTreeView();
            AssignStatementTreeView();
            AssignForm();
            AssignLabel();
            AssignStatusToolStrip();
            AssignContextMenuStripForLabels();

            Dependencies = new DependencyGraph();

            AmountOfMissionEndStatements = 0;
            AmountOfCreatePlayerStatements = 0;
            VariableSetNames = new List<string>();
            VariableCheckNames = new List<string>();
            VariableCheckLocations = new Dictionary<string, List<MissionNode>>();
            TimerSetNames = new List<string>();
            TimerCheckNames = new List<string>();
            AllCreatedObjectNames = new List<string>();
            VariableNames = new List<string>();
            VariableNameHeaders = new List<string>();
            TimerNames = new List<string>();
            TimerNameHeaders = new List<string>();
            NamedObjectNames = new Dictionary<string,List<string>>();
            NamedObjectNames.Add("anomaly", new List<string>());
            NamedObjectNames.Add("blackHole", new List<string>());
            NamedObjectNames.Add("enemy", new List<string>());
            NamedObjectNames.Add("neutral", new List<string>());
            NamedObjectNames.Add("genericMesh", new List<string>());
            NamedObjectNames.Add("player", new List<string>());
            NamedObjectNames.Add("station", new List<string>());
            NamedObjectNames.Add("monster", new List<string>());
            NamedObjectNames.Add("whale", new List<string>());

            UndoStack = new Stack<MissionSavedState>();
            RedoStack = new Stack<MissionSavedState>();

            EventCount = 0;

            SuppressSelectionEvents = false;
            SupressSelectionEvents = false;
            SupressExpandCollapseEvents = false;
            UpdateSemaphoreCounter = 0;
        }
Example #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //MY INIT:
            if (!Settings.Load())
            {
                Settings.Current = new Settings();
                Settings.Save();
            }

            string missionFileName = null;
            string customVesselDataFileName = null;

            string[] argList = Environment.GetCommandLineArgs();
            if (argList.Length > 2 && argList[1] == "-v")
                customVesselDataFileName = argList[2];
            else if (argList.Length > 3 && argList[2] == "-v")
                customVesselDataFileName = argList[3];
            if (argList.Length > 1 && argList[1] != "-v")
                missionFileName = argList[1];

            FormLogInstance = new FormLog();
            FormMainInstance = new FormMain();
            FormSettingsInstance = new FormSettings();
            FormFindReplaceInstance = new   FormFindReplace();
            FormSearchResultsInstance = new   FormSearchResults();
            FormDependencyInstance  = new   FormDependency();
            FormHelpInstance	= new	FormHelp();
            FormMissionPropertiesInstance	= new	FormMissionProperties();
            FormNotepadInstance = new FormNotepad();

            AllOwnedForms = new List<Form>();
            AllOwnedForms.Add(FormSettingsInstance);
            AllOwnedForms.Add(FormSettingsInstance);
            AllOwnedForms.Add(FormFindReplaceInstance);
            AllOwnedForms.Add(FormSearchResultsInstance);
            AllOwnedForms.Add(FormDependencyInstance);
            AllOwnedForms.Add(FormHelpInstance);
            AllOwnedForms.Add(FormMissionPropertiesInstance);
            AllOwnedForms.Add(FormNotepadInstance);
            AllOwnedForms.Add(FormLogInstance);

            foreach (Form form in AllOwnedForms)
            {
                form.Owner = FormMainInstance;
                form.Deactivate +=  new EventHandler((object sender, EventArgs e) => { ((Form)sender).Opacity = Settings.Current.FormOpacity; });
                form.Activated += new EventHandler((object sender, EventArgs e) => { ((Form)sender).Opacity = 1.0; });
            }

            string currentVesselDataPathToLoad = customVesselDataFileName ?? Settings.Current.DefaultVesselDataPath;
            if (File.Exists(currentVesselDataPathToLoad))
                VesselData.Current.Load(currentVesselDataPathToLoad);

            if (File.Exists(missionFileName))
                Mission.Current.FromFile(missionFileName);

            //Start
            Application.Run(FormMainInstance);
        }
Example #3
0
        /// <summary> Assign new form to the mission </summary>
        public void AssignForm(Forms.FormMain value = null)
        {
            if (FormMain != null)
            {
                FormMain.KeyDown -= _E_form_KeyDown;
            }
            FormMain = null;

            if (value == null)
                return;

            FormMain = value;
            FormMain.KeyDown += _E_form_KeyDown;
        }