Exemplo n.º 1
0
 public override void enter()
 {
     GestureListener.ifDetectGesture = true;
     imageToUserMap = GameObject.FindWithTag("Canvas").GetComponent <ImageToUserMap> ();
     firstPanel     = FirstPanel.Instance;
     initialize();
 }
Exemplo n.º 2
0
 void Start()
 {
     instance     = this;
     stateMachine = gameObject.GetComponent <StateMachine> ();
     stateMachine.currentState = MenuState.Instance;
     stateMachine.currentState.enter();
     stateMachine.previousState = null;
 }
Exemplo n.º 3
0
        private void Map_Click(object sender, EventArgs e)
        {
            InputGraph.Text   = "";
            InputNonEx.Text   = "";
            InputQuestEx.Text = "";
            Ways.Text         = "";
            Graph X = new Graph("graph");

            Graph = X;
            FirstPanel.BringToFront();
        }
Exemplo n.º 4
0
 public override void enter()
 {
     firstPanel = FirstPanel.Instance;
     firstPanel.animators [0].enabled = true;
 }
Exemplo n.º 5
0
 public override void enter()
 {
     firstPanel = FirstPanel.Instance;
     firstPanel.tipPanels [1].SetActive(true);
 }
Exemplo n.º 6
0
 private void Form1_Load(object sender, EventArgs e)
 {
     FirstPanel.BringToFront();
 }
        public MainWindow()
        {
            Loaded += (sender, args) =>
            {
                foreach (string bookmark in SettingsBackup.BookmarksListStatic)
                {
                    MenuItem deleteItem = new MenuItem {
                        Header = "Delete"
                    };
                    MenuItem openItem = new MenuItem {
                        Header = "Open"
                    };

                    deleteItem.Click += DeleteItemOnClick;
                    openItem.Click   += OpenItemOnClick;

                    MenuItem item = new MenuItem {
                        Header = bookmark
                    };

                    item.Items.Add(deleteItem);
                    item.Items.Add(openItem);

                    BookmarksMenuItem.Items.Add(item);
                }
            };
            Closing += (sender, args) =>
            {
                if (File.Exists(SettingsBackup.SettingsFileName))
                {
                    File.Delete(SettingsBackup.SettingsFileName);
                }
                JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
                List <string>        bookmarksList        =
                    (from MenuItem menuItem in BookmarksMenuItem.Items select menuItem.Header.ToString()).ToList();
                SettingsBackup settingsBackup = new SettingsBackup
                {
                    FirstPanelPath  = FirstPanelPath.Text,
                    SecondPanelPath = SecondPanelPath.Text,
                    BookmarksList   = bookmarksList
                };
                File.WriteAllText(SettingsBackup.SettingsFileName, javaScriptSerializer.Serialize(settingsBackup));
            };
            InitializeComponent();

            FirstPanel.PreviewMouseWheel  += PanelOnMouseWheel;
            SecondPanel.PreviewMouseWheel += PanelOnMouseWheel;

            FirstPanelButton.Content  = "Refresh";
            SecondPanelButton.Content = "Refresh";

            AddToBookmarksFirstButton.Content  = "Add to bookmarks";
            AddToBookmarksSecondButton.Content = "Add to bookmarks";

            AddToBookmarksFirstButton.Click  += AddToBookmarksFirstButtonOnClick;
            AddToBookmarksSecondButton.Click += AddToBookmarksSecondButtonOnClick;

            FirstPanelButton.Click  += (sender, args) => FillTable(true, FirstPanelPath.Text);
            SecondPanelButton.Click += (sender, args) => FillTable(false, SecondPanelPath.Text);

            FirstPanel.SelectionChanged  += PanelOnSelectionChanged;
            SecondPanel.SelectionChanged += PanelOnSelectionChanged;

            _focusedStyle = new Style(typeof(Control));
            try
            {
                _focusedStyle.Setters.Add(new Setter(BackgroundProperty,
                                                     new SolidColorBrush(
                                                         // ReSharper disable once PossibleNullReferenceException
                                                         (Color)ColorConverter.ConvertFromString(SettingsBackup.ActivePanelColorStatic)))); //fae1c0
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Can't find standart color");
                _focusedStyle.Setters.Add(new Setter(BackgroundProperty,
                                                     new SolidColorBrush(Colors.Blue)));
            }

            _standardStyle = new Style(typeof(Control));
            _standardStyle.Setters.Add(new Setter(BackgroundProperty,
                                                  new SolidColorBrush(Colors.White)));

            #region Clickers

            FirstPanelPath.KeyDown  += PathOnKeyDown;
            SecondPanelPath.KeyDown += PathOnKeyDown;

            FirstPanel.MouseDoubleClick  += PanelOnMouseDoubleClick;
            SecondPanel.MouseDoubleClick += PanelOnMouseDoubleClick;

            FirstPanel.KeyDown  += PanelOnKeyDown;
            SecondPanel.KeyDown += PanelOnKeyDown;

            #endregion

            FirstPanel.PreviewMouseDown  += PanelOnPreviewMouseDown;
            SecondPanel.PreviewMouseDown += PanelOnPreviewMouseDown;

            #region Menu

            NewFileMenuItem.Click += (sender, args) => CreateNewFile();
            NewFileFastKey.Click  += (sender, args) => CreateNewFile();

            NewFolderMenuItem.Click += (sender, args) => CreateNewFolder();
            NewFolderFastKey.Click  += (sender, args) => CreateNewFolder();

            DeleteFastKey.Click         += DeleteFastKeyOnClick;
            RenameFastKey.Click         += RenameFastKeyOnClick;
            CopyFastKey.Click           += CopyFastKeyOnClick;
            MoveFastKey.Click           += MoveFastKeyOnClick;
            CopyFastKeyWindows.Click    += CopyFastKeyWindowsOnClick;
            RenameTemplateFastKey.Click += RenameTemplateFastKeyOnClick;
            CheckHashSums.Click         += CheckHashSumsOnClick;
            Archive.Click   += ArchiveOnClick;
            Unarchive.Click += UnarchiveOnClick;

            SettingsMenuItem.Click += SettingsMenuItemOnClick;

            #endregion


            if (File.Exists("settings.json"))
            {
                try
                {
                    SettingsBackup unused =
                        (SettingsBackup)NewtonSoft.Deserialize(File.ReadAllText("settings.json"), typeof(SettingsBackup));
                }
                catch (Exception)
                {
                    SettingsBackup.SetDefaults();;
                }
                CheckPanelFocus();
            }
            else
            {
                SettingsBackup.SetDefaults();
            }

            FillTable(true, SettingsBackup.FirstPanelPathStatic);
            FillTable(false, SettingsBackup.SecondPanelPathStatic);
            _isFirstFocused = true;
            CheckPanelFocus();
            FirstPanel.Focus();
        }
Exemplo n.º 8
0
        protected override Tuple <double, double> CalculateSizesOnAttachOrResize(
            VisibilityAction?change, Tuple <double, double> lastSizeOrNull = null)
        {
            var theoretAvailSpace = Window.InnerWidth; //TODO change to equivalent of Container.GetAvailableHeightForFormElement();
            var factAvailSpace    = theoretAvailSpace - Splitter.GetBoundingClientRect().Width;

            var leftWdth  = FirstPanel.GetBoundingClientRect().Width;
            var rightWdth = SecondPanel.GetBoundingClientRect().Width;

            Logger.Debug(GetType(), "lastSize change={0} hidden?={1} lastSize={2} avail={3}",
                         change, Hidden, lastSizeOrNull?.Item1 + lastSizeOrNull?.Item2, factAvailSpace);

            if (lastSizeOrNull != null && change == VisibilityAction.Showing &&
                DoubleExtensions.AreApproximatellyTheSame(
                    lastSizeOrNull.Item1 + lastSizeOrNull.Item2, factAvailSpace, 1.1))
            {
                Logger.Debug(GetType(), "reusing lastSize");

                leftWdth  = lastSizeOrNull.Item1;
                rightWdth = lastSizeOrNull.Item2;
            }
            else if (Hidden)
            {
                Logger.Debug(GetType(), "hiding reusing all available space");

                if (Hideable == Hideability.First)
                {
                    leftWdth  = 0;
                    rightWdth = factAvailSpace;
                }
                else if (Hideable == Hideability.Second)
                {
                    leftWdth  = factAvailSpace;
                    rightWdth = 0;
                }
            }
            else
            {
                //showing or resize or attach
                Logger.Debug(GetType(), "not reusing lastSize");
                var res = ComputeSpace(leftWdth, rightWdth, factAvailSpace);

                leftWdth  = res.Item1;
                rightWdth = res.Item2;
            }

            if (!Hidden)
            {
                leftWdth  = Math.Max(leftWdth, MinPanelSizePx);
                rightWdth = Math.Max(rightWdth, MinPanelSizePx);

                //make sure that panels are visible on show
                var ratio = leftWdth / (leftWdth + rightWdth);
                leftWdth  = factAvailSpace * ratio;
                rightWdth = factAvailSpace - leftWdth;
            }

            Logger.Debug(GetType(), "CalculateSizesInitial(id={0})  availSpace={1} splitterHeight={2} outcome=({3},{4})",
                         Container.Id, theoretAvailSpace, Splitter.GetBoundingClientRect().Width, leftWdth, rightWdth);

            return(Tuple.Create(leftWdth, rightWdth));
        }
Exemplo n.º 9
0
        protected override Tuple <double, double> CalculateSizesOnAttachOrResize(
            VisibilityAction?change, Tuple <double, double> lastSizeOrNull = null)
        {
            var theoretAvailSpace = Container.GetAvailableHeightForFormElement();
            var factAvailSpace    = theoretAvailSpace - Splitter.GetBoundingClientRect().Height;

            var upperHght = FirstPanel.GetBoundingClientRect().Height;
            var lowerHght = SecondPanel.GetBoundingClientRect().Height;

            Logger.Debug(GetType(), "lastSize change={0} hidden?={1} lastSize={2} avail={3}",
                         change, Hidden, lastSizeOrNull?.Item1 + lastSizeOrNull?.Item2, factAvailSpace);

            if (lastSizeOrNull != null && change == VisibilityAction.Showing &&
                DoubleExtensions.AreApproximatellyTheSame(
                    lastSizeOrNull.Item1 + lastSizeOrNull.Item2, factAvailSpace, 1.1))
            {
                Logger.Debug(GetType(), "reusing lastSize");

                upperHght = lastSizeOrNull.Item1;
                lowerHght = lastSizeOrNull.Item2;
            }
            else if (Hidden)
            {
                Logger.Debug(GetType(), "hiding reusing all available space");

                if (Hideable == Hideability.First)
                {
                    upperHght = 0;
                    lowerHght = factAvailSpace;
                }
                else if (Hideable == Hideability.Second)
                {
                    upperHght = factAvailSpace;
                    lowerHght = 0;
                }
            }
            else
            {
                //showing or resize or attach
                Logger.Debug(GetType(), "not reusing lastSize");
                var res = ComputeSpace(upperHght, lowerHght, factAvailSpace);

                upperHght = res.Item1;
                lowerHght = res.Item2;
            }

            if (!Hidden)
            {
                upperHght = Math.Max(upperHght, MinPanelSizePx);
                lowerHght = Math.Max(lowerHght, MinPanelSizePx);

                //make sure that panels are visible on show
                var ratio = upperHght / (upperHght + lowerHght);
                upperHght = factAvailSpace * ratio;
                lowerHght = factAvailSpace - upperHght;
            }

            Logger.Debug(GetType(), "CalculateSizesInitial(id={0}) availSpace={1} splitterHeight={2} outcome=({3},{4})",
                         Container.Id, theoretAvailSpace, Splitter.GetBoundingClientRect().Height, upperHght, lowerHght);

            return(Tuple.Create(upperHght, lowerHght));
        }