Ejemplo n.º 1
0
 public bool UpdateBarrier(Barrier barrier)
 {
     var stock = QueryBarrier(barrier.Id);
     if (stock == null)
     {
         return false;
     }
     return Update(barrier) > 0;
 }
Ejemplo n.º 2
0
 public SelectedDialog(Context context, int theme, Barrier barrier)
     : base(context, theme)
 {
     this.context = context;
     this.barrier = barrier;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// ��ʼ������
        /// </summary>
        public void IntiData(Barrier barrier)
        {
            dialog.Hide();
            LLRectShow.Visibility = ViewStates.Gone;
            ShengName = null;
            RectIndex = -1;
            IsOpen = false;

            context.Star = 3;
            context.IsBegin = true;
            context.Barrier = barrier;
            context.ProgressBarPaused(false);
            //ˢ��
            context.Refresh();
        }
Ejemplo n.º 4
0
 private static void CalculateSpeed(ulong time)
 {
     Barrier.CalculateSpeed(time);
     Player.CalculateSpeed(time);
     GameBonus.CalculateSpeed(time);
 }
Ejemplo n.º 5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            //游戏开始
            ImageView imgStart = FindViewById<ImageView>(Resource.Id.imgStart);
            imgStart.Click += delegate
            {
                var intent = new Intent(this, typeof(GameActivity));
                intent.PutExtra("game", GameIndex);
                StartActivityForResult(intent, 0);
                Finish();
            };
            //游戏退出
            ImageView imgExit = FindViewById<ImageView>(Resource.Id.imgExit);
            imgExit.Click += delegate
            {
                Finish();
            };
            //绑定关卡列表
            glBarriers = FindViewById<GridLayout>(Resource.Id.glBarriers);
            //BarrierList = _db.QueryAllBarriers();
            BarrierList = new List<Barrier>();
            var names = Resources.GetStringArray(Resource.Array.barrier_names);
            var titles = Resources.GetStringArray(Resource.Array.barrier_titles);
            for (int i = 0; i < names.Length; i++)
            {
                var barrier = DB.QueryBarrier(i);
                if (barrier == null)
                {
                    barrier = new Barrier() { Id = i, Title = titles[i], Name = names[i], Star = 0, State = (i == 0 ? true : false), NextID = (i == names.Length - 1) ? 0 : (i + 1) };
                    DB.Insert(barrier);
                }
                BarrierList.Add(barrier);
                LinearLayout linear = new LinearLayout(this);
                GridLayout.LayoutParams g = new GridLayout.LayoutParams();
                g.Width = GridLayout.LayoutParams.WrapContent;
                g.Height = GridLayout.LayoutParams.WrapContent;

                if (Resources.DisplayMetrics.Density == 1)
                {
                    g.SetMargins(17, 20, 17, 20);
                }
                else
                {
                    g.SetMargins(17, 20, 17, 20);
                }
                linear.LayoutParameters = g;
                linear.Orientation = Orientation.Vertical;
                linear.SetGravity(GravityFlags.Center);
                linear.Clickable = false;
                LinearLayout linearLayout = new LinearLayout(this);
                LinearLayout.LayoutParams m = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);
                linearLayout.LayoutParameters = m;
                if (barrier.State)
                {
                    linearLayout.SetBackgroundResource(Resource.Drawable.home_icon_on);
                }
                else if (!barrier.State)
                {
                    linearLayout.SetBackgroundResource(Resource.Drawable.home_icon_off);
                }
                linearLayout.SetGravity(GravityFlags.Bottom);
                linearLayout.Orientation = Orientation.Vertical;
                linearLayout.Id = barrier.Id;
                linearLayout.SetOnClickListener(this);
                if (barrier.Id == 0)
                {
                    linearLayout.SetBackgroundResource(Resource.Drawable.home_icon_on_selected);
                }

                TextView textView = new TextView(this);
                LinearLayout.LayoutParams t = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
                if (Resources.DisplayMetrics.Density == 1)
                {
                    t.BottomMargin = 10;
                    textView.SetTextSize(Android.Util.ComplexUnitType.Sp, 15);
                }
                else
                {
                    t.BottomMargin = 5;
                    textView.SetTextSize(Android.Util.ComplexUnitType.Sp, 10);
                }
                textView.LayoutParameters = t;
                textView.Text = barrier.Title;
                textView.SetTextColor(Android.Graphics.Color.White);
                textView.Gravity = GravityFlags.Center;

                linearLayout.AddView(textView);

                LinearLayout ll = new LinearLayout(this);
                LinearLayout.LayoutParams l = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);

                ll.LayoutParameters = l;
                ll.Orientation = Orientation.Horizontal;
                ll.SetGravity(GravityFlags.Center);
                for (int j = 1; j <= 3; j++)
                {
                    ImageView imageView = new ImageView(this);
                    LinearLayout.LayoutParams imageLayout;
                    if (Resources.DisplayMetrics.Density == 1)
                    {
                        imageLayout = new LinearLayout.LayoutParams(30, 30);
                    }
                    else
                    {
                        imageLayout = new LinearLayout.LayoutParams(30, 30);
                    }
                    imageView.LayoutParameters = imageLayout;
                    if (j <= barrier.Star)
                    {
                        imageView.SetImageResource(Resource.Drawable.game_star_1);
                    }
                    else
                    {
                        imageView.SetImageResource(Resource.Drawable.game_star_2);
                    }
                    if (barrier.Star == 0)
                    {
                        imageView.Visibility = ViewStates.Invisible;
                    }
                    ll.AddView(imageView);
                }
                linear.AddView(linearLayout);
                linear.AddView(ll);
                glBarriers.AddView(linear);
            }
        }