public override void OnOpen()
        {
            this.NeedsUpdate = true;

            iCampaignName.Instance.CampaignName = Window_SaveGameMenu.Instance.OverallCampaignName;
            if (debug)
            {
                ArcenDebugging.ArcenDebugLogSingleLine("Overall campaign is: " + Window_SaveGameMenu.Instance.OverallCampaignName, Verbosity.DoNotShow);
            }
            //pause the game once we enter the save game menu. I think this is a nice
            //quality of life improvement for the player. If the game is already paused,
            //do nothing
            if (!World_AIW2.Instance.IsPaused)
            {
                GameCommand command = GameCommand.Create(GameCommandType.TogglePause);
                World_AIW2.Instance.QueueGameCommand(command, true);
            }
        }
Example #2
0
            public override void UpdateContent(ArcenUIWrapperedUnityImage Image, ArcenUI_Image.SubImageGroup _SubImages, SubTextGroup _SubTexts)
            {
                //this.SubImages = _SubImages;
                this.SubTexts = _SubTexts;
                string nextText = this.WrappedNextTextToShow;

                if (this.LastTextToShow.Length <= 0 && nextText.Length <= 0)
                {
                    return;
                }

                try
                {
                    if (this.LastTextToShow != nextText)
                    {
                        this.LastTextToShow = nextText;
                    }
                    ArcenDoubleCharacterBuffer buffer = SubTexts[0].Text.StartWritingToBuffer();
                    buffer.Add(this.LastTextToShow);
                    SubTexts[0].Text.FinishWritingToBuffer();
                }
                catch (Exception e)
                {
                    ArcenDebugging.ArcenDebugLog("Exception in UpdateContent for the single text element:" + e.ToString(), Verbosity.ShowAsError);
                }

                float targetXPixel = ArcenInput.MouseScreenX + 5;
                float targetYPixel = ArcenUI.Instance.LastScreenHeight - (ArcenInput.MouseScreenY + 5);
                float maxXPixel    = ArcenUI.Instance.LastScreenWidth - this.LastRequestedWidth;
                float maxYPixel    = ArcenUI.Instance.LastScreenHeight - this.LastRequestedHeight;

                targetXPixel = Mathf.Min(targetXPixel, maxXPixel);
                targetYPixel = Mathf.Min(targetYPixel, maxYPixel);
                float xPercent = targetXPixel / ArcenUI.Instance.PixelsPerPercent_X;
                float yPercent = targetYPixel / ArcenUI.Instance.PixelsPerPercent_Y;

                this.Element.Window.SubContainer.Alignment.XAlignment.Offset = xPercent;
                this.Element.Window.SubContainer.Alignment.YAlignment.Offset = yPercent;
            }
            public override MouseHandlingResult HandleClick()
            {
                bool   debug       = false;
                string SaveName    = this.SaveGame.ToString();
                string oldSaveName = this.SaveGame.saveName;
                string path        = Engine_Universal.CurrentPlayerDataDirectory + "Save/" + SaveName + Engine_Universal.SaveExtension;
                string oldPath     = Engine_Universal.CurrentPlayerDataDirectory + "Save/" + oldSaveName + Engine_Universal.SaveExtension;

                //if ( path.Contains( " " ) )
                //{
                //    path = "\"" + path + "\"";
                //}
                if (debug)
                {
                    ArcenDebugging.ArcenDebugLogSingleLine("Trying to load from " + path, Verbosity.DoNotShow);
                }
                if (File.Exists(path))
                {
                    SFXItemTable.TryPlayItemByName_GUIOnly("ButtonStartGame");
                    Window_SaveGameMenu.Instance.OverallCampaignName = this.SaveGame.campaignName;
                    Engine_Universal.LoadGame(SaveName);
                    Instance.Close();
                }
                else if (File.Exists(oldPath))
                {
                    SFXItemTable.TryPlayItemByName_GUIOnly("ButtonStartGame");
                    Window_SaveGameMenu.Instance.OverallCampaignName = this.SaveGame.campaignName;
                    Engine_Universal.LoadGame(oldSaveName);
                    Instance.Close();
                }
                else
                {
                    ArcenDebugging.ArcenDebugLogSingleLine("File does not exist" + Environment.NewLine + "path=" + path + Environment.NewLine + "oldPath=" + oldPath, Verbosity.DoNotShow);
                    return(MouseHandlingResult.PlayClickDeniedSound);
                }
                return(MouseHandlingResult.DoNotPlayClickSound);
            }
        /* This is shared between the SaveGameMenu and LoadGameMenu
         * classes, hence having its own class. This function will
         * read all the on-disk data and store it in a Dictionary
         * whose keys are the campaign names, and whose value is
         * a list of all Saved Games from that campaign */
        internal static Dictionary <string, List <SaveGameData> > parseOnDiskSaveGames()
        {
            bool debug = false;
            Dictionary <string, List <SaveGameData> > gameDict = new Dictionary <string, List <SaveGameData> >(); //this maps from a campaignName to the list of save games for that campaign
            string directoryPath = Engine_Universal.CurrentPlayerDataDirectory + "Save/";

            string[] files         = Directory.GetFiles(directoryPath, "*" + Engine_Universal.SaveExtension);
            string[] fullSaveNames = new string[files.Length];
            for (int i = 0; i < files.Length; i++)
            {
                string file = files[i];

                string fullSaveName = Path.GetFileNameWithoutExtension(file);
                fullSaveNames[i] = fullSaveName;
                DateTime     dt       = File.GetLastWriteTime(file);
                SaveGameData saveGame = new SaveGameData(fullSaveName, dt);
                if (debug)
                {
                    ArcenDebugging.ArcenDebugLogSingleLine("Parsing save game " + i + " of " + files.Length + " --> " + saveGame.ToString() + "And adding to campaign " + saveGame.campaignName, Verbosity.DoNotShow);
                }
                List <SaveGameData> list;
                if (!gameDict.ContainsKey(saveGame.campaignName))
                {
                    //If this is the first save file seen from a given campaign,
                    //create the list
                    list = new List <SaveGameData>();
                    list.Add(saveGame);
                    gameDict[saveGame.campaignName] = list;
                }
                else
                {
                    //Add a saved game to a pre-existing campaign
                    gameDict[saveGame.campaignName].Add(saveGame);
                }
            }
            return(gameDict);
        }
Example #5
0
            public override void GetTextToShow(ArcenDoubleCharacterBuffer buffer)
            {
                int debugStage = 0;

                try
                {
                    debugStage = 1;
                    if (Engine_AIW2.Instance.CurrentGameViewMode == GameViewMode.GalaxyMapView &&
                        Planet.CurrentlyHoveredOver != null &&
                        GameEntityTypeData.CurrentlyHoveredOver == null &&
                        GameEntity.CurrentlyHoveredOver == null)
                    {
                        debugStage = 2;
                        Planet relatedPlanet = Planet.CurrentlyHoveredOver;
                        if (relatedPlanet != null)
                        {
                            debugStage = 3;
                            buffer.Add("<u>Hovered over planet:</u>\n");
                            WorldSide owner = relatedPlanet.GetControllingSide();
                            if (owner.Type == WorldSideType.AI)
                            {
                                relatedPlanet.MarkLevel.WriteStartColorHexTo(buffer);
                            }

                            debugStage = 4;
                            buffer.Add(relatedPlanet.Name);

                            debugStage = 5;
                            if (owner.Type == WorldSideType.AI)
                            {
                                buffer.Add("  ").Add(relatedPlanet.MarkLevel.Abbreviation);
                                relatedPlanet.MarkLevel.WriteEndColorHexTo(buffer);
                            }

                            debugStage = 6;
                            buffer.Add(" <color=#8b8b8b>(");
                            buffer.Add(relatedPlanet.GalaxyLocation.ToString());
                            buffer.Add(")</color>");
                            if (owner.Type == WorldSideType.NaturalObject)
                            {
                                buffer.Add("\nPlanet is neutral territory");
                            }
                            else
                            {
                                buffer.Add("\nPlanet owned by: ");
                                buffer.Add(" (");
                                buffer.Add(owner.Type.ToString());
                                buffer.Add("-");
                                buffer.Add(owner.TeamColor.InternalName);
                                buffer.Add(")");
                            }

                            debugStage = 7;
                            bool isFirstResource = true;
                            for (ResourceType resource = ResourceType.None + 1; resource < ResourceType.Length; resource++)
                            {
                                if (isFirstResource)
                                {
                                    buffer.Add("\n");
                                    isFirstResource = false;
                                }
                                else
                                {
                                    buffer.Add("  ");
                                }
                                buffer.Add("<color=#ffee8e>").Add(resource.ToString()).Add(":</color> ").Add(relatedPlanet.ResourceOutputs[resource]);
                            }
                        }
                    }

                    debugStage = 30;
                }
                catch (Exception e)
                {
                    ArcenDebugging.ArcenDebugLog("Exception in lower left tooltip text generation at stage " + debugStage + ":" + e.ToString(), Verbosity.ShowAsError);
                }
            }
            /* These buttons are either Campaign Buttons or Load buttons.
             * I tried 2 different classes, but I couldn't figure out how
             * to make the old buttons disappear once I changed screens.
             * This way works though */
            public override void OnUpdate()
            {
                if (Instance.HasUpdatedSinceLastClose)
                {
                    return;
                }
                bool debug = false;

                Instance.HasUpdatedSinceLastClose = true;

                ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element;

                elementAsType.ClearButtons();

                Dictionary <string, List <SaveGameData> > gameDict = SaveLoadMethods.parseOnDiskSaveGames();

                if (!Instance.showCampaignButtons)
                {
                    //these are Load Game buttons
                    if (Window_LoadGameMenu.Instance.campaignName == "")
                    {
                        ArcenDebugging.ArcenDebugLogSingleLine("WARNING: campaign name is null ", Verbosity.DoNotShow);
                    }
                    if (debug)
                    {
                        ArcenDebugging.ArcenDebugLogSingleLine("Showing saved games in LoadGames from campaign " + Window_LoadGameMenu.Instance.campaignName, Verbosity.DoNotShow);
                    }
                    //get the saved games for this campaign
                    List <SaveGameData> list = gameDict[Window_LoadGameMenu.Instance.campaignName];
                    //sort saved games by elapsed in game time
                    list.Sort(delegate(SaveGameData x, SaveGameData y)
                    {
                        return(-x.secondsSinceGameStart.CompareTo(y.secondsSinceGameStart));
                    });

                    //This code allows for multiple columns to automatically wrap
                    int     maxHeightPerColumn = 80;
                    int     xModForLoadButtons = -4; //Load buttons are a bit smaller than campaign buttons
                    int     yModForLoadButtons = -4;
                    int     gamesPerColumn     = (int)maxHeightPerColumn / (int)(elementAsType.ButtonHeight + yModForLoadButtons);
                    int     distBetweenColumns = 2;
                    Vector2 sizeForLoadButtons;
                    sizeForLoadButtons.x = elementAsType.ButtonWidth + xModForLoadButtons;
                    sizeForLoadButtons.y = elementAsType.ButtonHeight + yModForLoadButtons;
                    if (debug)
                    {
                        ArcenDebugging.ArcenDebugLogSingleLine("gamesPerColumn " + gamesPerColumn + "botton  height " + elementAsType.ButtonHeight + "maxHeight " + maxHeightPerColumn, Verbosity.DoNotShow);
                    }
                    for (int k = 0; k < list.Count; k++)
                    {
                        Vector2 offset;
                        offset.y = (k % gamesPerColumn) * (elementAsType.ButtonHeight + yModForLoadButtons);
                        offset.x = (k / gamesPerColumn) * (elementAsType.ButtonWidth + xModForLoadButtons) + distBetweenColumns * (k / gamesPerColumn);
                        AddLoadButton(elementAsType, list[k], offset, sizeForLoadButtons);
                    }
                }
                else
                {
                    //these are campaign buttons
                    List <SaveGameData> campaignList = new List <SaveGameData>();
                    foreach (KeyValuePair <string, List <SaveGameData> > entry in gameDict)
                    {
                        //Campaign buttons are sorted by "Last save Wall Clock date"
                        //Find the furthest-in game from each campaign to check for the
                        //Wall Clock time and add it to the campaignList
                        List <SaveGameData> list = entry.Value;
                        list.Sort(delegate(SaveGameData x, SaveGameData y)
                        {
                            return(-x.secondsSinceGameStart.CompareTo(y.secondsSinceGameStart));
                        });
                        campaignList.Add(list[0]);
                    }
                    //Now sort by Wall Clock
                    campaignList.Sort(delegate(SaveGameData x, SaveGameData y)
                    {
                        return(-x.lastModified.CompareTo(y.lastModified));
                    });

                    //Allow columns to wrap nicely
                    int maxHeightPerColumn = 80;
                    int gamesPerColumn     = (int)maxHeightPerColumn / (int)elementAsType.ButtonHeight;
                    int distBetweenColumns = 2;
                    for (int k = 0; k < campaignList.Count; k++)
                    {
                        Vector2 offset;
                        offset.y = (k % gamesPerColumn) * elementAsType.ButtonHeight;
                        offset.x = (k / gamesPerColumn) * elementAsType.ButtonWidth + distBetweenColumns * (k / gamesPerColumn);
                        AddCampaignButton(elementAsType, campaignList[k], offset);
                    }
                }
                elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared();
            }
Example #7
0
        public void DoPerSimStepLogic(WorldSide side, ArcenSimContext Context)
        {
            //NOTE: this is not "real" logic, just a demo of how to use custom xml data; it will fire right after you start a new game, if you have the Devourer enabled
            //if ( World_AIW2.Instance.GameSecond <= 1 && World_AIW2.Instance.IsFirstFrameOfSecond )
            //{
            //    //this just dumps all custom data attached to the external constants object, regardless of who put it there
            //    //Useful if something isn't working right and you want to check to see if you have a typo in an attribute name, etc.
            //    ArcenDebugging.ArcenDebugLogSingleLine( ExternalConstants.Instance.DebugCustomData_GetAllKeysInAllNamespaces(), Verbosity.ShowAsInfo );

            //    //this corresponds to the "custom_int_examplemod_test_custom_number" attribute in the external constants xml file; here are the pieces:
            //    //"custom_" always have to have this prefix
            //    //"int_" tells it this is a 32-bit int value; other valid options are bool, float, FInt, and string
            //    //"examplemod_" is whatever you want to put in there, with no _ characters in the middle, and this functions as the "namespace" to differentiate the field from others in case some other modder has a "test_custom_number"
            //    //"test_custom_number" is just the rest of the attribute name, and functions as the actual name of the field
            //    CustomDataSet externalConstantsCustomData = ExternalConstants.Instance.GetCustomData( "examplemod" );
            //    int testCustomNumber = externalConstantsCustomData.GetInt( "test_custom_number" );
            //    ArcenDebugging.ArcenDebugLogSingleLine( testCustomNumber.ToString(), Verbosity.ShowAsInfo );
            //}

            //NOTE: there's no "real" logic here, it's just a demo of how to use external data
            if (!DoomData.DoDebugTestingLogic)
            {
                return;
            }
            if (!World_AIW2.Instance.IsFirstFrameOfSecond)
            {
                return;
            }

            DoomData.Primitives doomDataPrimitives = World.Instance.GetDoomData_Primitives();
            if (World.Instance.GetDoomData_DoomedPlanetIndices() == null)
            {
                World.Instance.SetDoomData_DoomedPlanetIndices(new List <int>());
            }
            List <int> doomedPlanetIndices = World.Instance.GetDoomData_DoomedPlanetIndices();

            if (doomDataPrimitives.SecondsUntilNextDoomPlanetPick == 0)
            {
                doomDataPrimitives.SecondsUntilNextDoomPlanetPick = 10;
            }
            doomDataPrimitives.SecondsUntilNextDoomPlanetPick--;

            if (doomDataPrimitives.SecondsUntilNextDoomPlanetPick <= 0)
            {
                ArcenDebugging.ArcenDebugLogSingleLine("Picking Planet To Doom", Verbosity.DoNotShow);
                doomDataPrimitives.SecondsUntilNextDoomPlanetPick = 5;

                List <Planet> candidates = new List <Planet>();
                List <Planet> allPlanets = World_AIW2.Instance.SetOfGalaxies.Galaxies[0].Planets;
                for (int i = 0; i < allPlanets.Count; i++)
                {
                    Planet planet = allPlanets[i];
                    if (doomedPlanetIndices.ContainsValueType(planet.PlanetIndex))
                    {
                        continue;
                    }
                    candidates.Add(planet);
                }

                if (candidates.Count > 0)
                {
                    Planet target = candidates[Context.QualityRandom.Next(0, candidates.Count)];
                    ArcenDebugging.ArcenDebugLogSingleLine("Dooming " + target.Name, Verbosity.DoNotShow);
                    doomedPlanetIndices.Add(target.PlanetIndex);
                }
            }

            if (doomedPlanetIndices.Count > 0)
            {
                if (doomDataPrimitives.SecondsUntilNextDoomAttack == 0)
                {
                    doomDataPrimitives.SecondsUntilNextDoomAttack = 11;
                }
                doomDataPrimitives.SecondsUntilNextDoomAttack--;

                if (doomDataPrimitives.SecondsUntilNextDoomAttack <= 0)
                {
                    doomDataPrimitives.SecondsUntilNextDoomAttack = 6;

                    int    targetIndex = doomedPlanetIndices[Context.QualityRandom.Next(0, doomedPlanetIndices.Count)];
                    Planet target      = World_AIW2.Instance.GetPlanetByIndex(targetIndex);

                    // cause some entities to spawn on the target planet, or elsewhere and have them travel to the target, etc
                    ArcenDebugging.ArcenDebugLogSingleLine("Doom attack against " + target.Name, Verbosity.DoNotShow);

                    doomDataPrimitives.LastDoomAttackLaunchedAgainstPlayer = target.GetControllingSide().Type == WorldSideType.Player;
                }
            }
        }
            public void UpdateImages(ArcenUIWrapperedUnityImage Image, ArcenUI_Image.SubImage[] SubImages)
            {
                if (this.EntityGroup == null)
                {
                    return;
                }

                int debugStage = -1;

                try
                {
                    debugStage = 0;
                    int cnt = this.EntityGroup.EntityCount;
                    if (cnt > 0 && cnt < Window_InGameOutlineSidebar.Sprite_Backgrounds.Length)
                    {
                        Image.UpdateWith(Window_InGameOutlineSidebar.Sprite_Backgrounds[cnt]);
                    }

                    debugStage = 1;
                    GameEntityTypeData typeData = this.EntityGroup.TypeData;

                    debugStage = 2;

                    switch (this.EntityGroup.Side)
                    {
                    case EntityGroupSideType.Mine:
                        SubImages[INDEX_ICON].WrapperedImage.UpdateWith(typeData.GUISprite_Icon_Mine);
                        break;

                    case EntityGroupSideType.Allied:
                        SubImages[INDEX_ICON].WrapperedImage.UpdateWith(typeData.GUISprite_Icon_Allied);
                        break;

                    default:
                        SubImages[INDEX_ICON].WrapperedImage.UpdateWith(typeData.GUISprite_Icon_Enemy);
                        break;
                    }
                    debugStage = 3;
                    SubImages[INDEX_ICON_BORDER].WrapperedImage.UpdateWith(typeData.GUISprite_IconBorder);
                    debugStage = 4;
                    SubImages[INDEX_FLAIR].WrapperedImage.UpdateWith(typeData.GUISprite_Flair);

                    debugStage = 5;

                    bool reloading = false;
                    bool underFire = false;
                    bool shielded  = false;
                    bool cloaked   = false;

                    List <GameEntity> entities = this.EntityGroup.ActualEntities;
                    GameEntity        entity;
                    for (int i = 0; i < entities.Count; i++)
                    {
                        debugStage = 6;

                        entity = entities[i];
                        if (entity.HasBeenRemovedFromSim)
                        {
                            continue;
                        }

                        debugStage = 7;

                        if (!reloading)
                        {
                            for (int j = 0; j < entity.Systems.Count; j++)
                            {
                                debugStage = 5;
                                EntitySystem system = entity.Systems[j];
                                debugStage = 6;
                                if (system.TimeUntilNextShot <= 0)
                                {
                                    continue;
                                }
                                reloading = true;
                                break;
                            }
                        }
                        debugStage = 8;
                        if (!underFire)
                        {
                            underFire = entity.RepairDelaySeconds > 0;
                        }
                        debugStage = 9;
                        if (!shielded)
                        {
                            shielded = entity.ProtectingShieldIDs.Count > 0 || entity.GetCurrentShieldPoints() > 0;
                        }
                        debugStage = 10;
                        if (!cloaked)
                        {
                            cloaked = entity.GetCurrentCloakingPoints() > 0;
                        }
                    }
                    debugStage = 11;
                    SubImages[INDEX_CLOAKED].WrapperedImage.UpdateToShowOrHide(cloaked ? ArcenUIWrapperedUnityImage.ShowOrHideStatus.Show :
                                                                               ArcenUIWrapperedUnityImage.ShowOrHideStatus.Hide);
                    debugStage = 12;
                    SubImages[INDEX_RELOADING].WrapperedImage.UpdateToShowOrHide(reloading ? ArcenUIWrapperedUnityImage.ShowOrHideStatus.Show :
                                                                                 ArcenUIWrapperedUnityImage.ShowOrHideStatus.Hide);
                    debugStage = 13;
                    SubImages[INDEX_SHIELDED].WrapperedImage.UpdateToShowOrHide(shielded ? ArcenUIWrapperedUnityImage.ShowOrHideStatus.Show :
                                                                                ArcenUIWrapperedUnityImage.ShowOrHideStatus.Hide);
                    debugStage = 14;
                    SubImages[INDEX_UNDER_FIRE].WrapperedImage.UpdateToShowOrHide(underFire ? ArcenUIWrapperedUnityImage.ShowOrHideStatus.Show :
                                                                                  ArcenUIWrapperedUnityImage.ShowOrHideStatus.Hide);

                    debugStage = 15;

                    int markLevel = typeData.Balance_MarkLevel.Ordinal;
                    if (markLevel < 0 || markLevel > 5)
                    {
                        markLevel = 0;
                    }
                    switch (typeData.SpecialType)
                    {
                    case SpecialEntityType.AIKingUnit:
                    case SpecialEntityType.HumanKingUnit:
                        markLevel = 0;
                        break;
                    }
                    SubImages[INDEX_MARK_LEVEL].WrapperedImage.UpdateWith(markLevel <= 0 ? null :
                                                                          Window_InGameOutlineSidebar.Sprite_MarkLevels[markLevel]);
                }
                catch (Exception e)
                {
                    ArcenDebugging.ArcenDebugLog("Exception in WriteRawDrawInstructions at stage " + debugStage + ":" + e.ToString(), Verbosity.ShowAsError);
                }
            }
Example #9
0
        public static void HandleInner(Int32 Int1, string InputActionInternalName)
        {
            if (ArcenUI.CurrentlyShownWindowsWith_PreventsNormalInputHandlers.Count > 0)
            {
                return;
            }

            switch (InputActionInternalName)
            {
            case "Debug_ToggleConsole":
                ArcenUI.Instance.ShowingConsole = !ArcenUI.Instance.ShowingConsole;
                ArcenUI.Instance.UnitermConsoleCanvasObject.SetActive(ArcenUI.Instance.ShowingConsole);
                if (ArcenUI.Instance.ShowingConsole)
                {
                    ArcenUI.Instance.UnitermTextbox.ActivateInputField();
                }
                break;

            case "Debug_ConsoleAutocomplete":
                if (ArcenUI.Instance.ShowingConsole)
                {
                    Engine_AIW2.Instance.FrontEnd.Uniterm_AcceptAutocomplete();
                }
                break;
            }

            if (ArcenUI.Instance.ShowingConsole)
            {
                return;
            }

            switch (InputActionInternalName)
            {
            case "Debug_StartTestChamber":
            {
                Engine_AIW2.Instance.QuitGameAndGoBackToMainMenu();
                TestChamberTable.Instance.Initialize(true);
                GameSettings_AIW2.Current.LastSetup.MapType = MapTypeDataTable.Instance.GetRowByName("TestChamber", false, null);
                Engine_AIW2.Instance.InnerDoStartNewWorldOKLogic();
                while (Engine_Universal.WorkThreadIsRunning)
                {
                    Thread.Sleep(10);
                }
                GameCommand command = GameCommand.Create(GameCommandType.TogglePause);
                World_AIW2.Instance.QueueGameCommand(command, true);
            }
            break;

            case "Debug_InstantStopSim":
                Engine_Universal.DebugTimeMode = DebugTimeMode.StopSim;
                break;

            case "Debug_InstantStopSimAndVisualUpdates":
                Engine_Universal.DebugTimeMode = DebugTimeMode.StopSimAndVisualUpdates;
                break;

            case "Debug_ResumeFromInstantStop":
                Engine_Universal.DebugTimeMode = DebugTimeMode.Normal;
                break;

            case "Debug_RunExactlyNMoreSimSteps":
                Engine_Universal.DebugSimStepsToRun = 1;
                Engine_Universal.DebugTimeMode      = DebugTimeMode.Normal;
                break;

            case "Debug_RunNMoreVisualUpdateSeconds":
                Engine_Universal.DebugVisualUpdateSecondsToRun = GameSettings.Current.DebugVisualUpdateSecondsIntervalLength;
                switch (Engine_Universal.DebugTimeMode)
                {
                case DebugTimeMode.StopSimAndVisualUpdates:
                    Engine_Universal.DebugTimeMode = DebugTimeMode.StopSim;
                    break;
                }
                break;

            case "Debug_BarfSquadData":
            {
                if (!World_AIW2.Instance.IsPaused)
                {
                    GameCommand command = GameCommand.Create(GameCommandType.TogglePause);
                    World_AIW2.Instance.QueueGameCommand(command, true);
                }
                ArcenCharacterBuffer buffer = new ArcenCharacterBuffer();
                int count = 0;
                Engine_AIW2.Instance.DoForSelected(SelectionCommandScope.CurrentPlanet_UnlessViewingGalaxy, delegate(GameEntity selected)
                    {
                        count++;
                        selected.VisualObj.WriteDebugDataTo(buffer);
                        return(DelReturn.Continue);
                    });
                ArcenDebugging.ArcenDebugLogSingleLine("Squad Data Dump from " + count + " entities:" + buffer.ToString(), Verbosity.DoNotShow);
            }
            break;
            }
        }
 public void RunInitialSetup()
 {
     ArcenInput.PreInput = new PreInputHandler();
     ArcenDebugging.ArcenDebugLogSingleLine("RunInitialSetup for AIWarExternalCode.", Verbosity.DoNotShow);
 }
        public override void UpdateContent(ArcenUIWrapperedUnityImage Image, ArcenUI_Image.SubImageGroup SubImages, SubTextGroup SubTexts)
        {
            GameEntityTypeData typeData = this.TypeToBuild;

            if (typeData == null)
            {
                return;
            }

            WorldSide  localSide       = World_AIW2.Instance.GetLocalPlayerSide();
            Planet     planet          = Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed();
            CombatSide localCombatSide = planet.Combat.GetSideForWorldSide(localSide);

            int debugStage = -1;

            try
            {
                debugStage = 1;

                debugStage = 2;
                SubImages[INDEX_ICON_NO_FLAIR].WrapperedImage.UpdateWith(null, true);
                SubImages[INDEX_ICON_FLAIR_ONLY].WrapperedImage.UpdateWith(typeData.GUISprite_Icon_White, true);

                // uncomment if you want a crazy experiment with icons varying in size over time
                //float size = ( World_AIW2.Instance.GameSecond * 10 ) % 100;
                //if ( size < 1 )
                //    size = 1;
                //SubImages[INDEX_ICON_FLAIR_ONLY].WrapperedImage.SetSize( size, size / 2 );

                // uncomment if you want to try vertically centering non-flair icons instead of leaving the gap at the bottom
                //if ( typeData.GUISprite_Flair == null )
                //    SubImages[INDEX_ICON_FLAIR_ONLY].WrapperedImage.SetOffset( 0, 5 );

                debugStage = 4;
                SubImages[INDEX_FLAIR].WrapperedImage.UpdateWith(typeData.GUISprite_Flair, true);

                debugStage = 5;
                bool showFuel = typeData.BalanceStats.SquadFuelConsumption > 0 && localSide.NetFuel < typeData.BalanceStats.SquadFuelConsumption;
                SubImages[INDEX_FUEL].WrapperedImage.UpdateToShowOrHide(showFuel);

                debugStage = 6;
                bool showPower = typeData.BalanceStats.SquadPowerConsumption > 0 && localCombatSide.NetPower < typeData.BalanceStats.SquadPowerConsumption;
                SubImages[INDEX_POWER].WrapperedImage.UpdateToShowOrHide(showPower);

                debugStage = 7;
                bool showScience  = false;
                bool showLocked   = false;
                bool showUnlocked = false;

                if (this.ButtonMode == Mode.Tech)
                {
                    if (typeData.TechPrereq == null)
                    {
                        // shouldn't really be on the tech menu anyway
                    }
                    else
                    {
                        if (localSide.GetHasResearched(typeData.TechPrereq))
                        {
                            showUnlocked = true;
                        }
                        else if (localSide.GetCanResearch(typeData.TechPrereq, true, false) != ArcenRejectionReason.Unknown)
                        {
                            showLocked = true;
                        }
                        else if (localSide.GetCanResearch(typeData.TechPrereq, false, false) != ArcenRejectionReason.Unknown)
                        {
                            showScience = true;
                        }
                    }
                }

                SubImages[INDEX_SCIENCE].WrapperedImage.UpdateToShowOrHide(showScience);

                //uncomment if you want a crazy experiemnt replacing this icon with a fuel icon
                //SubImages[INDEX_SCIENCE].WrapperedImage.SetBundleAndPathInBundle( "arcenui", "assets/icons/officialgui/resources/fuel.png" );

                SubImages[INDEX_LOCKED].WrapperedImage.UpdateToShowOrHide(showLocked);
                Image.SetColor(showLocked ? ColorMath.LightGray : ColorMath.White);
                SubImages[INDEX_UNLOCKED].WrapperedImage.UpdateToShowOrHide(showUnlocked);

                debugStage = 8;
                bool showActiveKeyboardColumnIndicator = false;
                if (this.ButtonMode == Mode.Build)
                {
                    showActiveKeyboardColumnIndicator = this.ColumnIndex == Window_InGameBuildTypeIconMenu.Instance.CurrentTypeIndex;
                }
                else if (this.ButtonMode == Mode.Tech)
                {
                    showActiveKeyboardColumnIndicator = this.ColumnIndex == Window_InGameTechTypeIconMenu.Instance.CurrentTypeIndex;
                }
                SubImages[INDEX_ACTIVE_KEYBOARD_COLUMN].WrapperedImage.UpdateToShowOrHide(showActiveKeyboardColumnIndicator);

                debugStage = 15;
                int markLevel = typeData.Balance_MarkLevel.Ordinal;
                if (markLevel < 0 || markLevel > 5)
                {
                    markLevel = 0;
                }
                SubImages[INDEX_MARK_LEVEL].WrapperedImage.UpdateWith(markLevel <= 0 ? null : Window_InGameOutlineSidebar.Sprite_MarkLevels[markLevel], true);
            }
            catch (Exception e)
            {
                ArcenDebugging.ArcenDebugLog("Exception in UpdateContent (image) at stage " + debugStage + ":" + e.ToString(), Verbosity.ShowAsError);
            }

            debugStage = -1;
            try
            {
                debugStage = 1;
                ArcenUIWrapperedTMProText text = SubTexts[TEXT_INDEX_UPPER_LEFT].Text;

                debugStage = 2;
                ArcenDoubleCharacterBuffer buffer = text.StartWritingToBuffer();

                if (typeData != null)
                {
                    switch (this.ButtonMode)
                    {
                    case Mode.Build:
                    case Mode.Queue:
                        if (planet != null)
                        {
                            int remainingCap = localCombatSide.GetRemainingCap(typeData);

                            text.SetFontSize(12);
                            buffer.Add(remainingCap);

                            if (remainingCap <= 0)
                            {
                                text.SetColor(ColorMath.LightRed);
                            }
                            else
                            {
                                text.SetColor(ColorMath.White);
                            }
                        }
                        break;

                    case Mode.Tech:
                        if (typeData.TechPrereq == null)
                        {
                            break;
                        }
                        if (localSide.GetHasResearched(typeData.TechPrereq))
                        {
                            break;
                        }
                        int cost = typeData.TechPrereq.ScienceCost;
                        buffer.Add(cost);
                        if (cost > localSide.StoredScience)
                        {
                            text.SetColor(ColorMath.LightRed);
                        }
                        else
                        {
                            text.SetColor(ColorMath.White);
                        }
                        break;
                    }
                }

                text.FinishWritingToBuffer();

                debugStage = 3;
                text       = SubTexts[TEXT_INDEX_ABOVE_BUTTON].Text;

                debugStage = 4;
                buffer     = text.StartWritingToBuffer();

                if (this.ButtonMode == Mode.Queue)
                {
                    GameEntity builder = null;
                    Engine_AIW2.Instance.DoForSelected(SelectionCommandScope.CurrentPlanet_UnlessViewingGalaxy, delegate(GameEntity selected)
                    {
                        if (selected.TypeData != this.TypeDoingTheBuilding)
                        {
                            return(DelReturn.Continue);
                        }
                        if (builder != null)
                        {
                            // only show time display when there's only one builder, otherwise it's not clear what should be shown
                            builder = null;
                            return(DelReturn.Break);
                        }
                        builder = selected;
                        return(DelReturn.Continue);
                    });
                    debugStage = 5;
                    if (builder != null && builder.BuildQueue != null)
                    {
                        BuildQueueItem item = builder.BuildQueue.GetQueueItemFor(typeData);
                        if (item != null)
                        {
                            bool showTimer = item.MetalSpentOnCurrentIteration > 0 && item.NumberBuiltThisLoop < item.NumberToBuildEachLoop;
                            if (showTimer)
                            {
                                FInt metalLeft = typeData.BalanceStats.SquadMetalCost - item.MetalSpentOnCurrentIteration;
                                FInt metalRate = builder.TypeData.MetalFlows[MetalFlowPurpose.BuildingShipsInternally].EffectiveThroughput;
                                if (metalLeft > 0 && metalRate > 0)
                                {
                                    FInt secondsLeft = metalLeft / metalRate;
                                    buffer.Add(Engine_Universal.ToHoursAndMinutesString(secondsLeft.IntValue));
                                }
                            }
                        }
                    }
                }

                debugStage = 6;
                text.FinishWritingToBuffer();
            }
            catch (Exception e)
            {
                ArcenDebugging.ArcenDebugLog("Exception in UpdateContent (text) at stage " + debugStage + ":" + e.ToString(), Verbosity.ShowAsError);
            }
        }
            public override void UpdateContent(ArcenUIWrapperedUnityImage Image, ArcenUI_Image.SubImageGroup _SubImages, SubTextGroup _SubTexts)
            {
                this.SubImages = _SubImages;
                this.SubTexts  = _SubTexts;
                GameEntityTypeData typeData = this.TypeToBuild;

                if (typeData == null)
                {
                    return;
                }

                WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide();

                //Planet planet = Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed();
                //CombatSide localCombatSide = planet.Combat.GetSideForWorldSide( localSide );

                if (GameEntity.CurrentlyHoveredOver != null)
                {
                    this.PanelMode = Mode.ActualUnit;
                }
                else if (Window_InGameTechTabMenu.Instance.IsOpen)
                {
                    this.PanelMode = Mode.Tech;
                }
                else if (Window_InGameBuildTabMenu.Instance.IsOpen)
                {
                    this.PanelMode = Mode.Build;
                }

                TextId.SubjectSummary.Set(typeData.Name, string.Empty);

                try
                {
                    int markLevel = typeData.Balance_MarkLevel == null ? 0 : typeData.Balance_MarkLevel.Ordinal;
                    if (markLevel <= 0)
                    {
                        ImageId.MarkLevel.Hide();
                    }
                    else
                    {
                        ImageId.MarkLevel.Set(Window_InGameOutlineSidebar.Sprite_MarkLevels[markLevel], string.Empty);
                    }

                    if (this.PanelMode == Mode.Tech && typeData.TechPrereq != null)
                    {
                        bool unlocked = localSide.GetHasResearched(typeData.TechPrereq);
                        ImageId.Locked.ChangeVisibility(!unlocked);
                        ImageId.Unlocked.ChangeVisibility(unlocked);
                        ImageId.Science.Show();
                        TextId.Science.Set(typeData.TechPrereq.ScienceCost, string.Empty);
                    }
                    else
                    {
                        ImageId.Locked.Hide();
                        ImageId.Unlocked.Hide();
                        ImageId.Science.Hide();
                        TextId.Science.Hide();
                    }

                    if (typeData.BalanceStats.SquadFuelConsumption > 0)
                    {
                        ImageId.Fuel.Show();
                        ImageId.Power.Hide();
                        TextId.FuelOrPower.Set(typeData.BalanceStats.SquadFuelConsumption, string.Empty);
                    }
                    else if (typeData.BalanceStats.SquadPowerConsumption > 0)
                    {
                        ImageId.Fuel.Hide();
                        ImageId.Power.Show();
                        TextId.FuelOrPower.Set(typeData.BalanceStats.SquadPowerConsumption, string.Empty);
                    }
                    else
                    {
                        ImageId.Fuel.Hide();
                        ImageId.Power.Hide();
                        TextId.FuelOrPower.Hide();
                    }

                    if (typeData.BalanceStats.SquadMetalCost > 0)
                    {
                        ImageId.Metal.Show();
                        TextId.Metal.Set(typeData.BalanceStats.SquadMetalCost, string.Empty);
                    }
                    else
                    {
                        ImageId.Metal.Hide();
                        TextId.Metal.Hide();
                    }

                    int cap = typeData.BalanceStats.SquadsPerCap;
                    if (cap <= 0)
                    {
                        ImageId.Cap.Hide();
                        TextId.Cap.Hide();
                    }
                    else
                    {
                        ImageId.Cap.Show();
                        TextId.Cap.Set(cap, string.Empty);
                    }

                    ImageId.Strength.Show();
                    TextId.Strength.Set(typeData.BalanceStats.StrengthPerSquad.IntValue, string.Empty);

                    SystemEntry.SubEntry mainOffensiveWeaponSystemSubEntry = null;
                    EntitySystemTypeData cloakSystem   = null;
                    EntitySystemTypeData tachyonSystem = null;
                    EntitySystemTypeData tractorSystem = null;
                    EntitySystemTypeData gravitySystem = null;
                    for (int i = 0; i < typeData.SystemEntries.Count; i++)
                    {
                        SystemEntry entry = typeData.SystemEntries[i];
                        if (entry.SubEntries.Count <= 0)
                        {
                            continue;
                        }
                        SystemEntry.SubEntry subEntry = entry.SubEntries[0];
                        if (mainOffensiveWeaponSystemSubEntry == null && subEntry.GetDPS() > 0)
                        {
                            mainOffensiveWeaponSystemSubEntry = subEntry;
                        }
                        EntitySystemTypeData systemData = subEntry.SystemData;
                        if (cloakSystem == null && subEntry.BalanceStats.SquadCloakingPoints > 0)
                        {
                            cloakSystem = systemData;
                        }
                        if (tachyonSystem == null && subEntry.BalanceStats.TachyonPoints > 0)
                        {
                            tachyonSystem = systemData;
                        }
                        if (tractorSystem == null && subEntry.BalanceStats.TractorPoints > 0)
                        {
                            tractorSystem = systemData;
                        }
                        if (gravitySystem == null && subEntry.BalanceStats.GravityPoints > 0)
                        {
                            gravitySystem = systemData;
                        }
                    }

                    if (mainOffensiveWeaponSystemSubEntry != null)
                    {
                        SystemEntry.SubEntry systemSubEntry = mainOffensiveWeaponSystemSubEntry;
                        EntitySystemTypeData systemData     = systemSubEntry.SystemData;
                        Balance_WeaponType   weaponData     = systemData.Balance_WeaponType;

                        ImageId.Attack.Set(systemData.Balance_WeaponType.CounterType);
                        TextId.Attack.Set(systemSubEntry.GetDPS().IntValue, systemData.Balance_WeaponType.CounterType.StatTooltip);
                        ImageId.Range.Set(weaponData.Range);
                        ImageId.EngineDamage.Set(weaponData.Balance_EngineDamageType);
                        ImageId.Paralysis.Set(weaponData.Balance_ParalysisClass);
                        ImageId.Ion.Set(weaponData.Balance_IonClass);
                        ImageId.Implosion.Set(weaponData.Balance_ImplosionClass);
                        ImageId.Nuclear.Set(systemData.Balance_NuclearClass);
                    }
                    else
                    {
                        ImageId.Attack.Hide();
                        TextId.Attack.Hide();
                        ImageId.Range.Hide();
                        ImageId.EngineDamage.Hide();
                        ImageId.Paralysis.Hide();
                        ImageId.Ion.Hide();
                        ImageId.Implosion.Hide();
                        ImageId.Nuclear.Hide();
                    }

                    ImageId.Defense.Set(typeData.Balance_Defense);

                    int        totalMaxHP = (typeData.BalanceStats.HullPoints + typeData.BalanceStats.ShieldPoints) * typeData.Balance_ShipsPerSquad;
                    GameEntity entity     = GameEntity.CurrentlyHoveredOver;
                    if (this.PanelMode == Mode.ActualUnit && entity != null && (entity.HullPointsLost > 0 || entity.ShieldPointsLost > 0 || entity.SquadShipsLost > 0 || entity.SelfBuildingMetalRemaining > 0))
                    {
                        float percent;
                        if (entity.SelfBuildingMetalRemaining <= 0)
                        {
                            int totalCurrentHP = (typeData.BalanceStats.HullPoints + typeData.BalanceStats.ShieldPoints) * (typeData.Balance_ShipsPerSquad - 1);
                            totalCurrentHP += (entity.GetCurrentHullPoints() + entity.GetCurrentShieldPoints());
                            percent         = ((float)totalCurrentHP / (float)totalMaxHP) * 100;
                        }
                        else
                        {
                            percent = (1f - ((float)entity.SelfBuildingMetalRemaining / (float)typeData.BalanceStats.SquadMetalCost)) * 100;
                        }
                        string percentMask;
                        if (entity.SelfBuildingMetalRemaining > 0 || entity.HasNotYetBeenFullyClaimed)
                        {
                            percentMask = "#,##0.0";
                        }
                        else
                        {
                            percentMask = "#,##0";
                        }
                        int    totalHPForDisplay        = totalMaxHP;
                        string suffix                   = ArcenExternalUIUtilities.GetRoundedNumberWithSuffix(ref totalHPForDisplay, true);
                        ArcenCharacterBuffer textBuffer = new ArcenCharacterBuffer();
                        textBuffer.Add(totalHPForDisplay.ToString("#,##0"));
                        textBuffer.Add(suffix);
                        textBuffer.Add(" (");
                        textBuffer.Add(percent.ToString(percentMask));
                        textBuffer.Add("%)");
                        string text = textBuffer.ToString();
                        TextId.Defense.Set(text, typeData.Balance_Defense.StatTooltip);
                    }
                    else
                    {
                        TextId.Defense.Set(totalMaxHP, typeData.Balance_Defense.StatTooltip);
                    }

                    ImageId.Speed.Set(typeData.Balance_Speed);
                    ImageId.EngineDamageResistance.Set(typeData.Balance_EngineHealthType);
                    ImageId.ParalysisResistance.Set(typeData.Balance_ParalysisResistance);
                    ImageId.IonResistance.Set(typeData.Balance_IonResistance);
                    ImageId.ImplosionResistance.Set(typeData.Balance_ImplosionResistance);
                    ImageId.NuclearResistance.Set(typeData.Balance_NuclearResistance);

                    ImageId.Cloak.Set(cloakSystem == null ? null : cloakSystem.Balance_CloakingType);
                    ImageId.Tachyon.Set(tachyonSystem == null ? null : tachyonSystem.Balance_TachyonType);
                    ImageId.Tractor.Set(tractorSystem == null ? null : tractorSystem.Balance_TractorType);
                    ImageId.TractorResistance.Set(typeData.Balance_TractorResistanceType);
                    ImageId.Gravity.Set(gravitySystem == null ? null : gravitySystem.Balance_GravityType);
                    ImageId.GravityResistance.Set(typeData.Balance_GravityResistanceType);

                    TextId.Description.Set(typeData.Description, string.Empty);
                }
                catch (Exception e)
                {
                    ArcenDebugging.ArcenDebugLog("Exception in UpdateContent after " + (LastWrittenWasImageInsteadOfText ? "image " + LastImageIDWritten : "text " + LastTextIDWritten) + ":" + e.ToString(), Verbosity.ShowAsError);
                }
            }
            public override void OnUpdate()
            {
                if (!Instance.NeedsUpdate)
                {
                    return;
                }
                Instance.NeedsUpdate = false;
                bool debug = false;

                if (debug)
                {
                    ArcenDebugging.ArcenDebugLogSingleLine("Reading directory to generate buttons", Verbosity.DoNotShow);
                }
                ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element;

                elementAsType.ClearButtons();

                Dictionary <string, List <SaveGameData> > gameDict = SaveLoadMethods.parseOnDiskSaveGames();

                foreach (KeyValuePair <string, List <SaveGameData> > entry in gameDict)
                {
                    //Don't show any saves from other campaigns
                    if (entry.Key != Window_SaveGameMenu.Instance.OverallCampaignName || Window_SaveGameMenu.Instance.OverallCampaignName == "")
                    {
                        continue;
                    }
                    if (debug)
                    {
                        ArcenDebugging.ArcenDebugLogSingleLine("Parsing list from  " + entry.Key, Verbosity.DoNotShow);
                    }

                    List <SaveGameData> list = entry.Value;
                    //Sort the found saved games by elapsed in game time
                    list.Sort(delegate(SaveGameData x, SaveGameData y)
                    {
                        return(-x.secondsSinceGameStart.CompareTo(y.secondsSinceGameStart));
                    });

                    //Allow for multiple columns
                    int maxHeightPerColumn = 80;
                    int gamesPerColumn     = (int)maxHeightPerColumn / (int)elementAsType.ButtonHeight;
                    int distBetweenColumns = 5;

                    //This section here adds a big button at the top
                    //to display information about the campaign
                    Vector2 offset;
                    offset.y = 0;
                    offset.x = 40;
                    string output = getCampaignLabel(list[0]);
                    AddHeaderButton(elementAsType, output, offset);

                    int offsetForHeader = (int)elementAsType.ButtonHeight + 5;
                    //Now print the found saved games underneath the header
                    for (int k = 0; k < list.Count; k++)
                    {
                        offset.y = (k % gamesPerColumn) * elementAsType.ButtonHeight + offsetForHeader;
                        offset.x = (k / gamesPerColumn) * elementAsType.ButtonWidth + distBetweenColumns * (k / gamesPerColumn);
                        AddSaveButton(elementAsType, list[k], offset);
                    }
                }
                elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared();
            }
        public SaveGameData(string fullSaveName, DateTime dt)
        {
            //This is for a save file name (ie it has metadata encoded in it). Parse it and populate the struct
            debug         = false;
            metadataStart = '~';
            metadataDelim = '#';


            mapType               = "Unknown";
            mapTypeShort          = "UK";
            seed                  = -1;
            secondsSinceGameStart = -1;
            campaignName          = "Unknown";
            masterAIType          = "";
            difficulty            = "";
            this.lastModified     = dt;
            string[] splitNameAndMeta = fullSaveName.Split(metadataStart);
            this.saveName = splitNameAndMeta[0];
            if (splitNameAndMeta.Length > 1)
            {
                //if there is metadata, parse it now
                string[] tokens = (splitNameAndMeta[1]).Split(metadataDelim);
                if (debug)
                {
                    string s = "numTokens: " + tokens.Length + " --> " + splitNameAndMeta[1];
                    ArcenDebugging.ArcenDebugLogSingleLine(s, Verbosity.DoNotShow);
                }
                for (int i = 0; i < tokens.Length; i++)
                {
                    if (debug)
                    {
                        string s;
                        s = i + " :: " + tokens[i];
                        ArcenDebugging.ArcenDebugLogSingleLine(s, Verbosity.DoNotShow);
                    }
                    //the first token should be a ~, which marks the end of the save name
                    //if that doesn't exist,
                    switch (i)
                    {
                    case 0:
                        break;

                    case 1:
                        this.setFullMapType(tokens[i]);
                        break;

                    case 2:
                        this.seed = Convert.ToInt32(tokens[i]);
                        break;

                    case 3:
                        this.secondsSinceGameStart = Convert.ToInt32(tokens[i]);
                        break;

                    case 4:
                        this.campaignName = tokens[i];
                        break;

                    case 5:
                        this.masterAIType = tokens[i];
                        break;

                    case 6:
                        this.difficulty = tokens[i];
                        break;

                    default:
                        ArcenDebugging.ArcenDebugLogSingleLine("BUG: too many tokens in SaveGameData constructor; next was " + tokens[i], Verbosity.DoNotShow);
                        break;
                    }
                }
                if (this.campaignName == "")
                {
                    this.campaignName = this.mapType + "." + this.seed; //the # indicates that the campaign type was not set by the user
                }
            }
        }
 public void setShortMapType(string mapType)
 {
     //transforms the full map type name into a
     //shortened version
     this.mapType = mapType;
     if (debug)
     {
         ArcenDebugging.ArcenDebugLogSingleLine("setting short map type based on short  " + mapType, Verbosity.DoNotShow);
     }
     if (mapType == "Clusters")
     {
         mapTypeShort = "CL";
     }
     else if (mapType == "Lattice")
     {
         mapTypeShort = "LT";
     }
     else if (mapType == "Concentric")
     {
         mapTypeShort = "CO";
     }
     else if (mapType == "Snake")
     {
         mapTypeShort = "SP";
     }
     else if (mapType == "X")
     {
         mapTypeShort = "X0";
     }
     else if (mapType == "Grid")
     {
         mapTypeShort = "GR";
     }
     else if (mapType == "Crosshatch")
     {
         mapTypeShort = "CR";
     }
     else if (mapType == "MazeA")
     {
         mapTypeShort = "MA";
     }
     else if (mapType == "MazeB")
     {
         mapTypeShort = "MB";
     }
     else if (mapType == "MazeC")
     {
         mapTypeShort = "MC";
     }
     else if (mapType == "MazeD")
     {
         mapTypeShort = "MD";
     }
     else if (mapType == "ClustersMicrocosm")
     {
         mapTypeShort = "CM";
     }
     else if (mapType == "Wheel")
     {
         mapTypeShort = "WH";
     }
     else if (mapType == "Honeycomb")
     {
         mapTypeShort = "HO";
     }
     else if (mapType == "Encapsulated")
     {
         mapTypeShort = "EN";
     }
     else if (mapType == "Nebula")
     {
         mapTypeShort = "NB";
     }
     else if (mapType == "Geode")
     {
         mapTypeShort = "GE";
     }
     else if (mapType == "Haystack")
     {
         mapTypeShort = "HA";
     }
     else if (mapType == "DreamCatcher")
     {
         mapTypeShort = "DC";
     }
     else if (mapType == "Simple")
     {
         mapTypeShort = "SI";
     }
     else if (mapType == "Constellation")
     {
         mapTypeShort = "CN";
     }
     else if (mapType == "Octopus")
     {
         mapTypeShort = "OC";
     }
     else if (mapType == "ClustersMini")
     {
         mapTypeShort = "CI";
     }
     else if (mapType == "Solar_Systems_Lite")
     {
         mapTypeShort = "SS";
     }
     else
     {
         mapTypeShort = "UK"; //unknown
     }
 }
 public void setFullMapType(string shortMapType)
 {
     //Translates the shortType (what's part of the file name)
     //into the full name
     this.mapTypeShort = shortMapType;
     if (debug)
     {
         ArcenDebugging.ArcenDebugLogSingleLine("setting full map type based on short  " + shortMapType, Verbosity.DoNotShow);
     }
     if (shortMapType == "CL")
     {
         mapType = "Cluster";
     }
     else if (shortMapType == "LT")
     {
         mapType = "Lattice";
     }
     else if (shortMapType == "CO")
     {
         mapType = "Concentric";
     }
     else if (shortMapType == "SP")
     {
         mapType = "Spiral";
     }
     else if (shortMapType == "X0")
     {
         mapType = "X";
     }
     else if (shortMapType == "GR")
     {
         mapType = "Grid";
     }
     else if (shortMapType == "CR")
     {
         mapType = "Crosshatch";
     }
     else if (shortMapType == "MA")
     {
         mapType = "MazeA";
     }
     else if (shortMapType == "MB")
     {
         mapType = "MazeB";
     }
     else if (shortMapType == "MC")
     {
         mapType = "MazeC";
     }
     else if (shortMapType == "MD")
     {
         mapType = "MazeD";
     }
     else if (shortMapType == "CM")
     {
         mapType = "ClustersMicrocosm";
     }
     else if (shortMapType == "WH")
     {
         mapType = "Wheel";
     }
     else if (shortMapType == "HO")
     {
         mapType = "Honeycomb";
     }
     else if (shortMapType == "EN")
     {
         mapType = "Encapsulated";
     }
     else if (shortMapType == "NB")
     {
         mapType = "Nebula";
     }
     else if (shortMapType == "GE")
     {
         mapType = "Geode";
     }
     else if (shortMapType == "HA")
     {
         mapType = "Haystack";
     }
     else if (shortMapType == "DC")
     {
         mapType = "DreamCatcher";
     }
     else if (shortMapType == "SI")
     {
         mapType = "Simple";
     }
     else if (shortMapType == "CN")
     {
         mapType = "Constellation";
     }
     else if (shortMapType == "OC")
     {
         mapType = "Octopus";
     }
     else if (shortMapType == "CI")
     {
         mapType = "ClustersMini";
     }
     else if (shortMapType == "SS")
     {
         mapType = "Solar_Systems_Lite";
     }
     else
     {
         mapType = "Unknown";
     }
 }