示例#1
0
        /// <summary>
        /// Test the random number generation
        /// </summary>
        [Test] public void Test01_Random()
        {
            try
            {
                int    rannum;
                string strrndnum;
                int    lopcnt;
                int    lopcnt1;
                bool   usebase10;

                usebase10 = false;
                for (lopcnt1 = 0; lopcnt1 < 10; lopcnt1++)
                {
                    for (lopcnt = 1; lopcnt < 7; lopcnt++)
                    {
                        rnd.SetMaxLength(lopcnt);

                        rannum    = rnd.GetRandomNumber();
                        strrndnum = NumberDisplay.CreateNumberString((uint)rannum, lopcnt, usebase10);
                        if (strrndnum.Length != lopcnt)
                        {
                            throw new Exception("Strings not the correct length");
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message);
            }
        }
示例#2
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="screen"></param>
        /// <param name="size"></param>
        /// <param name="minValue"></param>
        /// <param name="maxValue"></param>
        /// <param name="defaultValue"></param>
        /// <param name="inactiveColor"></param>
        /// <param name="activeColor"></param>
        public SongTimeProgressBar(GameplayScreen screen, Vector2 size, double minValue, double maxValue, double defaultValue, Color inactiveColor, Color activeColor)
            : base(size, minValue, maxValue, defaultValue, inactiveColor, activeColor)
        {
            Screen = screen;

            var skin = SkinManager.Skin.Keys[screen.Map.Mode];

            if (ConfigManager.DisplaySongTimeProgressNumbers.Value)
            {
                CurrentTime = new NumberDisplay(NumberDisplayType.SongTime, "00:00", new Vector2(skin.SongTimeProgressScale / 100f,
                                                                                                 skin.SongTimeProgressScale / 100f), 10)
                {
                    Parent    = this,
                    Alignment = Alignment.TopLeft,
                    Y         = -Height - 25,
                };

                var startText = (new DateTime(1970, 1, 1) + TimeSpan.FromMilliseconds((int)Bindable.MaxValue)).ToString("mm:ss");
                TimeLeft = new NumberDisplay(NumberDisplayType.SongTime, "-" + startText, new Vector2(skin.SongTimeProgressScale / 100f,
                                                                                                      skin.SongTimeProgressScale / 100f), -10)
                {
                    Parent    = this,
                    Alignment = Alignment.TopRight,
                    Y         = CurrentTime.Y
                };
            }
        }
示例#3
0
 /// <summary>
 ///     Creates the score display sprite.
 /// </summary>
 private void CreateScoreDisplay() => ScoreDisplay = new NumberDisplay(NumberDisplayType.Score, StringHelper.ScoreToString(0),
                                                                       new Vector2(0.45f, 0.45f))
 {
     Parent    = Container,
     Alignment = Alignment.TopLeft,
     X         = SkinManager.Skin.Keys[Screen.Map.Mode].ScoreDisplayPosX,
     Y         = SkinManager.Skin.Keys[Screen.Map.Mode].ScoreDisplayPosY
 };
示例#4
0
文件: Player.cs 项目: BasicLich/Hooks
 void Start()
 {
     Keys = 0;
     if (this.keyDisplay == null && GameObject.FindGameObjectWithTag("KeyCount") != null)
     {
         this.keyDisplay = GameObject.FindGameObjectWithTag("KeyCount").GetComponent <NumberDisplay>();
     }
 }
示例#5
0
    private void Start()
    {
        numberDisplay = GetComponentInChildren <NumberDisplay>();
        numberDisplay.InitNumberDisplay(stepsRemaining);

        levelManager = FindObjectOfType <LevelManager>();

        transform.position = levelManager.LevelStartLocation;
    }
示例#6
0
    private void Start()
    {
        numberDisplay = GetComponentInChildren <NumberDisplay>();
        numberDisplay.InitNumberDisplay(stepsValue);

        SetSprite();
        TorchPointLocation = transform.position;
        FindObjectOfType <LevelManager>().UpdateTorchPoints(this);
    }
示例#7
0
        /// <summary>
        ///     Creates the accuracy display sprite.
        /// </summary>
        private void CreateAccuracyDisplay()
        {
            var skin = SkinManager.Skin.Keys[Screen.Map.Mode];

            AccuracyDisplay = new NumberDisplay(NumberDisplayType.Accuracy, StringHelper.AccuracyToString(0),
                                                new Vector2(skin.AccuracyDisplayScale / 100f, skin.AccuracyDisplayScale / 100f), SkinManager.Skin.Keys[Screen.Map.Mode].AccuracyDisplayPosX)
            {
                Parent    = Container,
                Alignment = Alignment.TopRight,
            };
        }
示例#8
0
        /// <summary>
        ///     Creates the accuracy display sprite.
        /// </summary>
        private void CreateAccuracyDisplay()
        {
            AccuracyDisplay = new NumberDisplay(NumberDisplayType.Accuracy, StringHelper.AccuracyToString(0), new Vector2(0.45f, 0.45f))
            {
                Parent    = Container,
                Alignment = Alignment.TopRight,
            };

            // Set the position of the accuracy display.
            AccuracyDisplay.X = -AccuracyDisplay.TotalWidth + SkinManager.Skin.Keys[Screen.Map.Mode].AccuracyDisplayPosX;
            AccuracyDisplay.Y = SkinManager.Skin.Keys[Screen.Map.Mode].AccuracyDisplayPosY;
        }
示例#9
0
        /// <summary>
        ///     Creates the score display sprite.
        /// </summary>
        private void CreateScoreDisplay()
        {
            var skin = SkinManager.Skin.Keys[Screen.Map.Mode];

            ScoreDisplay = new NumberDisplay(NumberDisplayType.Score, StringHelper.ScoreToString(0),
                                             new Vector2(skin.ScoreDisplayScale / 100f, skin.ScoreDisplayScale / 100f), SkinManager.Skin.Keys[Screen.Map.Mode].ScoreDisplayPosX)
            {
                Parent    = Container,
                Alignment = Alignment.TopLeft,
                Y         = SkinManager.Skin.Keys[Screen.Map.Mode].ScoreDisplayPosY
            };
        }
示例#10
0
        /// <summary>
        ///     Creates the rating display sprite.
        /// </summary>
        private void CreateRatingDisplay()
        {
            var skin = SkinManager.Skin.Keys[Screen.Map.Mode];

            RatingDisplay = new NumberDisplay(NumberDisplayType.Rating, StringHelper.RatingToString(0),
                                              new Vector2(skin.RatingDisplayScale / 100f, skin.RatingDisplayScale / 100f))
            {
                Parent    = Container,
                Alignment = Alignment.TopLeft,
                X         = SkinManager.Skin.Keys[Screen.Map.Mode].RatingDisplayPosX,
                Y         = 40 + SkinManager.Skin.Keys[Screen.Map.Mode].RatingDisplayPosY
            };
        }
示例#11
0
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            int  rannum;
            int  length;
            bool useBase10;

            // determine the base that we want to work in.
            if (rdobtn10.Checked)
            {
                useBase10 = true;
            }
            else
            {
                useBase10 = false;
            }

            if (txtRanlen.Text.Length == 0)
            {
                MessageBox.Show("Please Enter a valid Number", "Layout");
                txtRanlen.Focus();
                return;
            }

            try
            {
                length = Convert.ToInt32(txtRanlen.Text);
                rnd.SetMaxLength(length);
            }
            catch
            {
                MessageBox.Show("Please Enter a valid Number", "Layout");
                txtRanlen.Focus();
                return;
            }

            // get the random number
            rannum = rnd.GetRandomNumber();

            if (rdobtn10.Checked)
            {
                txtRanNumber.Text = rannum.ToString("D");
            }
            else
            {
                txtRanNumber.Text = rannum.ToString("X");
            }
            txtRanNumStr.Text = NumberDisplay.CreateNumberString((uint)rannum, length, useBase10);
        }
        /// <summary>
        ///     Creates the combo display sprite.
        /// </summary>
        private void CreateComboDisplay()
        {
            // Create the combo display.
            ComboDisplay = new NumberDisplay(NumberDisplayType.Combo, "0", new Vector2(1, 1))
            {
                Parent    = Playfield.ForegroundContainer,
                Alignment = Alignment.MidCenter,
                Y         = Skin.ComboPosY
            };

            OriginalComboDisplayY = ComboDisplay.Y;
            ComboDisplay.X        = -ComboDisplay.TotalWidth / 2f;

            // Start off the map by making the display invisible.
            ComboDisplay.MakeInvisible();
        }
示例#13
0
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            Checksum chk;
            string   istr;
            int      slen;
            uint     csum;
            bool     useBase10;
            int      numberLength;

            chk = new Checksum();
            // check the length
            if (txtLength.Text.Length == 0)
            {
                MessageBox.Show("Enter a valid length", "Checksum");
                txtLength.Focus();
                return;
            }
            slen = Convert.ToInt32(txtLength.Text);

            // see what base we are to use
            if (rdobtn10.Checked)
            {
                useBase10 = true;
            }
            else
            {
                useBase10 = false;
            }

            //
            // See what type of checksum is requested.
            //
            if (rdoBtnChksum1.Checked)
            {
                chk.ChecksumAlgorithm = Checksum.ChecksumType.Type1;
            }
            if (rdoBtnChksum2.Checked)
            {
                chk.ChecksumAlgorithm = Checksum.ChecksumType.Type2;
            }

            istr         = txtInput.Text;
            numberLength = Convert.ToInt32(txtLength.Text);
            chk.CalculateChecksum(istr);
            csum           = chk.ChecksumNumber;
            txtchksum.Text = NumberDisplay.CreateNumberString(csum, numberLength, useBase10);
        }
示例#14
0
        /// <summary>
        ///     Creates the combo display sprite.
        /// </summary>
        private void CreateComboDisplay()
        {
            var skin = SkinManager.Skin.Keys[Screen.Map.Mode];

            // Create the combo display.
            ComboDisplay = new NumberDisplay(NumberDisplayType.Combo, "0", new Vector2(skin.ComboDisplayScale / 100f, skin.ComboDisplayScale / 100f), 0)
            {
                Parent    = Playfield.ForegroundContainer,
                Alignment = Alignment.MidCenter,
                Y         = Skin.ComboPosY
            };

            OriginalComboDisplayY = ComboDisplay.Y;

            // Start off the map by making the display invisible.
            ComboDisplay.MakeInvisible();
        }
示例#15
0
    public override void Init(UIScheme.InnerContainer container)
    {
        base.Init(container);

        mScheme = (NumberDisplay)mContainer.Scheme;

        gameObject.name         = "Scheme: " + mContainer.InnerBuildInfo.BuildString.Name;
        transform.localPosition = mContainer.InnerBuildInfo.Position.ToVector3();
        (transform as RectTransform).sizeDelta = mContainer.InnerBuildInfo.Size;
        mName.text = mContainer.InnerBuildInfo.BuildString.Name;
        mType.text = mContainer.InnerBuildInfo.BuildString.Type;

        mRemoveButton.onClick.AddListener(() => SchemeDesigner.Instance.RemoveInnerScheme(mContainer));

        var inputCount = mContainer.Scheme.IOGroups.Count((x) => x.Value.IO == IO.Input);

        mInputDesigns   = new List <IOInnerGroupDesign>(inputCount);
        mIOGroupDesigns = new Dictionary <string, IOInnerGroupDesign>(inputCount);

        foreach (var ioGroup in mContainer.Scheme.IOGroups)
        {
            IOInnerGroupDesign design = null;
            switch (ioGroup.Value.IO)
            {
            case IO.Input:
                design = Instantiate(mInputIOGroupPrefab, mInputs).GetComponent <IOInnerGroupDesign>();
                mInputDesigns.Add(design);
                mIOGroupDesigns.Add(ioGroup.Key, design);
                break;
            }
            design.Init(ioGroup.Key, ioGroup.Value, mContainer.Scheme);
        }

        SchemeDesigner.Instance.AddLinkStateChanged += OnAddLinkStateChanged;

        if (inputCount > 0)
        {
            //mAddInputLink.gameObject.SetActive(true);
            mAddInputLink.onClick.AddListener(() => SchemeDesigner.Instance.AddLinkAsTarget(mContainer));
        }

        mContainer.Scheme.IOGroups[NumberDisplay.Input].IOChanged += OnInputChanged;
    }
示例#16
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="size"></param>
        /// <param name="minValue"></param>
        /// <param name="maxValue"></param>
        /// <param name="defaultValue"></param>
        /// <param name="inactiveColor"></param>
        /// <param name="activeColor"></param>
        public SongTimeProgressBar(Vector2 size, double minValue, double maxValue, double defaultValue, Color inactiveColor, Color activeColor)
            : base(size, minValue, maxValue, defaultValue, inactiveColor, activeColor)
        {
            CurrentTime = new NumberDisplay(NumberDisplayType.SongTime, "00:00", new Vector2(0.6f, 0.6f))
            {
                Parent    = this,
                Alignment = Alignment.TopLeft,
                Y         = -Height - 25,
                X         = 10
            };

            TimeLeft = new NumberDisplay(NumberDisplayType.SongTime, "-00:00", new Vector2(0.6f, 0.6f))
            {
                Parent    = this,
                Alignment = Alignment.TopRight,
                Y         = CurrentTime.Y
            };

            TimeLeft.X = -TimeLeft.TotalWidth - 10;
        }
示例#17
0
文件: Mod.cs 项目: yazici/FRONTIERS
    public void Start()
    {
        GameObject go = GameObject.Find("Main Camera");

        numberDisplay = go.GetComponent <NumberDisplay> ();
    }