Example #1
0
    /// <summary>
    /// Called at creation, earlier than start
    /// </summary>
    void Awake()
    {
        instance = this;
        string savePath = SerializationManager.CreatePath("");

        if (!Directory.Exists(savePath))
        {
            SerializationManager.CreateFolder(savePath);
        }
    }
Example #2
0
    /// <summary>
    /// Create a new campaign with a distinct
    /// </summary>
    public void CreateCampaign()
    {
        const string newName = "NewCampaign";

        //Create hashset of campaign names to check against in order to make incremental campaign names
        HashSet <string> names = new HashSet <string>(GetSavedCampaigns());

        int count = 0;

        //Increment number as long as folder of that name and number already exist
        while (names.Contains(newName + (count > 0 ? count.ToString() : "")))
        {
            count++;
        }

        string folderPath = SerializationManager.CreatePath(newName + (count > 0 ? count.ToString(): ""));

        if (SerializationManager.CreateFolder(folderPath))
        {
            //Reload Campaigns
            ReloadCampaignTabs();
        }
    }