public ProgressWheel(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle)
        {
            ProgressMax  = 60;
            CircleRadius = 120;
            BarLength    = 60;
            BarWidth     = 4;
            RimWidth     = 4;
            TextSize     = 20;

            //Padding (with defaults)
            WheelPaddingTop    = 5;
            WheelPaddingBottom = 5;
            WheelPaddingLeft   = 5;
            WheelPaddingRight  = 5;

            //Colors (with defaults)
            BarColor    = Color.White;
            CircleColor = Color.Transparent;
            RimColor    = Color.Gray;
            TextColor   = Color.White;

            //Animation
            //The amount of pixels to move the bar by on each draw
            SpinSpeed = 2;
            //The number of milliseconds to wait inbetween each draw
            DelayMillis = 0;

            spinHandler = new SpinHandler(msg => {
                Invalidate();

                if (isSpinning)
                {
                    progress += SpinSpeed;
                    if (progress > 360)
                    {
                        progress = 0;
                    }

                    spinHandler.SendEmptyMessageDelayed(0, DelayMillis);
                }
            });


            //ParseAttributes(context.ObtainStyledAttributes(attrs, null)); //TODO: swap null for R.styleable.ProgressWheel
        }
		public ProgressWheel (Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle)
		{
			ProgressMax = 60;
			CircleRadius = 120;
			BarLength = 60;
			BarWidth = 4;
			RimWidth = 4;
			TextSize = 20;

			//Padding (with defaults)
			WheelPaddingTop = 5;
			WheelPaddingBottom = 5;
			WheelPaddingLeft = 5;
			WheelPaddingRight = 5;

			//Colors (with defaults)
			BarColor = Color.White;
			CircleColor = Color.Transparent;
			RimColor = Color.Gray;
			TextColor = Color.White;

			//Animation
			//The amount of pixels to move the bar by on each draw
			SpinSpeed = 2;
			//The number of milliseconds to wait inbetween each draw
			DelayMillis = 0;

			spinHandler = new SpinHandler(msg => {
				Invalidate ();

				if (isSpinning)
				{
					progress += SpinSpeed;
					if (progress > 360)
						progress = 0;

					spinHandler.SendEmptyMessageDelayed (0, DelayMillis);
				}
			});


			//ParseAttributes(context.ObtainStyledAttributes(attrs, null)); //TODO: swap null for R.styleable.ProgressWheel
		}
示例#3
0
    override public void Init()
    {
        BridgeDebugger.Log("[ Player - Init ]");
        base.Init();

        _cards = new List <Card>();

        spinHandler = gameObject.AddComponent <SpinHandler>();
        spinHandler.Init();
        spinHandler.OnSpinCompleteCallback = OnSpinComplete;

        if (spinBtn != null)
        {
            spinBtn.onClick.AddListener(OnSpin);
        }
        if (shoutBtn != null)
        {
            shoutBtn.onClick.AddListener(OnShout);
        }

        spinBtn.enabled = false;
    }