Пример #1
0
    public void UpdateShipControl()
    {
        Button ControlBtn;

        if (SceneHandler.GetInstance().Settings.GetGameController() == "tap")
        {
            ButtonControl.SetActive(false);
            ControlBtn = ButtonControl.GetComponentInChildren <Button>();
            ShipController.Instance.GameControl = "tap";
            ControlBtn.GetComponentInChildren <Button>().enabled = false;
            ControlBtn.interactable = false;
        }
        else
        {
            ButtonControl.SetActive(true);
            ControlBtn              = ButtonControl.GetComponentInChildren <Button>();
            ControlBtn.enabled      = true;
            ControlBtn.interactable = true;
            if (SceneHandler.GetInstance().Settings.GetButtonPosition() == "right")
            {
                //right
                ControlBtn.GetComponent <RectTransform>().localPosition = new Vector3(520, ControlBtn.GetComponent <RectTransform>().localPosition.y, 0);
            }
            else
            {
                //left
                ControlBtn.GetComponent <RectTransform>().localPosition = new Vector3(-520, ControlBtn.GetComponent <RectTransform>().localPosition.y, 0);
            }
        }
    }
        private void NewCallAnimationWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            _timer = new System.Threading.Timer(s =>
            {
                ControlBtn.Dispatcher.BeginInvoke(new Action(() =>
                {
                    ControlBtn.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                }));

                _timer.Change(TimeSpan.FromSeconds(_random.Next(10, 21)), Timeout.InfiniteTimeSpan);
            }, null, TimeSpan.FromSeconds(_random.Next(10, 21)), Timeout.InfiniteTimeSpan);
        }
        public Dashboard()
        {
            InitializeComponent();

            cbb_period_edit_period.Hide();
            m_control = ControlBtn.CONTROL_ADD;

            string _roles = Params.CURRENT_SESSION[Params.CURRENT_ROLES].ToString();

            m_roles = Convert.ToInt32(_roles);

            InitializeAccount();
        }
        ////////////////////////////////////////////////////////////////////
        // Control for edit period
        /// <summary>
        ///
        /// </summary>
        private void btn_add_edit_period_Click(object sender, EventArgs e)
        {
            cbb_period_edit_period.Hide();

            lbl_id_edit_period.Show();
            txt_name_edit_period.Show();

            txt_rate_edit_period.Show();
            txt_period_edit_period.Show();

            lbl_id_edit_period.Text = "ID";
            txt_name_edit_period.Clear();
            txt_rate_edit_period.Clear();
            txt_period_edit_period.Clear();

            m_control = ControlBtn.CONTROL_ADD;
        }
        private void btn_remove_edit_period_Click(object sender, EventArgs e)
        {
            cbb_period_edit_period.Show();

            lbl_id_edit_period.Hide();
            txt_name_edit_period.Hide();

            txt_rate_edit_period.Hide();
            txt_period_edit_period.Hide();

            GetPeriod();

            cbb_period_edit_period.Text = "";
            lbl_id_edit_period.Text     = "ID";
            txt_name_edit_period.Clear();
            txt_rate_edit_period.Clear();
            txt_period_edit_period.Clear();

            m_control = ControlBtn.CONTROL_REMOVE;
        }