public static bool SetUpToolbars(LoadMode mode) { var mainToolbar = ToolsModifierControl.mainToolbar; if (mainToolbar == null) { Debug.LogError("ExtraTools#SetUpToolbars(): main toolbar is null"); return(false); } var strip = mainToolbar.component as UITabstrip; if (strip == null) { Debug.LogError("ExtraTools#SetUpToolbars(): strip is null"); return(false); } try { if (mode == LoadMode.NewGame || mode == LoadMode.LoadGame || mode == LoadMode.NewGameFromScenario || mode == LoadMode.NewTheme || mode == LoadMode.LoadTheme) { var defaultAtlas = UIView.GetAView().defaultAtlas; if (OptionsWrapper <Options> .Options.resourcesTool) { ToolbarButtonSpawner.SpawnSubEntry(strip, "Resource", "MAPEDITOR_TOOL", null, "ToolbarIcon", true, mainToolbar.m_OptionsBar, mainToolbar.m_DefaultInfoTooltipAtlas); ((UIButton)UIView.FindObjectOfType <ResourcePanel>().Find("Ore")).atlas = defaultAtlas; ((UIButton)UIView.FindObjectOfType <ResourcePanel>().Find("Oil")).atlas = defaultAtlas; ((UIButton)UIView.FindObjectOfType <ResourcePanel>().Find("Fertility")).atlas = defaultAtlas; } if (OptionsWrapper <Options> .Options.waterTool) { ToolbarButtonSpawner.SpawnSubEntry(strip, "Water", "MAPEDITOR_TOOL", null, "ToolbarIcon", true, mainToolbar.m_OptionsBar, mainToolbar.m_DefaultInfoTooltipAtlas); ((UIButton)UIView.FindObjectOfType <WaterPanel>().Find("PlaceWater")).atlas = Util.CreateAtlasFromResources(new List <string> { "WaterPlaceWater" }); ((UIButton)UIView.FindObjectOfType <WaterPanel>().Find("MoveSeaLevel")).atlas = Util.CreateAtlasFromResources(new List <string> { "WaterMoveSeaLevel" }); if (mode == LoadMode.NewTheme || mode == LoadMode.LoadTheme) { ((UIButton)UIView.FindObjectOfType <ThemeEditorMainToolbar>().Find("Water")).atlas = Util.CreateAtlasFromResources(new List <string> { "ToolbarIconWater", "ToolbarIconBase" }); } else { ((UIButton)UIView.FindObjectOfType <GameMainToolbar>().Find("Water")).atlas = Util.CreateAtlasFromResources(new List <string> { "ToolbarIconWater", "ToolbarIconBase" }); } } } if (mode == LoadMode.NewAsset || mode == LoadMode.LoadAsset || mode == LoadMode.NewTheme || mode == LoadMode.LoadTheme) { if (OptionsWrapper <Options> .Options.terrainTool) { ToolbarButtonSpawner.SpawnSubEntry(strip, "Terrain", "MAPEDITOR_TOOL", null, "ToolbarIcon", true, mainToolbar.m_OptionsBar, mainToolbar.m_DefaultInfoTooltipAtlas); ((UIButton)UIView.FindObjectOfType <TerrainPanel>().Find("Shift")).atlas = Util.CreateAtlasFromResources(new List <string> { "TerrainShift" }); ((UIButton)UIView.FindObjectOfType <TerrainPanel>().Find("Slope")).atlas = Util.CreateAtlasFromResources(new List <string> { "TerrainSlope" }); ((UIButton)UIView.FindObjectOfType <TerrainPanel>().Find("Level")).atlas = Util.CreateAtlasFromResources(new List <string> { "TerrainLevel" }); ((UIButton)UIView.FindObjectOfType <TerrainPanel>().Find("Soften")).atlas = Util.CreateAtlasFromResources(new List <string> { "TerrainSoften" }); if (mode == LoadMode.NewTheme || mode == LoadMode.LoadTheme) { ((UIButton)UIView.FindObjectOfType <ThemeEditorMainToolbar>().Find("Terrain")).atlas = Util.CreateAtlasFromResources(new List <string> { "ToolbarIconTerrain", "ToolbarIconBase" }); } else { ((UIButton)UIView.FindObjectOfType <AssetEditorMainToolbar>().Find("Terrain")).atlas = Util.CreateAtlasFromResources(new List <string> { "ToolbarIconTerrain", "ToolbarIconBase" }); } } } if (mode == LoadMode.NewTheme || mode == LoadMode.LoadTheme) { ToolbarButtonSpawner.SpawnSubEntry(strip, "Forest", "MAPEDITOR_TOOL", null, "ToolbarIcon", true, mainToolbar.m_OptionsBar, mainToolbar.m_DefaultInfoTooltipAtlas); } try { Plugins.CreateToolbars(mode); } catch (Exception e) { UnityEngine.Debug.LogException(e); } return(true); } catch (Exception e) { UnityEngine.Debug.LogException(e); } return(false); }