Пример #1
0
        private void Initialize(MasterController masterController)
        {
            if (initialized)
            {
                return;
            }

            this.masterController = masterController;

            minSize      = WindowSize;
            titleContent = new GUIContent(masterController.GetDisplayMasterName());

            lifetimeDisposable = new LifetimeDisposable();

            toolbarView = new ToolbarView();
            toolbarView.Initialize(masterController);

            recordView = new RecordView();
            recordView.Initialize(masterController);

            toolbarView.OnChangeSearchTextAsObservable()
            .Subscribe(x =>
            {
                var records = GetDisplayRecords();

                recordView.SetRecords(records);
            })
            .AddTo(lifetimeDisposable.Disposable);

            toolbarView.OnResetRecordsAsObservable()
            .Subscribe(_ => recordView.RefreshRowHeights())
            .AddTo(lifetimeDisposable.Disposable);

            initialized = true;
        }
Пример #2
0
        //----- property -----

        //----- method -----

        public static RecordViewerWindow Open(MasterController masterController)
        {
            RecordViewerWindow recordViewerWindow = null;

            var windows = FindAllWindow();

            var window = windows.FirstOrDefault(x => x.masterController.MasterType == masterController.MasterType);

            // 1つのマスターにつき1ウィンドウまでしか開かない.
            if (window == null)
            {
                window = CreateInstance <RecordViewerWindow>();

                window.Initialize(masterController);

                EditorApplication.delayCall += () =>
                {
                    window.SetWindowSize();
                    window.Show();
                };

                recordViewerWindow = window;
            }

            window.Focus();

            return(recordViewerWindow);
        }
Пример #3
0
        //----- property -----

        //----- method -----

        public static RecordWindow Open(MasterController masterController)
        {
            RecordWindow recordWindow = null;

            // 開いているウィンドウ取得.
            var window = FindWindow(masterController.MasterType);

            // 1つのマスターにつき1ウィンドウまでしか開かない.
            if (window == null)
            {
                window = CreateInstance <RecordWindow>();

                window.Initialize(masterController);

                EditorApplication.delayCall += () =>
                {
                    window.Show();
                };

                recordWindow = window;
            }

            window.Focus();

            return(recordWindow);
        }
Пример #4
0
        //----- method -----

        public void Initialize(MasterController masterController)
        {
            if (initialized)
            {
                return;
            }

            this.masterController = masterController;

            initialized = true;
        }
Пример #5
0
        public void Initialize(MasterController masterController)
        {
            this.masterController = masterController;

            titleContent = new GUIContent(masterController.GetDisplayMasterName());

            minSize = WindowSize;

            controlRects = new List <Rect>();

            // レコード一覧View.

            recordScrollView          = new RecordScrollView(masterController);
            recordScrollView.Contents = masterController.Records;
            recordScrollView.HideHorizontalScrollBar = true;

            recordScrollView.OnRepaintRequestAsObservable()
            .Subscribe(_ => Repaint())
            .AddTo(lifetimeDisposable.Disposable);
        }
Пример #6
0
        public void Initialize(MasterController masterController)
        {
            if (initialized)
            {
                return;
            }

            this.masterController = masterController;

            lifetimeDisposable = new LifetimeDisposable();

            records = masterController.Records;

            rowHeight = RowHight;
            showAlternatingRowBackgrounds = false;
            showBorder = true;

            SetHeaderColumns();

            initialized = true;
        }
Пример #7
0
        //----- method -----

        public RecordScrollView(MasterController masterController)
        {
            this.masterController = masterController;
        }
Пример #8
0
        public IObservable <Unit> LoadAllMasterData()
        {
            loadMasterRequest = false;

            var isComplete = false;

            var allMasters = GetAllMasters();

            var cryptoKey = GetCryptoKey();

            var loadFinishCount  = 0;
            var totalMasterCount = allMasters.Length;

            Action onLoadFinish = () =>
            {
                loadFinishCount++;

                if (isComplete)
                {
                    return;
                }

                EditorUtility.DisplayProgressBar("progress", "Loading all masters", (float)loadFinishCount / totalMasterCount);
            };

            Action onLoadComplete = () =>
            {
                masterControllers = new List <MasterController>();

                foreach (var master in allMasters)
                {
                    var masterController = new MasterController();

                    masterController.Initialize(master);

                    masterControllers.Add(masterController);
                }

                displayContents = GetDisplayMasters();

                Repaint();

                isComplete = true;
            };

            var observers = new List <IObservable <Unit> >();

            foreach (var master in allMasters)
            {
                var observable = Observable.Defer(() => master.Load(cryptoKey, false).Do(_ => onLoadFinish())).AsUnitObservable();

                observers.Add(observable);
            }

            return(observers
                   .WhenAll()
                   .Do(_ => onLoadComplete())
                   .Finally(() => EditorUtility.ClearProgressBar())
                   .DelayFrame(1) // プログレスバーが消えるのを待つ.
                   .AsUnitObservable());
        }