internal static string GetPluginPath(string pluginName) { #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_XBOXONE || UNITY_WINRT_8_1 || UNITY_WSA_10_0 string pluginFileName = pluginName + ".dll"; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX string pluginFileName = pluginName + ".bundle"; #elif UNITY_PS4 string pluginFileName = pluginName + ".prx"; #elif UNITY_ANDROID || UNITY_STANDALONE_LINUX string pluginFileName = "lib" + pluginName + ".so"; #elif UNITY_WEBGL string pluginFileName = pluginName + ".bc"; #endif #if UNITY_EDITOR_WIN && UNITY_EDITOR_64 string pluginFolder = Application.dataPath + "/Plugins/X86_64/"; #elif UNITY_EDITOR_WIN string pluginFolder = Application.dataPath + "/Plugins/X86/"; #elif UNITY_STANDALONE_WIN || UNITY_PS4 || UNITY_XBOXONE || UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX || UNITY_WEBGL string pluginFolder = Application.dataPath + "/Plugins/"; #elif UNITY_STANDALONE_LINUX string pluginFolder = Application.dataPath + ((IntPtr.Size == 8) ? "/Plugins/x86_64/" : "/Plugins/x86/"); #elif UNITY_WSA string pluginFolder = ""; #elif UNITY_ANDROID var dirInfo = new global::System.IO.DirectoryInfo(Application.persistentDataPath); string packageName = dirInfo.Parent.Name; string pluginFolder = "/data/data/" + packageName + "/lib/"; #else string pluginFileName = ""; string pluginFolder = ""; #endif return(pluginFolder + pluginFileName); }
private void CreateButtons() { #if UNITY_STANDALONE var directories = new List <global::System.IO.DirectoryInfo>(); var currentPath = text; var cdir = new global::System.IO.DirectoryInfo(currentPath); directories.Add(cdir); var count = 0; while (count < 30) { try { var dir = global::System.IO.Directory.GetParent(currentPath); if (dir == null) { break; } directories.Add(dir); currentPath = dir.FullName; } catch (Exception) { // Fix: nullreference?? (Directory.GetParent("C:\\")). } count++; } var allowedWidth = Width; float currentWidth = 0; int currentIndex; for (currentIndex = 0; currentIndex < directories.Count; currentIndex++) { var dir = directories[currentIndex]; var estimatedWidth = Font.MeasureStringSimple(dir.Name).Width + 15; currentWidth += estimatedWidth; if (currentWidth >= allowedWidth) { break; } var button = new pathButton(dir.FullName); button.Height = Height - 2; button.Width = (int)estimatedWidth; button.Text = dir.Name; button.Click += (sender, args) => fileDialog.fileRenderer.SetDirectory(button.Path, true); Controls.Add(button); } updateButtons = true; #endif }
internal static void AddStoragePermissions(string identity, global::System.IO.DirectoryInfo di) { object[] args = new object[] { identity, di }; m_privateType.InvokeStatic("AddStoragePermissions", new System.Type[] { typeof(string), typeof(global::System.IO.DirectoryInfo) }, args); }
public static void CopyFoldersAndFiles(global::System.IO.DirectoryInfo source, global::System.IO.DirectoryInfo target) { global::Class43 @class = new global::Class43(); foreach (global::System.IO.DirectoryInfo directoryInfo in source.GetDirectories()) { global::ARC_Studio.Workers.ARC.FileUtils.CopyFoldersAndFiles(directoryInfo, target.CreateSubdirectory(directoryInfo.Name)); } foreach (global::System.IO.FileInfo fileInfo in source.GetFiles()) { @class.method_0(fileInfo.FullName, global::System.IO.Path.Combine(target.FullName, fileInfo.Name)); } }
public WorldLoaderState(DwarfGame Game) : base(Game) { this.ProceedButtonText = "Load"; this.NoItemsText = "No worlds found."; this.InvalidItemText = "This world was saved by an earlier version of DwarfCorp and is not compatible."; this.ValidateItem = (item) => { return(NewOverworldFile.CheckCompatibility(item) ? "" : "Incompatible save file."); }; this.GetItemName = (item) => { return(NewOverworldFile.GetOverworldName(item)); }; this.ItemSource = () => { global::System.IO.DirectoryInfo worldDirectory = global::System.IO.Directory.CreateDirectory(DwarfGame.GetWorldDirectory()); var dirs = worldDirectory.EnumerateDirectories().ToList(); dirs.Sort((a, b) => b.LastWriteTime.CompareTo(a.LastWriteTime)); return(dirs); }; this.ScreenshotSource = (path) => { try { return(AssetManager.LoadUnbuiltTextureFromAbsolutePath(path + global::System.IO.Path.DirectorySeparatorChar + "screenshot.png")); } catch (Exception exception) { Console.Error.WriteLine(exception.ToString()); return(null); } }; this.OnProceedClicked = (path) => { var file = NewOverworldFile.Load(path); GameStateManager.PopState(); var genState = new WorldGeneratorState(Game, file.CreateSettings(), WorldGeneratorState.PanelStates.Launch); GameStateManager.PushState(genState); }; }
public static object stat(string path) { #line 42 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\FileSystem.hx" if (global::System.IO.File.Exists(((string)(path)))) { #line 43 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\FileSystem.hx" global::System.IO.FileInfo fi = new global::System.IO.FileInfo(path); #line 47 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\FileSystem.hx" global::haxe.root.Date tmp = new global::haxe.root.Date(((global::System.DateTime)((fi as global::System.IO.FileSystemInfo).LastAccessTime))); global::haxe.root.Date tmp1 = new global::haxe.root.Date(((global::System.DateTime)((fi as global::System.IO.FileSystemInfo).LastWriteTime))); #line 49 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\FileSystem.hx" global::haxe.root.Date tmp2 = new global::haxe.root.Date(((global::System.DateTime)((fi as global::System.IO.FileSystemInfo).CreationTime))); #line 44 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\FileSystem.hx" { #line 50 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\FileSystem.hx" int __temp_odecl1 = ((int)(fi.Length)); #line 44 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\FileSystem.hx" return(new global::haxe.lang.DynamicObject(new int[] { 262801146, 651890926, 1302870512 }, new object[] { tmp1, tmp, tmp2 }, new int[] { 4995541, 5145602, 5246186, 5841808, 499574632, 1214305123, 1269206179, 1280549057 }, new double[] { ((double)(0)), ((double)(0)), ((double)(0)), ((double)(0)), ((double)(0)), ((double)(0)), ((double)(0)), ((double)(__temp_odecl1)) })); } } else if (global::System.IO.Directory.Exists(((string)(path)))) { #line 58 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\FileSystem.hx" global::System.IO.DirectoryInfo fi1 = new global::System.IO.DirectoryInfo(path); #line 62 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\FileSystem.hx" global::haxe.root.Date tmp3 = new global::haxe.root.Date(((global::System.DateTime)((fi1 as global::System.IO.FileSystemInfo).LastAccessTime))); global::haxe.root.Date tmp4 = new global::haxe.root.Date(((global::System.DateTime)((fi1 as global::System.IO.FileSystemInfo).LastWriteTime))); #line 59 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\FileSystem.hx" { #line 64 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\FileSystem.hx" global::haxe.root.Date __temp_odecl2 = new global::haxe.root.Date(((global::System.DateTime)((fi1 as global::System.IO.FileSystemInfo).CreationTime))); #line 59 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\FileSystem.hx" return(new global::haxe.lang.DynamicObject(new int[] { 262801146, 651890926, 1302870512 }, new object[] { tmp4, tmp3, __temp_odecl2 }, new int[] { 4995541, 5145602, 5246186, 5841808, 499574632, 1214305123, 1269206179, 1280549057 }, new double[] { ((double)(0)), ((double)(0)), ((double)(0)), ((double)(0)), ((double)(0)), ((double)(0)), ((double)(0)), ((double)(0)) })); } } else { #line 73 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\FileSystem.hx" throw global::haxe.lang.HaxeException.wrap(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("Path \'", path), "\' doesn\'t exist")); } }
internal static string GetPluginPath(string pluginName) { #if (UNITY_IOS || UNITY_TVOS || UNITY_PSP2) return ""; #else #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_XBOXONE || UNITY_WINRT_8_1 string pluginFileName = pluginName + ".dll"; #elif UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX string pluginFileName = pluginName + ".bundle"; #elif UNITY_PS4 string pluginFileName = pluginName + ".prx"; #elif UNITY_ANDROID || UNITY_STANDALONE_LINUX string pluginFileName = "lib" + pluginName + ".so"; #endif #if UNITY_EDITOR_WIN && UNITY_EDITOR_64 string pluginFolder = Application.dataPath + "/Plugins/X86_64/"; #elif UNITY_EDITOR_WIN string pluginFolder = Application.dataPath + "/Plugins/X86/"; #elif UNITY_STANDALONE_WIN || UNITY_PS4 || UNITY_XBOXONE || UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX || UNITY_STANDALONE_LINUX string pluginFolder = Application.dataPath + "/Plugins/"; #elif UNITY_WINRT_8_1 string pluginFolder = ""; #elif UNITY_ANDROID var dirInfo = new global::System.IO.DirectoryInfo(Application.persistentDataPath); string packageName = dirInfo.Parent.Name; string pluginFolder = "/data/data/" + packageName + "/lib/"; #else string pluginFolder = ""; #endif return pluginFolder + pluginFileName; #endif }
public static void CopyFoldersAndFiles(string source, string target) { global::System.IO.DirectoryInfo source2 = new global::System.IO.DirectoryInfo(source); global::System.IO.DirectoryInfo target2 = new global::System.IO.DirectoryInfo(target); global::ARC_Studio.Workers.ARC.FileUtils.CopyFoldersAndFiles(source2, target2); }
public override void Construct() { Padding = new Margin(2, 2, 0, 0); AddChild(new Gui.Widget { Text = "Randomize", Border = "border-button", ChangeColorOnHover = true, TextColor = new Vector4(0, 0, 0, 1), Font = "font16", AutoLayout = Gui.AutoLayout.DockTop, OnClick = (sender, args) => { DwarfGame.LogSentryBreadcrumb("WorldGenerator", "User is regenerating the world."); Settings.Seed = MathFunctions.RandInt(Int32.MinValue, Int32.MaxValue); Settings.Name = Overworld.GetRandomWorldName(); RestartGeneration(); } }); AddChild(new Gui.Widget { Text = "Save World", Border = "border-button", ChangeColorOnHover = true, TextColor = new Vector4(0, 0, 0, 1), Font = "font16", AutoLayout = Gui.AutoLayout.DockTop, OnClick = (sender, args) => { DwarfGame.LogSentryBreadcrumb("WorldGenerator", "User is saving the world."); if (Generator.CurrentState != OverworldGenerator.GenerationState.Finished) { Root.ShowTooltip(Root.MousePosition, "Generator is not finished."); } else { global::System.IO.DirectoryInfo worldDirectory = global::System.IO.Directory.CreateDirectory(DwarfGame.GetWorldDirectory() + global::System.IO.Path.DirectorySeparatorChar + Settings.Name); var file = new NewOverworldFile(Game.GraphicsDevice, Settings); file.WriteFile(worldDirectory.FullName); Root.ShowModalPopup(Root.ConstructWidget(new Gui.Widgets.Popup { Text = "File saved." })); } } }); AddChild(new Gui.Widget { Text = "Advanced", Border = "border-button", ChangeColorOnHover = true, TextColor = new Vector4(0, 0, 0, 1), Font = "font16", AutoLayout = Gui.AutoLayout.DockTop, OnClick = (sender, args) => { DwarfGame.LogSentryBreadcrumb("WorldGenerator", "User is modifying advanced settings."); var advancedSettingsEditor = Root.ConstructWidget(new Gui.Widgets.WorldGenerationSettingsDialog { Settings = Settings, OnClose = (s) => { if ((s as Gui.Widgets.WorldGenerationSettingsDialog).Result == Gui.Widgets.WorldGenerationSettingsDialog.DialogResult.Okay) { RestartGeneration(); } } }); Root.ShowModalPopup(advancedSettingsEditor); } }); StartButton = AddChild(new Gui.Widget { Text = "Launch", Border = "border-button", ChangeColorOnHover = true, TextColor = new Vector4(0, 0, 0, 1), Font = "font16", AutoLayout = Gui.AutoLayout.DockBottom, OnClick = (sender, args) => { Settings.Company.Name = NameField.Text; Settings.Company.Motto = MottoField.Text; Settings.InstanceSettings.InitalEmbarkment = new Embarkment(); Settings.PlayerCorporationFunds = 1000; Settings.Natives.FirstOrDefault(n => n.Name == "Player").PrimaryColor = new Color(Settings.Company.LogoBackgroundColor); OnVerified?.Invoke(); } }); AddChild(new Gui.Widget { Text = "Difficulty", AutoLayout = Gui.AutoLayout.DockTop, Font = "font8", TextColor = new Vector4(0, 0, 0, 1) }); var difficultySelectorCombo = AddChild(new Gui.Widgets.ComboBox { AutoLayout = Gui.AutoLayout.DockTop, Items = Library.EnumerateDifficulties().Select(e => e.Name).ToList(), TextColor = new Vector4(0, 0, 0, 1), Font = "font8", OnSelectedIndexChanged = (sender) => { Settings.Difficulty = Library.GetDifficulty((sender as Gui.Widgets.ComboBox).SelectedItem); } }) as Gui.Widgets.ComboBox; AddChild(new Gui.Widget { Text = "Caves", AutoLayout = Gui.AutoLayout.DockTop, Font = "font8", TextColor = new Vector4(0, 0, 0, 1), }); var layerSetting = AddChild(new Gui.Widgets.ComboBox { AutoLayout = AutoLayout.DockTop, Items = new List <string>(new string[] { "Barely any", "Few", "Normal", "Lots", "Way too many" }), Font = "font8", TextColor = new Vector4(0, 0, 0, 1), OnSelectedIndexChanged = (sender) => { switch ((sender as Gui.Widgets.ComboBox).SelectedItem) { case "Barely any": Settings.NumCaveLayers = 2; break; case "Few": Settings.NumCaveLayers = 3; break; case "Normal": Settings.NumCaveLayers = 4; break; case "Lots": Settings.NumCaveLayers = 6; break; case "Way too many": Settings.NumCaveLayers = 9; break; } } }) as Gui.Widgets.ComboBox; AddChild(new Gui.Widget { Text = "Z Levels", AutoLayout = Gui.AutoLayout.DockTop, Font = "font8", TextColor = new Vector4(0, 0, 0, 1), }); var zLevelSetting = AddChild(new Gui.Widgets.ComboBox { AutoLayout = AutoLayout.DockTop, Items = new List <string>(new string[] { "16", "64", "128" }), Font = "font8", TextColor = new Vector4(0, 0, 0, 1), OnSelectedIndexChanged = (sender) => { switch ((sender as Gui.Widgets.ComboBox).SelectedItem) { case "16": Settings.zLevels = 1; break; case "64": Settings.zLevels = 4; break; case "128": Settings.zLevels = 8; break; } } }) as Gui.Widgets.ComboBox; zLevelSetting.SelectedIndex = 1; difficultySelectorCombo.SelectedIndex = difficultySelectorCombo.Items.IndexOf("Normal"); layerSetting.SelectedIndex = layerSetting.Items.IndexOf("Normal"); #region Name AddChild(new Gui.Widget { MinimumSize = new Point(64, 0), Text = "Company Name", Font = "font8", AutoLayout = AutoLayout.DockTop, TextHorizontalAlign = HorizontalAlign.Left, TextVerticalAlign = VerticalAlign.Center }); var nameRow = AddChild(new Widget { MinimumSize = new Point(0, 32), AutoLayout = AutoLayout.DockTop, Padding = new Margin(0, 0, 2, 2) }); nameRow.AddChild(new Gui.Widgets.Button { Text = "?", AutoLayout = AutoLayout.DockRight, Border = "border-button", OnClick = (sender, args) => { var templates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.company); NameField.Text = TextGenerator.GenerateRandom(Datastructures.SelectRandom(templates).ToArray()); } }); NameField = nameRow.AddChild(new Gui.Widgets.EditableTextField { Text = Settings.Company.Name, AutoLayout = AutoLayout.DockFill }) as Gui.Widgets.EditableTextField; #endregion #region Motto AddChild(new Widget { MinimumSize = new Point(64, 0), Text = "Company Motto", Font = "font8", AutoLayout = AutoLayout.DockTop, TextHorizontalAlign = HorizontalAlign.Left, TextVerticalAlign = VerticalAlign.Center }); var mottoRow = AddChild(new Widget { MinimumSize = new Point(0, 32), AutoLayout = AutoLayout.DockTop, Padding = new Margin(0, 0, 2, 2) }); mottoRow.AddChild(new Gui.Widgets.Button { Text = "?", AutoLayout = AutoLayout.DockRight, Border = "border-button", OnClick = (sender, args) => { var templates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.mottos); MottoField.Text = TextGenerator.GenerateRandom(Datastructures.SelectRandom(templates).ToArray()); // Todo: Doesn't automatically invalidate when text changed?? MottoField.Invalidate(); } }); MottoField = mottoRow.AddChild(new Gui.Widgets.EditableTextField { Text = Settings.Company.Motto, AutoLayout = AutoLayout.DockFill }) as Gui.Widgets.EditableTextField; #endregion #region Logo AddChild(new Widget { MinimumSize = new Point(64, 0), Text = "Company Logo", Font = "font8", AutoLayout = AutoLayout.DockTop, TextHorizontalAlign = HorizontalAlign.Left, TextVerticalAlign = VerticalAlign.Center }); var logoRow = AddChild(new Widget { MinimumSize = new Point(0, 64), AutoLayout = AutoLayout.DockTop, Padding = new Margin(0, 0, 2, 2) }); CompanyLogoDisplay = logoRow.AddChild(new Gui.Widgets.CompanyLogo { AutoLayout = AutoLayout.DockLeft, MinimumSize = new Point(64, 64), MaximumSize = new Point(64, 64), CompanyInformation = Settings.Company }) as Gui.Widgets.CompanyLogo; var rightBox = logoRow.AddChild(new Widget { AutoLayout = AutoLayout.DockFill }); var bgBox = rightBox.AddChild(new Widget { AutoLayout = AutoLayout.DockTop, MinimumSize = new Point(32, 32), }); bgBox.AddChild(new Widget { Text = "BG:", AutoLayout = AutoLayout.DockLeft }); bgBox.AddChild(new Widget { Background = Settings.Company.LogoBackground, MinimumSize = new Point(32, 32), MaximumSize = new Point(32, 32), AutoLayout = AutoLayout.DockLeft, OnClick = (sender, args) => { var source = Root.GetTileSheet("company-logo-background") as Gui.TileSheet; var chooser = new Gui.Widgets.GridChooser { ItemSource = Enumerable.Range(0, source.Columns * source.Rows) .Select(i => new Widget { Background = new TileReference("company-logo-background", i) }), OnClose = (s2) => { var gc = s2 as Gui.Widgets.GridChooser; if (gc.DialogResult == Gui.Widgets.GridChooser.Result.OKAY && gc.SelectedItem != null) { sender.Background = gc.SelectedItem.Background; sender.Invalidate(); Settings.Company.LogoBackground = gc.SelectedItem.Background; CompanyLogoDisplay.Invalidate(); } }, PopupDestructionType = PopupDestructionType.DestroyOnOffClick }; Root.ShowModalPopup(chooser); } }); bgBox.AddChild(new Widget { Background = new TileReference("basic", 1), BackgroundColor = Settings.Company.LogoBackgroundColor, MinimumSize = new Point(32, 32), MaximumSize = new Point(32, 32), AutoLayout = AutoLayout.DockLeft, OnClick = (sender, args) => { var chooser = new Gui.Widgets.GridChooser { ItemSize = new Point(16, 16), ItemSpacing = new Point(4, 4), ItemSource = EnumerateDefaultColors() .Select(c => new Widget { Background = new TileReference("basic", 1), BackgroundColor = new Vector4(c.ToVector3(), 1), }), OnClose = (s2) => { var gc = s2 as Gui.Widgets.GridChooser; if (gc.DialogResult == Gui.Widgets.GridChooser.Result.OKAY && gc.SelectedItem != null) { sender.BackgroundColor = gc.SelectedItem.BackgroundColor; sender.Invalidate(); Settings.Company.LogoBackgroundColor = gc.SelectedItem.BackgroundColor; CompanyLogoDisplay.Invalidate(); } }, PopupDestructionType = PopupDestructionType.DestroyOnOffClick }; Root.ShowModalPopup(chooser); } }); var fgBox = rightBox.AddChild(new Widget { AutoLayout = AutoLayout.DockFill, MinimumSize = new Point(32, 32), }); fgBox.AddChild(new Widget { Text = "FG:", AutoLayout = AutoLayout.DockLeft }); fgBox.AddChild(new Widget { Background = Settings.Company.LogoSymbol, MinimumSize = new Point(32, 32), MaximumSize = new Point(32, 32), AutoLayout = AutoLayout.DockLeft, OnClick = (sender, args) => { var source = Root.GetTileSheet("company-logo-symbol") as Gui.TileSheet; var chooser = new Gui.Widgets.GridChooser { ItemSource = Enumerable.Range(0, source.Columns * source.Rows) .Select(i => new Widget { Background = new TileReference("company-logo-symbol", i) }), OnClose = (s2) => { var gc = s2 as Gui.Widgets.GridChooser; if (gc.DialogResult == Gui.Widgets.GridChooser.Result.OKAY && gc.SelectedItem != null) { sender.Background = gc.SelectedItem.Background; sender.Invalidate(); Settings.Company.LogoSymbol = gc.SelectedItem.Background; CompanyLogoDisplay.Invalidate(); } }, PopupDestructionType = PopupDestructionType.DestroyOnOffClick }; Root.ShowModalPopup(chooser); } }); fgBox.AddChild(new Widget { Background = new TileReference("basic", 1), BackgroundColor = Settings.Company.LogoSymbolColor, MinimumSize = new Point(32, 32), MaximumSize = new Point(32, 32), AutoLayout = AutoLayout.DockLeft, OnClick = (sender, args) => { var chooser = new Gui.Widgets.GridChooser { ItemSize = new Point(16, 16), ItemSpacing = new Point(4, 4), ItemSource = EnumerateDefaultColors() .Select(c => new Widget { Background = new TileReference("basic", 1), BackgroundColor = new Vector4(c.ToVector3(), 1), }), OnClose = (s2) => { var gc = s2 as Gui.Widgets.GridChooser; if (gc.DialogResult == Gui.Widgets.GridChooser.Result.OKAY && gc.SelectedItem != null) { sender.BackgroundColor = gc.SelectedItem.BackgroundColor; sender.Invalidate(); Settings.Company.LogoSymbolColor = gc.SelectedItem.BackgroundColor; CompanyLogoDisplay.Invalidate(); } }, PopupDestructionType = PopupDestructionType.DestroyOnOffClick }; Root.ShowModalPopup(chooser); } }); #endregion base.Construct(); }