Exemplo n.º 1
0
        private void Awake()
        {
            m_minSize = new Vector2(100f, 100f);
            Internal  = new InternalSettings(this);

            iconHolder.preserveAspect = true;
        }
Exemplo n.º 2
0
        private void Awake()
        {
            RectTransform = (RectTransform)transform;
            UnityCanvas   = GetComponentInParent <Canvas>();
#if !UNITY_EDITOR
            Internal = new InternalSettings(this);
#endif

            UnanchoredPanelGroup = new UnanchoredPanelGroup(this);
            RectTransform.ChangePivotWithoutAffectingPosition(new Vector2(0.5f, 0.5f));

            if (!GetComponent <RectMask2D>())
            {
                gameObject.AddComponent <RectMask2D>();
            }

            Size = RectTransform.rect.size;

            InitializeRootGroup();
            InitializeAnchorZones();

            background = GetComponent <Graphic>();
            if (!background)
            {
                background = gameObject.AddComponent <NonDrawingGraphic>();
                background.raycastTarget = false;
            }

            PanelManager.Instance.RegisterCanvas(this);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Attempts to load the session corresponding to the given path.
        /// </summary>
        /// <param name="filePath">The path to a solution or package file.</param>
        /// <returns><c>True</c> if the session was successfully loaded, <c>False</c> if an error occurred, <c>Null</c> if the operation was cancelled by user.</returns>
        public async Task <bool?> OpenSession(UFile filePath)
        {
            if (Session != null)
            {
                throw new InvalidOperationException("A session is already open in this instance.");
            }

            if (filePath != null && !File.Exists(filePath))
            {
                MRU.RemoveFile(filePath);
                await ServiceProvider.Get <IDialogService>().MessageBox(string.Format(Tr._p("Message", @"The file '{0}' does not exist."), filePath), MessageBoxButton.OK, MessageBoxImage.Information);

                return(false);
            }

            var sessionResult = new PackageSessionResult();
            var loadedSession = await SessionViewModel.OpenSession(filePath, ServiceProvider, this, sessionResult);

            // Loading has failed
            if (loadedSession == null)
            {
                // Null means the user has cancelled the loading operation.
                return(sessionResult.OperationCancelled ? (bool?)null : false);
            }

            MRU.AddFile(filePath);
            Session = loadedSession;

            InternalSettings.FileDialogLastOpenSessionDirectory.SetValue(new UFile(filePath).GetFullDirectory());
            InternalSettings.Save();
            return(true);
        }
Exemplo n.º 4
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="system">TBD</param>
 /// <param name="config">TBD</param>
 public PersistenceSettings(ActorSystem system, Config config)
     : base(system, config)
 {
     View = new ViewSettings(config);
     AtLeastOnceDelivery = new AtLeastOnceDeliverySettings(config);
     Internal            = new InternalSettings(config);
 }
        private void Awake()
        {
            RectTransform = (RectTransform)transform;
            UnityCanvas   = GetComponentInParent <Canvas>();
#if !UNITY_EDITOR
            Internal = new InternalSettings(this);
#endif

            UnanchoredPanelGroup = new UnanchoredPanelGroup(this);
            RectTransform.pivot  = new Vector2(0.5f, 0.5f);

            if (GetComponent <RectMask2D>() == null)
            {
                gameObject.AddComponent <RectMask2D>();
            }

            Size = RectTransform.rect.size;

            InitializeRootGroup();
            InitializeAnchorZones();

            background = GetComponent <Image>();
            if (background == null)
            {
                background               = gameObject.AddComponent <Image>();
                background.sprite        = dummyPanel.Internal.BackgroundSprite;
                background.color         = Color.clear;
                background.raycastTarget = false;
            }

            PanelManager.Instance.RegisterCanvas(this);
        }
Exemplo n.º 6
0
 public PersistenceSettings(ActorSystem system, Config config)
     : base(system, config)
 {
     Journal            = new JournalSettings(config);
     View               = new ViewSettings(config);
     GuaranteedDelivery = new GuaranteedDeliverySettings(config);
     Internal           = new InternalSettings(config);
 }
Exemplo n.º 7
0
        private void Awake()
        {
            m_minSize = new Vector2(100f, 100f);
            Internal  = new InternalSettings(this);

            iconHolder.preserveAspect = true;

            closeButton.onClick.AddListener(() => PanelNotificationCenter.Internal.TabClosed(this));
        }
Exemplo n.º 8
0
 protected override void OnClosed(EventArgs e)
 {
     base.OnClosed(e);
     if (Result == Presentation.Services.DialogResult.Ok)
     {
         EditorSettings.Save();
         InternalSettings.TemplatesWindowDialogLastNewSessionTemplateDirectory.SetValue(Templates.Location.FullPath);
         InternalSettings.Save();
     }
 }
Exemplo n.º 9
0
        public PanelGroup(PanelCanvas canvas, PanelDirection direction)
        {
            Canvas   = canvas;
            Internal = new InternalSettings(this);

            this.direction = direction;

            elements     = new List <IPanelGroupElement>(2);
            surroundings = new IPanelGroupElement[4];
        }
Exemplo n.º 10
0
        public bool Remove(TKey key)
        {
            if (InternalSettings.ContainsKey(key))
            {
                m_col.Remove(InternalSettings[key]);
                m_parent.DeleteObject(InternalSettings[key]);
            }

            return(InternalSettings.Remove(key));
        }
Exemplo n.º 11
0
        public void LoadSettings()
        {
            path = Path.Combine(helper.DirectoryPath, "settings.json");
            if (!File.Exists(path))
            {
                File.WriteAllText(path, defaultContent);
            }
            string text = File.ReadAllText(path);

            settings = JsonConvert.DeserializeObject <InternalSettings>(text);
        }
Exemplo n.º 12
0
        public void Clear()
        {
            while (m_col.Count > 0)
            {
                TBase item = m_col[0];
                m_col.Remove(item);
                m_parent.DeleteObject <TBase>(item);
            }

            InternalSettings.Clear();
        }
Exemplo n.º 13
0
        private async Task SaveAndClose()
        {
            try
            {
                // Save MRUs
                if (Editor.Session != null)
                {
                    var openedAssets = assetEditorsManager.OpenedAssets.ToList();
                    if (!await Editor.Session.Close())
                    {
                        closingTask?.SetResult(false);
                        return;
                    }

                    // Make sure the curve editor is closed
                    assetEditorsManager.CloseCurveEditorWindow();

                    // Close all windows (except if the user interrupt the flow)
                    // Since all dirty assets must have been saved before, we don't need to ask for any user confirmation
                    assetEditorsManager.CloseAllEditorWindows(false);

                    Editor.Session.Destroy();

                    // Save opened assets
                    dockingLayout.SaveOpenAssets(openedAssets);
                    // Save layout
                    dockingLayout.SaveCurrentLayout();
                }

                var workArea = this.GetWorkArea();
                // Save state
                GameStudioInternalSettings.WorkAreaWidth.SetValue((int)workArea.Width);
                GameStudioInternalSettings.WorkAreaHeight.SetValue((int)workArea.Height);
                GameStudioInternalSettings.WindowWidth.SetValue((int)Math.Max(320, (WindowState == WindowState.Maximized ? RestoreBounds.Width : ActualWidth)));
                GameStudioInternalSettings.WindowHeight.SetValue((int)Math.Max(240, (WindowState == WindowState.Maximized ? RestoreBounds.Height : ActualHeight)));
                GameStudioInternalSettings.WindowMaximized.SetValue(WindowState == WindowState.Maximized);

                // Write the settings file
                InternalSettings.Save();

                forceClose = true;
                var studio = Editor as GameStudioViewModel;
                studio?.Destroy();

                closingTask?.SetResult(true);
                // Shutdown after all other operations have completed
                await Application.Current.Dispatcher.InvokeAsync(Application.Current.Shutdown, DispatcherPriority.ContextIdle);
            }
            finally
            {
                closingTask = null;
            }
        }
Exemplo n.º 14
0
        public static void LoadConfig()
        {
            JsonSerializerSettings settings = new JsonSerializerSettings();

            try
            {
                _sets = JsonConvert.DeserializeObject <InternalSettings>(System.IO.File.ReadAllText(@"config.json"), settings);
            }
            catch (Exception ex)
            {
                _sets = new InternalSettings();
            }
        }
Exemplo n.º 15
0
        protected virtual async Task <IEnumerable <UFile> > BrowseForSourceFiles(TemplateAssetDescription description, bool allowMultiSelection)
        {
            var extensions = description.GetSupportedExtensions();
            var result     = await BrowseForFiles(extensions, true, allowMultiSelection, InternalSettings.FileDialogLastImportDirectory.GetValue());

            if (result != null)
            {
                var list = result.ToList();
                InternalSettings.FileDialogLastImportDirectory.SetValue(list.First());
                InternalSettings.Save();
                return(list);
            }
            return(null);
        }
Exemplo n.º 16
0
        public bool TryGetValue(TKey key, out TValue value)
        {
            TBase item;

            if (InternalSettings.TryGetValue(key, out item))
            {
                value = (TValue)m_valuefield.GetValue(item, null);
                return(true);
            }
            else
            {
                value = default(TValue);
                return(false);
            }
        }
        protected override async Task <IEnumerable <UFile> > BrowseForSourceFiles(TemplateAssetDescription description, bool allowMultiSelection)
        {
            var assetType     = description.GetAssetType();
            var assetTypeName = TypeDescriptorFactory.Default.AttributeRegistry.GetAttribute <DisplayAttribute>(assetType)?.Name ?? assetType.Name;
            var extensions    = new FileExtensionCollection($"Source files for {assetTypeName}", TextureImporter.FileExtensions);
            var result        = await BrowseForFiles(extensions, allowMultiSelection, true, InternalSettings.FileDialogLastImportDirectory.GetValue());

            if (result != null)
            {
                var list = result.ToList();
                InternalSettings.FileDialogLastImportDirectory.SetValue(list.First());
                InternalSettings.Save();
                return(list);
            }
            return(null);
        }
Exemplo n.º 18
0
        private void Awake()
        {
            RectTransform = (RectTransform)transform;
            CanvasGroup   = GetComponent <CanvasGroup>();
            Internal      = new InternalSettings(this);

            RectTransform.anchorMin = Vector2.zero;
            RectTransform.anchorMax = Vector2.zero;
            RectTransform.pivot     = Vector2.zero;

            PanelManager.Instance.RegisterPanel(this);

            InitializeResizeZones();
            InitializeAnchorZone();

            AnchorZonesSetActive(false);
        }
Exemplo n.º 19
0
        private void Awake()
        {
            RectTransform = (RectTransform)transform;
            CanvasGroup   = GetComponent <CanvasGroup>();
            Internal      = new InternalSettings(this);

            RectTransform.anchorMin = Vector2.zero;
            RectTransform.anchorMax = Vector2.zero;
            RectTransform.pivot     = Vector2.zero;

            PanelManager.Instance.RegisterPanel(this);

            InitializeResizeZones();
            InitializeAnchorZone();

            AnchorZonesSetActive(false);

            closeButton.onClick.AddListener(() => PanelNotificationCenter.Internal.PanelClosed(this));
            closeButton.transform.SetAsLastSibling();
        }
Exemplo n.º 20
0
        public bool Contains(KeyValuePair <TKey, TValue> item)
        {
            if (!InternalSettings.ContainsKey(item.Key))
            {
                return(false);
            }

            TValue v = this[item.Key];

            if (v == null && item.Value == null)
            {
                return(true);
            }
            else if (v == null)
            {
                return(false);
            }
            else
            {
                return(v.Equals(item.Value));
            }
        }
Exemplo n.º 21
0
        private static void Run()
        {
            PathHelper.BaseDirectory = AppContext.BaseDirectory;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            SettingsManager.LoadMiscSettings();

            PathHelper.CreateAllPaths();

            InternalSettings.EnableWebPIfPossible();

            SettingsManager.LoadClipSettings();
            SettingsManager.LoadMainFormSettings();
            SettingsManager.LoadRegionCaptureSettings();

            HotkeyManager.Init();

            List <Hotkey> hk;

            if ((hk = SettingsManager.LoadHotkeySettings()) != null)
            {
                HotkeyManager.UpdateHotkeys(hk, false);
            }
            else
            {
                HotkeyManager.UpdateHotkeys(HotkeyManager.GetDefaultHotkeyList(), false);
            }

            MainForm = new ApplicationForm();

            Application.Run(MainForm);

            Directory.SetCurrentDirectory(PathHelper.BaseDirectory);

            SettingsManager.SaveAllSettings(HotkeyManager.hotKeys);
        }
Exemplo n.º 22
0
        static void Main(string[] args)
        {
            Directory.SetCurrentDirectory(AppContext.BaseDirectory);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Task.Run(() => {
                InternalSettings.EnableWebPIfPossible();
                SettingsLoader.Load();
            });

            bool singleInstance = true;

            // -n means run as new instance
            if (args.Contains("-n"))
            {
                singleInstance = false;
            }
            else if (args.Length < 1)
            {
                singleInstance = false;
            }

            using (InstanceManager instanceManager = new InstanceManager(singleInstance, args, SingleInstanceCallback))
            {
                mainForm = new MainForm(args);
                Application.Run(mainForm);
            }

            Directory.SetCurrentDirectory(AppContext.BaseDirectory);

            if (InternalSettings.Delete_Temp_Directory && Directory.Exists(InternalSettings.Temp_Image_Folder))
            {
                Directory.Delete(InternalSettings.Temp_Image_Folder, true);
            }

            SettingsLoader.Save();
        }
Exemplo n.º 23
0
        public TValue this[TKey key]
        {
            get
            {
                TBase tmp;
                if (InternalSettings.TryGetValue(key, out tmp))
                {
                    return((TValue)m_valuefield.GetValue(tmp, null));
                }
                else
                {
                    return(default(TValue));
                }
            }
            set
            {
                bool exists = InternalSettings.ContainsKey(key);

                if (value == null && exists)
                {
                    //Remove
                    this.Remove(key);
                }
                else if (value != null && !exists)
                {
                    //Add
                    this.Add(key, value);
                }
                else if (value != null && exists)
                {
                    //Update
                    m_valuefield.SetValue(InternalSettings[key], value, null);
                }
                //else: It should be removed, but does not exist
            }
        }
Exemplo n.º 24
0
        public async Task <bool?> OpenInitialSession(string initialSessionPath)
        {
            if (string.IsNullOrWhiteSpace(initialSessionPath))
            {
                return(false);
            }

            // The LoadingStartupSession settings is true, which means that the editor crashed while loading the startup project last time.
            // Lets give the user a chance to fix the startup session.
            if (InternalSettings.LoadingStartupSession.GetValue())
            {
                var buttons = DialogHelper.CreateButtons(new[]
                {
                    Tr._p("Button", "Try again"),
                    Tr._p("Button", "Cancel")
                }, 1, 2);
                string message = string.Format(Tr._p("Message", "The last attempt to load the project **{0}** failed. \r\n\r\nDo you want to try to load it again?"), Path.GetFileName(initialSessionPath));
                var    result  = await ServiceProvider.Get <IDialogService>().MessageBox(message, buttons, MessageBoxImage.Warning);

                if (result != 1)
                {
                    return(false);
                }
            }

            // Safe-guard - this will warn that the startup session makes the editor crash while loading.
            InternalSettings.LoadingStartupSession.SetValue(true);
            InternalSettings.Save();

            var sessionResult = await OpenSession(initialSessionPath);

            InternalSettings.LoadingStartupSession.SetValue(false);
            InternalSettings.Save();

            return(sessionResult);
        }
Exemplo n.º 25
0
 public XamarinMovieContainer SetInternalSettings(InternalSettings settings)
 {
     Container.RegisterInstance(settings);
     return(this);
 }
Exemplo n.º 26
0
 public MovieService(InternalSettings settings, HttpClient httpClient)
 {
     _settings   = settings;
     _httpClient = httpClient;
 }
Exemplo n.º 27
0
 public MovieDbImageConverter()
 {
     internalSettings = ServiceLocator.Current.GetInstance <InternalSettings>();
 }
Exemplo n.º 28
0
 public IEnumerator <KeyValuePair <TKey, TValue> > GetEnumerator()
 {
     return(new TranslatoryEnumerator(this, InternalSettings.GetEnumerator()));
 }
Exemplo n.º 29
0
 static ApplicationSettings()
 {
     _sets = new InternalSettings();
     LoadConfig();
 }