Пример #1
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            var          surface      = new CircleSurface(conformant);
            CircleSlider circleSlider = new CircleSlider(conformant, surface)
            {
                AlignmentX            = -1,
                AlignmentY            = -1,
                WeightX               = 1,
                WeightY               = 1,
                Minimum               = 0,
                Maximum               = 15,
                BarColor              = Color.Purple,
                BackgroundColor       = Color.Red,
                BarRadius             = 160,
                BackgroundRadius      = 160,
                BarLineWidth          = 15,
                BackgroundLineWidth   = 15,
                BackgroundAngleOffset = 90,
                BackgroundAngle       = 270,
                BarAngleOffset        = 90.0,
                BarAngleMinimum       = 0.0,
                BarAngleMaximum       = 270.0,
                Value = 3,
                Step  = 0.5,
            };

            ((IRotaryActionWidget)circleSlider).Activate();
            circleSlider.Show();
            conformant.SetContent(circleSlider);
            Label label1 = new Label(window)
            {
                Text  = string.Format("{0:F1}", circleSlider.Value),
                Color = Color.White,
            };

            label1.Resize(window.ScreenSize.Width, window.ScreenSize.Height);
            label1.Move(170, window.ScreenSize.Height / 2 - 30);
            label1.Show();

            Label label2 = new Label(window)
            {
                Text  = string.Format("min:{0},max{1}", circleSlider.Minimum, circleSlider.Maximum),
                Color = Color.White,
            };

            label2.Resize(window.ScreenSize.Width, window.ScreenSize.Height);
            label2.Move(110, window.ScreenSize.Height / 2 + 10);
            label2.Show();

            Log.Debug(TestName, "CircleSliderTest2 step:" + circleSlider.Step);

            circleSlider.ValueChanged += (s, e) =>
            {
                label1.Text = string.Format("{0:F1}", circleSlider.Value);
            };
        }
 void Start()
 {
     statistics         = GameObject.FindGameObjectWithTag("Statistics").GetComponent <Statistics>();
     text               = GetComponentInChildren <Text>();
     slider             = GetComponentInChildren <CircleSlider>();
     text.text          = string.Format("{0}%", (int)(GetStatisticsFloat() * 100));
     slider.MaxValue    = 1;
     slider.SliderValue = GetStatisticsFloat();
 }
    void Start()
    {
        GameStartEvent.Register(onGameStart);
        CheckpointReachedEvent.Register(onCheckpointReached);
        statistics = GameObject.FindGameObjectWithTag("Statistics").GetComponent <Statistics>();

        slider = GetComponentInChildren <CircleSlider>();
        text   = GetComponentInChildren <Text>();
    }
Пример #4
0
    // Use this for initialization
    void Start()
    {
        GameStartEvent.Register(onGameStart);
        PickUpEvent.Register(onCollectableGathered);
        PlayerRespawnEvent.Register(onPlayerRespawn);

        statistics = GameObject.FindGameObjectWithTag("Statistics").GetComponent <Statistics>();

        slider = GetComponentInChildren <CircleSlider>();
        text   = GetComponentInChildren <Text>();
    }
Пример #5
0
 public override void CreateMeterUI(List <MeterObj> meterObjs)
 {
     foreach (var v in meterSliders)
     {
         Destroy(v.gameObject);
     }
     meterSliders = new List <CircleSlider>();
     for (int i = 0; i < meterObjs.Count; i++)
     {
         CircleSlider tmpSli = Instantiate(MeterPrefab, meterRoot);
         tmpSli.name = meterObjs[i].CurrentValueKey;
         meterObjs[i].SetSliderObj(tmpSli);
         meterSliders.Add(tmpSli);
     }
 }
Пример #6
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Naviframe naviframe = new Naviframe(window);

            naviframe.Show();
            conformant.SetContent(naviframe);

            var          surface      = new CircleSurface(conformant);
            CircleSlider circleSlider = new CircleSlider(naviframe, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                Minimum    = 0,
                Maximum    = 20,
                Value      = 5,
                Step       = 0.5,
            };

            ((IRotaryActionWidget)circleSlider).Activate();
            circleSlider.Show();
            naviframe.Push(circleSlider, null, "empty");

            Label label1 = new Label(window)
            {
                Text  = string.Format("{0:F1}", circleSlider.Value),
                Color = Color.White,
            };

            label1.Resize(window.ScreenSize.Width, window.ScreenSize.Height);
            label1.Move(170, window.ScreenSize.Height / 2 - 20);
            label1.Show();

            circleSlider.ValueChanged += (s, e) =>
            {
                label1.Text = string.Format("{0:F1}", circleSlider.Value);
            };
        }
Пример #7
0
 /// <summary>
 /// 生成時に実行
 /// </summary>
 private void Awake()
 {
     circle      = GetComponentInChildren <CircleSlider>();
     healthCount = GetComponentInChildren <Text>();
 }
Пример #8
0
 public void SetSliderObj(CircleSlider sliderObj)
 {
     curSliderObj = sliderObj;
 }
        private void InitControls()
        {
            int tableRow    = 0;
            int tableColumn = 0;

            /***
             * FontAlignmentTestWidget test = new FontAlignmentTestWidget ();
             * this.AddChild (test, tableRow++, tableColumn);
             ***/

            m_Label1 = new CaptionLabel("label1");
            //m_Label1.Styles.GetStyle (WidgetStates.Default).BackColorBrush.Color = SolarizedColors.Base2;
            m_Label1.Style.BackColorBrush.Color = Theme.Colors.Base2;
            m_Label1.Dock = Docking.Fill;
            m_Label1.Text = "Check Boxes".ToUpper();
            this.AddChild(m_Label1, tableRow++, tableColumn);

            m_CheckBox1 = new CheckBox("checkbox1", "CheckBox 1");
            this.AddChild(m_CheckBox1, tableRow++, tableColumn);

            m_CheckBox3         = new CheckBox("checkbox3", "CheckBox 3 (disabled)");
            m_CheckBox3.Enabled = false;
            this.AddChild(m_CheckBox3, tableRow++, tableColumn);

            m_ToggleCheckBox         = new ToggleCheckBox("togglecheckbox", "Option 1");
            m_ToggleCheckBox.Checked = true;
            this.AddChild(m_ToggleCheckBox, tableRow++, tableColumn);

            m_Label2 = new CaptionLabel("label2");
            m_Label2.Style.BackColorBrush.Color = Theme.Colors.Base2;
            m_Label2.Dock = Docking.Fill;
            m_Label2.Text = "Radio Buttons".ToUpper();
            this.AddChild(m_Label2, tableRow++, tableColumn);

            m_RadioButton1         = new RadioButton("radiobutton1", "RadioButton 1");
            m_RadioButton1.Checked = true;
            this.AddChild(m_RadioButton1, tableRow++, tableColumn);

            m_RadioButton2 = new RadioButton("radiobutton2", "RadioButton 2");
            this.AddChild(m_RadioButton2, tableRow++, tableColumn);

            m_RadioButton3 = new RadioButton("radiobutton3", "RadioButton 3");
            this.AddChild(m_RadioButton3, tableRow++, tableColumn);

            m_Label3 = new CaptionLabel("label3");
            m_Label3.Style.BackColorBrush.Color = Theme.Colors.Base2;
            m_Label3.Dock = Docking.Fill;
            m_Label3.Text = "Progress Bars".ToUpper();
            this.AddChild(m_Label3, tableRow++, tableColumn);

            m_ProgressBar         = new ProgressBar("ProgressBar1");
            m_ProgressBar.Value   = 0.625f;
            m_ProgressBar.Tooltip = "Click to animate..";
            m_ProgressBar.Click  += delegate {
                ParentWindow.Animator.AddAnimation(m_ProgressBar, "Value", 0, 1, 5);
            };
            m_ProgressBar.AnimationCompleted += delegate {
                m_ProgressBar.Value = 0.625f;
                (ParentWindow as ApplicationWindow).ShowNotification("Progressbar animation completed, state was reset to it's former value.", ColorContexts.Information);
            };
            this.AddChild(m_ProgressBar, tableRow++, tableColumn);


            /*** ***/
            // Circle Sliders in a Sub-Container
            m_CircleSliderSubContainer        = new TableLayoutContainer("m_CircleSliderSubContainer");
            m_CircleSliderSubContainer.Margin = new Padding(0, 0, 0, 16);

            m_CircleSlider1         = new CircleSlider("CircleSlider1", ColorContexts.Information);
            m_CircleSlider1.Value   = 0.75f;
            m_CircleSlider1.Tooltip = "Click to animate..";
            m_CircleSliderSubContainer.AddChild(m_CircleSlider1, 0, 0);
            m_CircleSlider1.Click += delegate {
                ParentWindow.Animator.AddAnimation(m_CircleSlider1, "Value", 0, 1, 5);
            };
            m_CircleSlider1.AnimationCompleted += delegate {
                m_CircleSlider1.Value = 0.75f;
                (ParentWindow as ApplicationWindow).ShowNotification("The animation was successfully completed.", ColorContexts.Success);
            };

            m_CircleSlider2             = new CircleSlider("CircleSlider1", ColorContexts.Information);
            m_CircleSlider2.Value       = 0.333f;
            m_CircleSlider2.CustomColor = Theme.Colors.Magenta;
            m_CircleSlider2.Tooltip     = "Drag up and down\nto change the value.";
            m_CircleSliderSubContainer.AddChild(m_CircleSlider2, 0, 1);

            this.AddChild(m_CircleSliderSubContainer, tableRow++, tableColumn);


            // >>> New Column >>>

            tableRow    = 0;
            tableColumn = 1;

            cmdDefaultButton        = new Button("cmdDefaultButton", "Default Button", ColorContexts.Default);
            cmdDefaultButton.Click += delegate {
                ParentWindow.ShowInfo("You pressed the default button. Great.");
            };
            this.AddChild(cmdDefaultButton, tableRow++, tableColumn);

            cmdShowInfo        = new Button("cmdShowInfo", "Info MessageBox", (char)FontAwesomeIcons.fa_info_circle, ColorContexts.Information);
            cmdShowInfo.Click += delegate {
                ParentWindow.ShowInfo("This is an info.");
            };
            this.AddChild(cmdShowInfo, tableRow++, tableColumn);

            cmdShowWarning        = new Button("cmdShowWarning", "Warning MessageBox", ColorContexts.Warning);
            cmdShowWarning.Click += delegate {
                ParentWindow.ShowWarning("This is a warning.");
            };
            this.AddChild(cmdShowWarning, tableRow++, tableColumn);

            cmdShowError        = new Button("cmdShowError", "Error MessageBox", ColorContexts.Danger);
            cmdShowError.Click += delegate {
                try {
                    throw new Exception("This is a sample error.");
                } catch (Exception ex) {
                    string errMsg = ex.Message + "\n" + Concurrency.GetStackTrace();
                    ParentWindow.ShowError(errMsg);
                }
            };
            this.AddChild(cmdShowError, tableRow++, tableColumn);

            cmdShowQuestion        = new Button("cmdShowQuestion", "Question MessageBox", ColorContexts.Question);
            cmdShowQuestion.Click += delegate {
                ParentWindow.ShowQuestion("This is a question. Are you sure ?");
            };
            this.AddChild(cmdShowQuestion, tableRow++, tableColumn);

            m_TextBox1      = new TextBox("TextBox1");
            m_TextBox1.Text = "Abcd Efg Hijk";
            this.AddChild(m_TextBox1, tableRow++, tableColumn);

            m_ShowPasswordChar                 = new CheckBox("ShowPasswordChar", "Password visible");
            m_ShowPasswordChar.Checked         = true;
            m_ShowPasswordChar.CheckedChanged += (object sender, EventArgs eCheckedChanged) =>
                                                 m_TextBox1.PasswordChar = m_ShowPasswordChar.Checked ? (char)0 : TextBox.DefaultPasswortChar;
            this.AddChild(m_ShowPasswordChar, tableRow++, tableColumn);

            m_NumberTextBox1       = new NumberTextBox("NumberTextBox1");
            m_NumberTextBox1.Value = 123.45m;
            this.AddChild(m_NumberTextBox1, tableRow++, tableColumn);

            m_ButtonTextBox1 = new ButtonTextBox("ButtonTextBox1", (char)FontAwesomeIcons.fa_send);
            m_ButtonTextBox1.Button.Click += delegate {
                (ParentWindow as ApplicationWindow).ShowNotification("Your email has been sent.", ColorContexts.Success);
            };
            this.AddChild(m_ButtonTextBox1, tableRow++, tableColumn);

            m_ComboListBox1 = new ComboListBox("ComboListBox1");
            m_ComboListBox1.Items.Add("Apple", 1);
            m_ComboListBox1.Items.Add("Orange", 2);
            m_ComboListBox1.Items.Add("Banana", 3);
            m_ComboListBox1.Items.Add("Cherry", 4);
            m_ComboListBox1.Items.Add("Pineapple", 5);
            m_ComboListBox1.SelectedIndex = 0;
            this.AddChild(m_ComboListBox1, tableRow++, tableColumn);

            m_ComboBox1 = new ComboBox("ComboBox1");
            m_ComboBox1.Items.Add("Apple", 1);
            m_ComboBox1.Items.Add("Orange", 2);
            m_ComboBox1.Items.Add("Banana", 3);
            m_ComboBox1.Items.Add("Cherry", 4);
            m_ComboBox1.Items.Add("Pineapple", 5);
            m_ComboBox1.SelectedIndex = 0;
            this.AddChild(m_ComboBox1, tableRow++, tableColumn);
        }
 void Awake()
 {
     circleSlider          = GetComponentInChildren <CircleSlider>();
     circleSlider.MaxValue = 1;
 }