Inheritance: GUIElement
        public void GoToMainMenu()
        {
            MainMenuWindow mainmenu = new MainMenuWindow();

            Application.Current.Windows[0].Close();
            mainmenu.Show();
        }
Example #2
0
 public static void login(string l, string p)
 {
     try {
         const String AuthText = "!OK";
         var          request  = runHttp("vtmanager_login.php");
         var          post     = "btn_auth=True";
         post += "&login="******"&password=" + EncodingUtils.encode(p);
         var dat = Encoding.ASCII.GetBytes(post);
         request.ContentLength = dat.Length;
         using (var stream = request.GetRequestStream()) {
             stream.Write(dat, 0, dat.Length);
         }
         var response       = (HttpWebResponse)request.GetResponse();
         var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
         if (responseString.Contains(AuthText))
         {
             AuthWindow.ThisWindow.Close();
             MainMenuWindow mmw = new MainMenuWindow();
             mmw.Show();
         }
         else
         {
             error_msg.dialog_label.Content = Messages._ERROR_MESSAGE;
             error_msg.contained_info.Text  = Messages._LOGIN_ERROR;
             error_msg.Show();
         }
     } catch (WebException) {
         error_msg.dialog_label.Content = Messages._ERROR_MESSAGE;
         error_msg.contained_info.Text  = Messages._CONNECTION_TIMEOUT;
         error_msg.Show();
     }
 }
Example #3
0
        private void LoadWindowParent(MainMenuWindow _MainMenuWindow, Project MProject)
        {
            ProjectData.SelectedProject = MProject;

            this._MainMenuWindow = _MainMenuWindow;
            _MainMenuWindow.Hide();
        }
Example #4
0
    private void InputKeys()
    {
        if (Program.IsInputLocked)
        {
            return;
        }
        if (!IsMainMenuOn())
        {
            return;
        }

        if (Input.GetKey(KeyCode.C))
        {
            if (_mainMenuWindow == null)
            {
                _mainMenuWindow = FindObjectOfType <MainMenuWindow>();
            }

            if (!_mainMenuWindow.IsContinueBtnInteractable())
            {
                return;
            }

            ContinueGameBtn();
        }
        else if (Input.GetKey(KeyCode.N))
        {
            RedifineWindows();
            HideMainMakeWindActive(_newGameWindow);
        }
    }
Example #5
0
    /// <summary>
    /// Needed so MainGUI doesnt go on top of MainMenu
    /// </summary>
    internal void ReLoadMainMenuIfActive()
    {
        var forms = FindObjectsOfType <MyForm>();

        for (int i = 0; i < forms.Length; i++)
        {
            if (forms[i] != null && forms[i].MyId.Contains("MainMenu"))
            {
                RedifineWindows();
                _mainMenuWindow.Destroy();
                _mainMenuWindow = null;

                _newGameWindow.Destroy();
                _newGameWindow = null;

                SaveLoadGameWindow.Destroy();
                SaveLoadGameWindow = null;

                _optionsWindow.Destroy();
                _optionsWindow = null;

                if (_achieveWindow)
                {
                    _achieveWindow.Destroy();
                    _achieveWindow = null;
                }

                DestroyCurrentMenu();
                LoadMainMenu();
                Debug.Log("Reload Main Menu  ReLoadMainMenuIfActive");

                RedifineWindows();
            }
        }
    }
Example #6
0
        public EditorMainMenuWindow(MainMenuWindow _MainMenuWindow, Project MProject)
        {
            InitializeComponent();
            LoadWindowParent(_MainMenuWindow, MProject);
            EventsInitialize();

            NetworkDelegates.Add(delegate(MResponse ServerResponse)
            {
                this?.Close();
            }, Dispatcher, -1, "User.Disconnected.Confirm", "EditorMainMenuWindow");

            NetworkDelegates.Add(delegate(MResponse ServerResponse)
            {
                var NetworkId = Package.Unpacking <string>(ServerResponse.DataBytes);

                MUserNetwork UserNetwork = UserInfo.NetworkUsers.Find(x => x.NetworkId == NetworkId);

                if (UserNetwork != null)
                {
                    if (UserNetwork.NetworkId == UserInfo.NetworkSelf.NetworkId)
                    {
                        this?.Close();
                    }
                }
            }, Dispatcher, -1, "Users.Remove", "EditorMainMenuWindow");
        }
Example #7
0
        /// <summary>
        /// On Screen Display feature:
        /// Clear, and hide the keybind panel.
        /// Populate with items, which can be keyboard shortcuts or hardcoded mouse clicks.
        /// </summary>
        /// <param name="items">List of <see cref="OsdItem"/> to display.</param>
        public static void Display(List <OsdItem> items)
        {
            MainMenuWindow mainMenu = ModUI.Instance.MainMenu;

            Hide();

            // Deactivate old items, and destroy them. Also remove them from the panel till Unity
            // is happy to delete them.
            foreach (Transform c in mainMenu.OnscreenDisplayPanel.transform)
            {
                c.gameObject.SetActive(false);
                UnityEngine.Object.Destroy(c.gameObject);
            }

            // mainMenu.KeybindsPanel.transform.DetachChildren();

            // Populate the panel with the items
            using (var builder = new UiBuilder <U.UPanel>(mainMenu.OnscreenDisplayPanel)) {
                foreach (var item in items)
                {
                    item.Build(builder);
                }
            }

            if (items.Count > 0 &&
                mainMenu.OnscreenDisplayPanel.GetUIView() != null)
            {
                mainMenu.OnscreenDisplayPanel.opacity = 1f; // fully visible, opaque
            }

            // Recalculate now
            UResizer.UpdateControl(mainMenu);
        }
Example #8
0
        public void SetGnomodiaLogo(MainMenuWindow mainMenu, Manager manager)
        {
            Panel buttonPanel = (Panel)MainMenuWindowPanelField.GetValue(mainMenu);

            ImageBox logo;

            if (!buttonPanel.FindControlRecursive(out logo))
            {
                return;
            }

            Stream    logoStream  = typeof(ModDialog).Assembly.GetManifestResourceStream("Gnomodia.Images.Gnomodia.png");
            Texture2D logoTexture = Texture2D.FromStream(GnomanEmpire.Instance.GraphicsDevice, logoStream);

            logo.Image = logoTexture;

            logo.SizeMode = SizeMode.Stretched;
            logo.Width    = logoTexture.Width * 3;
            logo.Height   = logoTexture.Height * 3;

            logo.Left = (buttonPanel.Width - logo.Width) / 2;

            Button[] buttons;
            buttonPanel.FindControlsRecursive(out buttons, b => !string.IsNullOrEmpty(b.Text));
            foreach (var button in buttons)
            {
                button.Top += 76;
            }
        }
        private void ToMainMenu(object sender, RoutedEventArgs e)
        {
            MainMenuViewModel viewmodel;
            MainMenuWindow    window = new MainMenuWindow(this, out viewmodel);

            window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            window.ShowDialog();
        }
Example #10
0
        private static void Init()
        {
            // Makes buttons look better
            Settings.UseDefaultExtendedFont = true;

            // Shows the main menu
            _mainMenuWindow = MainMenuWindow.Show();
        }
        public UserEditPage(MainMenuWindow _MainMenuWindow, WUser User)
        {
            InitializeComponent();
            LoadWindowParent(_MainMenuWindow);
            EventsInitialize();

            this.User        = User;
            this.DataContext = this.User;
        }
Example #12
0
                internal static void Postfix_Awake(MainMenuWindow __instance)
                {
                    var _text = UnityEngine.Object.Instantiate(__instance.versionLabel,
                                                               __instance.versionLabel.transform.position,
                                                               __instance.versionLabel.transform.rotation,
                                                               __instance.versionLabel.transform.parent);

                    _text.text = "(BetterEquipmentMods v1.0.0)";
                }
        public TeamMainPage(MainMenuWindow _MainMenuWindow)
        {
            InitializeComponent();
            LoadWindowParent(_MainMenuWindow);
            NetworkEvemtsLoad();
            EventsInitialize();

            DataGrid_Teams.ItemsSource = TeamGroups;
            Sender.SendToServer("TeamGroup.GetAll", default, 4);
Example #14
0
        private static void Hide()
        {
            MainMenuWindow mainMenu = ModUI.Instance.MainMenu;

            if (mainMenu.OnscreenDisplayPanel.GetUIView() != null) // safety
            {
                mainMenu.OnscreenDisplayPanel.opacity = 0f;        // invisible
            }
        }
Example #15
0
        public void Reset(MainMenuWindow mainMenu, object sender, System.EventArgs eventArgs)
        {
            _gnomodiaVersionLabel.CalculateWidth();
            _gnomodiaVersionLabel.Left = mainMenu.ClientWidth - _gnomodiaVersionLabel.Width - _gnomodiaVersionLabel.Margins.Right;
            _gnomodiaVersionLabel.Top  = _gnomoriaVersionLabel.Top;

            _gnomoriaVersionLabel.CalculateWidth();
            _gnomoriaVersionLabel.Left = mainMenu.ClientWidth - _gnomoriaVersionLabel.Width - _gnomoriaVersionLabel.Margins.Right;
            _gnomoriaVersionLabel.Top  = _gnomodiaVersionLabel.Top - _gnomodiaVersionLabel.Margins.Top - 11 - _gnomoriaVersionLabel.Margins.Bottom;
        }
Example #16
0
        public UsersMainPage(MainMenuWindow _MainMenuWindow)
        {
            InitializeComponent();
            LoadWindowParent(_MainMenuWindow);
            NetworkEvemtsLoad();
            EventsInitialize();

            DataGrid_Users.ItemsSource = WUsers;

            Sender.SendToServer("Users.GetAll");
        }
Example #17
0
        // Initiates the game by means of going to the menu first
        public void InitMainMenu()
        {
            SetUpCustomColors();

            MainMenu = new MainMenuWindow(GameLoop.GameWidth, GameLoop.GameHeight)
            {
                IsFocused = true
            };
            Children.Add(MainMenu);
            MainMenu.Show();
            MainMenu.Position = new Point(0, 0);
        }
        public ProjectsMainPage(MainMenuWindow _MainMenuWindow)
        {
            InitializeComponent();
            LoadWindowParent(_MainMenuWindow);
            NetworkEvemtsLoad();

            DataGrid_Projects.ItemsSource = Projects;

            if (!Sender.SendToServer("Project.GetAll", default, 7))
            {
                new AlertWindow("Ошибка", AlertWindow.AlertCode.SendToServer);
            }
        }
Example #19
0
        public override void Initialize(object _data)
        {
            //sceneName = (string)_data;

            //var operation = SceneManager.LoadSceneAsync(sceneName);
            //StartCoroutine(UpdateProgress(operation));

            var windowsManager = ComponentLocator.Resolve <WindowsManager.WindowsManager>();

            mainMenu = windowsManager.CreateWindow <MainMenuWindow>(MainMenuWindow.prefabPath, Enums.EnumWindowsLayer.Main);
            mainMenu.OnInitialize += OnInitializeHandler;

            base.Initialize(_data);
        }
Example #20
0
        static void Main(string[] args)
        {
            int currentWindow = 1;

            Console.Title = "fillwords";
            Console.SetWindowSize(72, 20);
            MainMenuWindow MainMenu = new MainMenuWindow();

            SetWindow(MainMenu, 4, 1);
            if (currentWindow == 1)
            {
                MainMenu.Draw();
            }
        }
Example #21
0
        internal override void InitUI()
        {
            elapsedTime = 0;

            MouseCursor.State = MouseCursorState.Pointer;

            backgroundWindow = new MenuBackgroundWindow();
            mainMenuWindow   = new MainMenuWindow();

            textWindow = new UIWindow();
            UIImage img = new UIImage(WWTexture.FromImageResource("Text 'WarCraft'"));

            textWindow.AddComponent(img);
            textWindow.Height = img.Height;
        }
Example #22
0
        public MenuPlugin(GameController gameController, Graphics graphics, SettingsHub settingsHub) : base(gameController, graphics, settingsHub.MenuSettings)
        {
            this.settingsHub    = settingsHub;
            KeyboardMouseEvents = Hook.GlobalEvents();
            KeyboardMouseEvents.MouseWheelExt += KeyboardMouseEvents_MouseWheelExt;
            KeyboardMouseEvents.KeyDown       += KeyboardMouseEvents_KeyDown;
            KeyboardMouseEvents.KeyUp         += KeyboardMouseEvents_KeyUp;
            KeyboardMouseEvents.KeyPress      += KeyboardMouseEvents_KeyPress;
            KeyboardMouseEvents.MouseDownExt  += KeyboardMouseEvents_MouseDownExt;
            KeyboardMouseEvents.MouseUpExt    += KeyboardMouseEvents_MouseUpExt;
            KeyboardMouseEvents.MouseMove     += KeyboardMouseEvents_MouseMove;

            MenuWindow           = new MainMenuWindow(Settings, settingsHub);
            MenuToggleButtonRect = new RectangleF(10, 85, 80, 25);
        }
        private void CreateMainMenuButtonAndWindow()
        {
            UIView uiView = UIView.GetAView();

            try {
                MainMenu = MainMenuWindow.CreateMainMenuWindow();
            }
            catch (Exception e) {
                Log.Error($"While creating MainMenu: {e}");
            }
            try {
                MainMenuButton = (MainMenuButton)uiView.AddUIComponent(typeof(MainMenuButton));
            }
            catch (Exception e) {
                Log.Error($"While creating MainButton: {e}");
            }
        }
Example #24
0
 private void NewGameClick(MainMenuWindow o)
 {
     if (_isSaveSuccess)
     {
         MessageBoxResult result = MessageBox.Show($"Do you want to kill your your last pet named {_savedPet.Name} ?", "New game",
                                                   MessageBoxButton.YesNo);
         if (result == MessageBoxResult.Yes)
         {
             new ChosePetWindow().Show();
             o.Close();
         }
     }
     else
     {
         new ChosePetWindow().Show();
         o.Close();
     }
 }
Example #25
0
        void DrawMain()
        {
            float btnY, yOffset;
            btnY = 50;

            yOffset = 20;

            //if (Debug.isDebugBuild)
            //{
            //    Debug.Log(String.Format("pX:{0} pY:{1} pW:{2} pH:{3} btnX:{4} btnY:{5} btnW:{6} btnH{7} ",
            //        panelX, panelY, panelWidth, panelHeight, btnX, btnY, btnWidth, btnHeight));
            //}

            GUI.Box(new Rect(panelX, panelY, panelWidth, panelHeight), "Main menu");
            GUI.BeginGroup(new Rect(panelX, panelY, panelWidth, panelHeight));

            if (GUI.Button(new Rect(btnX, btnY, btnWidth, btnHeight), "Start"))
            {
                Application.LoadLevel(1);
            }

            btnY += btnHeight + yOffset;

            if (GUI.Button(new Rect(btnX, btnY, btnWidth, btnHeight), "Options"))
            {
                currentWidnow = MainMenuWindow.MMWOptions;
            }

            btnY += btnHeight + yOffset;

            if (GUI.Button(new Rect(btnX, btnY, btnWidth, btnHeight), "Records"))
            {
                currentWidnow = MainMenuWindow.MMWRecords;
            }

            btnY += btnHeight + yOffset;

            if (GUI.Button(new Rect(btnX, btnY, btnWidth, btnHeight), "Exit"))
            {
                Application.Quit();
            }

            GUI.EndGroup();
        }
Example #26
0
        public void AddMainMenuModButton(MainMenuWindow mainMenu, Manager manager)
        {
            Panel buttonPanel = (Panel)MainMenuWindowPanelField.GetValue(mainMenu);

            Button exitButton;

            if (!buttonPanel.FindControlRecursive(out exitButton, b => b.Text == "Exit"))
            {
                return;
            }

            Button modsButton = new Button(manager);

            modsButton.Init();
            modsButton.Width    = 200;
            modsButton.Top      = exitButton.Top;
            modsButton.Left     = (buttonPanel.Width - modsButton.Width) / 2;
            modsButton.Margins  = new Margins(0, 2, 0, 2);
            modsButton.Text     = "Mods";
            buttonPanel.Height += modsButton.Height + 4;
            modsButton.Click   += MainMenuModsButtonClick;
            buttonPanel.Add(modsButton);

            exitButton.Top = modsButton.Top + modsButton.Height + modsButton.Margins.Bottom + exitButton.Margins.Top;

            if (!mainMenu.FindControlRecursive(out _gnomoriaVersionLabel, l => l.Text.StartsWith("v")))
            {
                return;
            }

            _gnomoriaVersionLabel.Text = "Gnomoria " + _gnomoriaVersionLabel.Text;

            _gnomodiaVersionLabel = new Label(manager);
            _gnomodiaVersionLabel.Init();
            _gnomodiaVersionLabel.Alignment = Alignment.MiddleRight;
            _gnomodiaVersionLabel.Text      = "Gnomodia v" + typeof(ModDialog).Assembly.GetInformationalVersion();
            mainMenu.Add(_gnomodiaVersionLabel);

            Reset(mainMenu, null, null);
        }
        public void ShowMainMenu()
        {
            try {
                ToolsModifierControl.mainToolbar.CloseEverything();
            } catch (Exception e) {
                Log.Error("Error on Show(): " + e);
            }

            MainMenuWindow menuWindow = GetMenu();

            menuWindow.UpdateButtons();
            menuWindow.Show();

            TrafficManagerTool.ShowAdvisor("MainMenu");
#if DEBUG
            GetDebugMenu().Show();
#endif
            _uiShown = true;
            SetToolMode(TrafficManagerMode.Activated);
            MainMenuButton.UpdateButtonImageAndTooltip();
            UIView.SetFocus(MainMenu);
        }
Example #28
0
 private void RedifineWindows()
 {
     if (_mainMenuWindow == null)
     {
         _mainMenuWindow = FindObjectOfType <MainMenuWindow>();
     }
     if (_newGameWindow == null)
     {
         _newGameWindow = FindObjectOfType <NewGameWindow>();
     }
     if (SaveLoadGameWindow == null)
     {
         SaveLoadGameWindow = FindObjectOfType <SaveLoadGameWindow>();
     }
     if (_optionsWindow == null)
     {
         _optionsWindow = FindObjectOfType <OptionsWindow>();
     }
     if (_achieveWindow == null)
     {
         _achieveWindow = FindObjectOfType <AchieveWindow>();
     }
 }
Example #29
0
 public void Login()
 {
     using (RetailContext context = new RetailContext())
     {
         var list = context.Persons.Where(p => p.Name == thiswindow.UserName.Text && p.password == thiswindow.Password.Password).ToList();
         if (list.Count() > 0)
         {
             Person p = list[0];
             //new MessageWindow(thiswindow, "登陆成功").ShowDialog();
             XmlHelper.WriteNowPerson(p);
             thiswindow.ShowInTaskbar = false;
             thiswindow.Hide();
             MainMenuViewModel viewmodel;
             MainMenuWindow    window = new MainMenuWindow(this.thiswindow, out viewmodel);
             window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
             window.ShowDialog();
             thiswindow.Close();
         }
         else
         {
             new MessageWindow(thiswindow, "用户名或者密码错误").ShowDialog();
         }
     }
 }
Example #30
0
        void DrawOptions()
        {
            GUI.Box(new Rect(panelX, panelY, panelWidth, panelHeight), "Options");
            GUI.BeginGroup(new Rect(panelX, panelY, panelWidth, panelHeight));

            GUI.Box(new Rect(50, 25, panelWidth - 100, panelHeight-50), "");
            optSelected = GUI.SelectionGrid(new Rect(50, 25, panelWidth-100, 25), optSelected, optTabs, 3);
            switch (optSelected)
            {
                case 1:
                    break;
                case 2:
                    break;
                case 3:
                    break;
            }

            if (GUI.Button(new Rect(btnX, panelHeight - (btnHeight * 2), btnWidth, btnHeight), "Back"))
            {
                currentWidnow = MainMenuWindow.MMWMain;
            }

            GUI.EndGroup();
        }
Example #31
0
        public ProfileView(MainMenuWindow _MainMenuWindow)
        {
            InitializeComponent();

            this._MainMenuWindow = _MainMenuWindow;
        }
Example #32
0
 private void ShowContinueWindow(MainMenuWindow o)
 {
     new GameWindow(new GameWindowViewModel(_savedPet)).Show();
     o.Close();
 }
Example #33
0
 void Start()
 {
     currentWidnow   = MainMenuWindow.MMWMain;
     OnResize();
 }
Example #34
0
        void DrawRecords()
        {
            GUI.Box(new Rect(panelX, panelY, panelWidth, panelHeight), "Records");
            GUI.BeginGroup(new Rect(panelX, panelY, panelWidth, panelHeight));

            if (GUI.Button(new Rect(btnX, panelHeight - (btnHeight * 2), btnWidth, btnHeight), "Back"))
            {
                currentWidnow = MainMenuWindow.MMWMain;
            }
            GUI.EndGroup();
        }