示例#1
0
    void readyOrNot()
    {
        ExitGames.Client.Photon.Hashtable intialProps =
            new ExitGames.Client.Photon.Hashtable()
        {
            { "isPlayerReady", isPlayerReady }
        };
        PhotonNetwork.LocalPlayer.SetCustomProperties(intialProps);


        PlayerReadyButton.onClick.AddListener(() =>
        {
            isPlayerReady = !isPlayerReady;        //change false to true and vice-versa
            DisplayReadyorNotinplayerListPrefab(); //right down button text change


            ExitGames.Client.Photon.Hashtable newProps =
                new ExitGames.Client.Photon.Hashtable()
            {
                { "isPlayerReady", isPlayerReady }
            };
            PhotonNetwork.LocalPlayer.SetCustomProperties(newProps);

            SettingButton.SetActive(!isPlayerReady);
        }
                                              );
    }
示例#2
0
    public void OnOKButtonInsideSettingClicked()
    {
        ExitGames.Client.Photon.Hashtable finalteamType =
            new ExitGames.Client.Photon.Hashtable()
        {
            { "teamType", teamSelectionNumber }
        };
        PhotonNetwork.LocalPlayer.SetCustomProperties(finalteamType);

        leftTeamButton.SetActive(false);     //leftcolorbutton on
        rightTeamButton.SetActive(false);    //right color button on
        TeamColors.SetActive(false);
        InsideSettingOKButton.SetActive(false);

        if (PhotonNetwork.LocalPlayer.IsMasterClient)  //start game button off
        {
            StartGameButton.SetActive(true);
            TimeLeftButton.SetActive(false);
            TimeRightButton.SetActive(false);
            TotalTime.SetActive(false);
        }

        PlayerReadyButton.gameObject.SetActive(true); // ready button of
        SettingButton.SetActive(true);                // setting button itself off
    }
示例#3
0
    public void OnSettingButtonClicked()
    {
        ExitGames.Client.Photon.Hashtable intialteamType =
            new ExitGames.Client.Photon.Hashtable()
        {
            { "teamType", teamSelectionNumber }
        };
        PhotonNetwork.LocalPlayer.SetCustomProperties(intialteamType);


        leftTeamButton.SetActive(true);     //leftcolorbutton on
        rightTeamButton.SetActive(true);    //right color button on
        TeamColors.SetActive(true);
        InsideSettingOKButton.SetActive(true);

        if (PhotonNetwork.LocalPlayer.IsMasterClient)  //start game button off
        {
            StartGameButton.SetActive(false);
            TimeLeftButton.SetActive(true);
            TimeRightButton.SetActive(true);
            TotalTime.SetActive(true);
            object gameTime;
            if (PhotonNetwork.CurrentRoom.CustomProperties.TryGetValue("gt", out gameTime))
            {
                TotalTime.GetComponent <TextMeshProUGUI>().text = gameTime.ToString() + " MIN";
            }
        }

        PlayerReadyButton.gameObject.SetActive(false); // ready button of
        SettingButton.SetActive(false);                // setting button itself off
    }
    void _ui()
    {
        // topImage
        float top_image_height = (float)(55.5 / 667.0) * Display.main.systemHeight;

        TopImage.rectTransform.sizeDelta = new Vector2(Display.main.systemWidth, top_image_height);
        // logoImage
        float logoImage_posx = (float)(24.5 / 375.0) * Display.main.systemWidth,
              logoImage_posy = -(float)(13 / 667.0) * Display.main.systemHeight,
              logo_width     = (float)(22.5 / 375.0) * Display.main.systemWidth,
              logo_height    = (float)(579 / 453.0) * logo_width;

        LogoImage.rectTransform.sizeDelta          = new Vector2(logo_width, logo_height);
        LogoImage.rectTransform.anchoredPosition3D = new Vector3(logoImage_posx, logoImage_posy, 0);
        // 设置按钮
        float set_button_posx  = -(float)(25 / 375.0) * Display.main.systemWidth,
              set_button_width = (float)(20.5 / 375.0) * Display.main.systemWidth;

        SettingButton.GetComponent <RectTransform>().sizeDelta          = new Vector2(set_button_width, set_button_width);
        SettingButton.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(set_button_posx, 0, 0);
        // 应用文本
        float app_posx   = (float)(34 / 375.0) * Display.main.systemWidth,
              app_width  = Display.main.systemWidth - app_posx - logoImage_posx + set_button_posx - set_button_width,
              app_height = (float)(14 / 667.0) * Display.main.systemHeight;

        AppNameText.rectTransform.sizeDelta          = new Vector2(app_width, app_height);
        AppNameText.rectTransform.anchoredPosition3D = new Vector3(app_posx, 0, 0);
        // 搜索按钮、扫一扫按钮
        float search_button_width = (float)(136 / 375.0) * Display.main.systemWidth,
              search_button_posy  = -(float)(163 / 667.0) * Display.main.systemHeight,
              scan_button_posy    = (float)(149.5 / 667.0) * Display.main.systemHeight;

        ArButton.GetComponent <RectTransform>().sizeDelta              = new Vector2(search_button_width, search_button_width);
        ArButton.GetComponent <RectTransform>().anchoredPosition3D     = new Vector3(0, scan_button_posy, 0);
        SearchButton.GetComponent <RectTransform>().sizeDelta          = new Vector2(search_button_width, search_button_width);
        SearchButton.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(0, search_button_posy, 0);
        // 公司文本
        float com_text_posy   = (float)(23 / 667.0) * Display.main.systemHeight,
              com_text_width  = (float)(128 / 375.0) * Display.main.systemWidth,
              com_text_height = (float)(12.5 / 128.0) * com_text_width;

        ComNameText.rectTransform.sizeDelta          = new Vector2(com_text_width, com_text_height);
        ComNameText.rectTransform.anchoredPosition3D = new Vector3(0, com_text_posy, 0);
        // 线
        float line_posx   = (float)(8.5 / 375.0) * Display.main.systemWidth,
              line_width  = (float)(49 / 375.0) * Display.main.systemWidth,
              line_height = Display.main.systemHeight > 667.0 ? (float)(0.5 / 667.0) * Display.main.systemHeight : 0.5f;

        LeftLineImage.rectTransform.sizeDelta           = new Vector2(line_width, line_height);
        LeftLineImage.rectTransform.anchoredPosition3D  = new Vector3(-line_posx, 0, 0);
        RightLineImage.rectTransform.sizeDelta          = new Vector2(line_width, line_height);
        RightLineImage.rectTransform.anchoredPosition3D = new Vector3(line_posx, 0, 0);
        // 隐藏界面
        SettingCanvas.SetActive(false);
        SearchCanvas.SetActive(false);
        DrugInfoCanvas.SetActive(false);
        UpdateCanvas.SetActive(false);
    }
        internal void Click_to_button(ButtonType _buttonName)
        {
            switch (_buttonName.ToString())
            {
            case "Setting":
                SettingButton.TouchNoScroll();
                break;

            case "Login":
                LoginButton.TouchNoScroll();
                break;

            case "Sync":
                SyncButton.TouchNoScroll();
                break;

            case "Done":
                DoneButton.TouchNoScroll();
                break;
            }
        }
示例#6
0
 public static bool IsButton(MapType type)
 => SettingButton.Contains(type);
示例#7
0
        public MainForm()
        {
            InitializeComponent();

            Load += async(s, e) =>
            {
                if (GetRegistry("autorun") == null)
                {
                    SetRegistry("autorun", "True");
                }

                if (GetRegistry("autorun") == "True")
                {
                    SettingsAutoRun.Checked = true;
                    String[] args = Environment.GetCommandLineArgs();

                    if (args.Length > 1)
                    {
                        if (args[1] == "/minimized")
                        {
                            // костыль ебаный!
                            await Task.Delay(10);

                            WindowState = FormWindowState.Minimized;
                            Hide();
                        }
                    }
                }
                else
                {
                    SettingsAutoRun.Checked = false;
                }
            };
            Resize += (s, e) =>
            {
                if (WindowState == FormWindowState.Minimized)
                {
                    Hide();
                    Tray.Visible = true;
                }
                else if (FormWindowState.Normal == WindowState)
                {
                    Tray.Visible = false;
                }
            };
            KeyDown += (s, e) =>
            {
                if (e.KeyCode == Keys.Escape && !SettingPanel.Visible)
                {
                    LocMessage.ForeColor = SystemColors.ControlDarkDark;
                    e.SuppressKeyPress   = true;
                    LocationInput.Text   = GetRegistry("location");
                    LocationInput.SelectAll();
                    LocationInput.Focus();
                }
            };

            TitleBar.MouseDown += (s, e) =>
            {
                TitleBar.Capture = false;
                Message m = Message.Create(Handle, 161, new IntPtr(2), IntPtr.Zero);
                WndProc(ref m);
            };
            MinimizeButton.Click  += (s, e) => { WindowState = FormWindowState.Minimized; };
            CloseButton.Click     += (s, e) => { Close(); };
            CloseButton.MouseMove += (s, e) =>
            {
                CloseButton.BackColor = Color.FromArgb(255, 38, 60);
                CloseButton.Image     = Properties.Resources.close_white;
            };
            CloseButton.MouseLeave += (s, e) =>
            {
                CloseButton.BackColor = SystemColors.Control;
                CloseButton.Image     = Properties.Resources.close_gray;
            };
            SettingButton.Click += (s, e) =>
            {
                if (AboutPanel.Visible)
                {
                    AboutPanel.Visible    = false;
                    AboutButton.BackColor = SystemColors.Control;
                }
                SettingPanel.Visible    = !SettingPanel.Visible;
                SettingButton.BackColor = SettingPanel.Visible ? SystemColors.ControlLight : SystemColors.Control;
            };
            AboutButton.Click += (s, e) =>
            {
                if (SettingPanel.Visible)
                {
                    SettingPanel.Visible    = false;
                    SettingButton.BackColor = SystemColors.Control;
                }
                AboutPanel.Visible    = !AboutPanel.Visible;
                AboutButton.BackColor = AboutPanel.Visible ? SystemColors.ControlLight : SystemColors.Control;
            };

            Tray.MouseClick += (s, e) =>
            {
                if (e.Button == MouseButtons.Left)
                {
                    Show();
                    Tray.Visible = false;
                    WindowState  = FormWindowState.Normal;
                    FadeInApp();
                }
            };
            TrayAboutButton.Click += (s, e) =>
            {
                Show();
                Tray.Visible = false;
                WindowState  = FormWindowState.Normal;
                FadeInApp();

                if (!AboutPanel.Visible)
                {
                    AboutButton.Focus();
                    SendKeys.Send(" ");
                }
            };
            TraySettingsButton.Click += (s, e) =>
            {
                Show();
                Tray.Visible = false;
                WindowState  = FormWindowState.Normal;
                FadeInApp();

                if (!SettingPanel.Visible)
                {
                    SettingButton.Focus();
                    SendKeys.Send(" ");
                }
            };
            TrayCloseButton.Click += (s, e) => { Close(); };

            LocationInput.Enter   += (s, e) => { isEntered = true; LocMessage.Text = "Нажмите Enter, чтобы сохранить."; };
            LocationInput.KeyDown += (s, e) => {
                if (e.KeyCode == Keys.Enter)
                {
                    ActiveControl      = null;
                    e.SuppressKeyPress = true;
                    GetWeather((s as TextBox).Text);
                }
            };
            LocationInput.KeyPress    += (s, e) => { RegExpLocationInput(s, e); };
            LocationInput.TextChanged += (s, e) =>
            {
                int i = LocationInput.TextLength;

                if (i >= 25)
                {
                    LocationInput.Font     = new Font("Segoe UI Semibold", 16.75F);
                    LocationInput.Location = new Point(11, 15);
                }
                else if (i >= 20)
                {
                    LocationInput.Location = new Point(11, 10);
                    LocationInput.Font     = new Font("Segoe UI Semibold", 18.75F);
                }
                else if (i >= 15)
                {
                    LocationInput.Location = new Point(11, 6);
                    LocationInput.Font     = new Font("Segoe UI Semibold", 20.75F);
                }
                else
                {
                    LocationInput.Location = new Point(11, 3);
                    LocationInput.Font     = new Font("Segoe UI Semibold", 27.75F);
                }
            };

            SettingsLocation.KeyPress += (s, e) => { RegExpLocationInput(s, e); };
            SettingsApiKey.Enter      += (s, e) => { SettingsApiKey.PasswordChar = '\0'; };
            SettingsApiKey.Leave      += (s, e) => { SettingsApiKey.PasswordChar = '●'; };
            SettingsApiKey.KeyPress   += (s, e) =>
            {
                char k = e.KeyChar;
                if (!char.IsControl(k) &&
                    !char.IsNumber(k) &&
                    (k <= 96 || k >= 193))
                {
                    e.Handled = true;
                }
            };
            SettingsRunPath.Text            = exPath;
            SettingsAutoRun.CheckedChanged += (s, e) =>
            {
                bool check = (s as CheckBox).Checked;

                if (check)
                {
                    SetRegistry("autorun", "True");
                    using (RegistryKey r = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true))
                        r.SetValue(appName, exPath + " /minimized");
                }
                else
                {
                    SetRegistry("autorun", "False");
                    using (RegistryKey r = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true))
                        r.DeleteValue(appName);
                }
            };
            SettingsInterval.KeyPress += (s, e) =>
            {
                char k = e.KeyChar;
                if (!char.IsControl(k) && !char.IsNumber(k))
                {
                    e.Handled = true;
                }
            };
            SettingsSaveButton.Click += (s, e) =>
            {
                var b = (s as Button);
                b.Enabled = false;
                if (SettingsInterval.Text != "0")
                {
                    SetRegistry("interval", SettingsInterval.Text);
                    Timer.Interval             = Convert.ToInt32(SettingsInterval.Text) * 60000;
                    SettingsInterval.ForeColor = SystemColors.ControlDarkDark;
                }
                else
                {
                    SettingsInterval.ForeColor = Color.Firebrick;
                }
                SetRegistry("api", SettingsApiKey.Text);
                GetWeather(SettingsLocation.Text);
                b.Enabled = true;
            };
            SettingsRestoreButton.Click += (s, e) =>
            {
                using (RegistryKey reg = Registry.CurrentUser.OpenSubKey(@"Software\" + appName))
                {
                    if (reg != null)
                    {
                        Registry.CurrentUser.DeleteSubKey(@"Software\" + appName);
                    }
                }

                using (RegistryKey run = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run"))
                {
                    if (run.GetValue(appName) != null)
                    {
                        run.DeleteValue(appName);
                    }
                    SetRegistry("autorun", "True");
                    SettingsAutoRun.Checked = true;
                }

                InitializeApp();
            };

            ReconnectButton.Click += (s, e) =>
            {
                ReconnectButton.Text    = "Подключаюсь...";
                ReconnectButton.Enabled = false;
                InitializeApp();
            };

            AboutAppName.Text        = appName;
            AboutAppVer.Text         = $"Версия {About.AssemblyVersion}";
            AboutAppDesc.Text        = About.AssemblyDescription;
            openGitHub.Click        += (s, e) => { Process.Start("https://github.com/crashmax-dev/WeatherCS"); };
            GetAPIButton.Click      += (s, e) => { Process.Start("https://openweathermap.org/appid"); };
            AboutCheckUpdates.Click += (s, e) =>
            {
                var b = (s as Button);
                b.Enabled = false;
                CheckForUpdates();
            };

            InitializeApp();
        }
示例#8
0
 public CustomShellPage()
 {
     InitializeComponent();
     TitleLabel.SetBinding(Label.TextProperty, new Binding(nameof(this.Title), source: this));
     SettingButton.SetBinding(Button.IsVisibleProperty, new Binding(nameof(IsSettingsButtonVisible), source: this));
 }
示例#9
0
 public void HoverSettingButon()
 {
     SettingButton.GetComponent <Image>().sprite = HighlightedSettingButton;
 }
示例#10
0
 public void BeNormalSettingButon()
 {
     SettingButton.GetComponent <Image>().sprite = NormalSettingButton;
 }
示例#11
0
 private void SettingButton_Click(object sender, EventArgs e)
 {
     frm2.Location = SettingButton.PointToScreen(new Point(Point.Empty.X - (int)(0.69 * frm2.Size.Width),
                                                           Point.Empty.Y - (int)(0.95 * frm2.Size.Height)));
     frm2.Show();
 }