Example #1
0
        public Badge[] GetAllBadgeByUserId(Guid user_id)
        {
            Badge[]         b           = { new Badge() };
            List <Guid>     badges      = new List <Guid>();
            List <DateTime> created_ats = new List <DateTime>();

            string query = @"SELECT badge_id,created_at FROM achievement WHERE user_id = @user_id";

            using (var cmd = new NpgsqlCommand(query, _connection, _transaction))
            {
                cmd.Parameters.AddWithValue("user_id", user_id);
                NpgsqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Guid id = reader.GetGuid(0);
                    badges.Add(id);
                    DateTime created_at = reader.GetDateTime(1);
                    created_ats.Add(created_at);
                }
                reader.Close();
            }

            for (int i = 0; i < badges.Count; i++)
            {
                b[b.Length - 1] = BadgeFactory.Create(FindById(badges[i]), user_id, created_ats[i]);
                Array.Resize(ref b, b.Length + 1);
            }
            return(b);
        }
Example #2
0
 void Start()
 {
     state        = BattleState.INACTIVE;
     _hudsManager = GameObject.FindGameObjectWithTag("HudsManager");
     _tileManager = GameObject.FindGameObjectWithTag("TileManager");
     //_chooseObjectWithKeys = gameObject.GetComponent<ChooseObjectWithKeys>();
     _chooseObjectWithBools = gameObject.GetComponent <ChooseObjectWithBools>();
     _playerBattleGlobal    = GameObject.FindGameObjectWithTag("GlobalInputs").GetComponent <PlayerBattleGlobal>();
     _dPadGlobal            = GameObject.FindGameObjectWithTag("GlobalInputs").GetComponent <DPadGlobal>();
     _player             = GameObject.FindGameObjectWithTag("Player");
     _badgeFactory       = new BadgeFactory();
     attackButtonClicked = false;
 }
Example #3
0
    //private int stepsCounter = 0;
    private void Start()
    {
        EnemyBattleAIStart();
        //setting attacks
        var list = new List <AttackBadge>();

        var badgeFactory = new BadgeFactory();

        list.Add(badgeFactory.PlusAttackBadge());

        enemyStats.attacks = list.ToArray();
        //====
    }
Example #4
0
        public void MakeStep(Point coordinates)
        {
            var badge = BadgeFactory.Create();

            badge.transform.localScale = new Vector3(BadgeSettings.Diameter, BadgeSettings.Diameter, BadgeSettings.Diameter);
            badge.transform.SetParent(SpawnPointRegistry.Spawns.First(x => x.Coordinates == coordinates).transform, true);
            badge.transform.localPosition = Vector3.zero;
            CreateAndPlayBadgeSpawnAnimation(badge);

            badge.Owner       = Info.ActivePlayer;
            badge.Coordinates = coordinates;
            badge.Color       = Info.ActivePlayer.Color;
            Info.ActivePlayerMadeSteps++;

            GameEvents.BadgeSpawned(badge.Model, CheckBadgeForVictory(badge.Model));
        }
Example #5
0
        public Logs CreateLogs(Logs logs)
        {
            logsRepository.CreateLogs(logs);
            Dictionary <Guid, List <DateTime> > HabitAndLogs = logsRepository.GetHabitAndLogsFromUserID(logs.UserID);
            BadgeHandler badge = new BadgeHandler(badgeService);

            Attach(badge);
            if (isDominating(logs))
            {
                Broadcast(BadgeFactory.CreateBadge("Dominating", logs.UserID));
            }
            if (isWorkaholic(HabitAndLogs))
            {
                Broadcast(BadgeFactory.CreateBadge("Workaholic", logs.UserID));
            }
            if (isEpicComeback(logs))
            {
                Broadcast(BadgeFactory.CreateBadge("Epic Comeback", logs.UserID));
            }
            return(logs);
        }
Example #6
0
        private BadgeView AddBadgeViewAt(int position, String text, int shape)
        {
            // get position
            ImageView icon = bnve.GetIconAt(position);

            int[] pos = new int[2];
            icon.GetLocationInWindow(pos);

            var actionBar = SupportActionBar;
            // action bar height
            int actionBarHeight = 0;

            if (actionBar != null)
            {
                actionBarHeight = actionBar.Height;
            }

            float x = (pos[0] + icon.MeasuredWidth * 0.7f);
            float y = (pos[1] - actionBarHeight - icon.MeasuredHeight * 1.25f);

            // calculate width
            int width  = 16 + 4 * (text.Length - 1);
            int height = 16;

            BadgeView badgeView = BadgeFactory.Create(this)
                                  .SetTextColor(Color.White)
                                  .SetWidthAndHeight(width, height)
                                  .SetBadgeBackground(Color.Red)
                                  .SetTextSize(10)
                                  .SetBadgeGravity((int)(GravityFlags.Left | GravityFlags.Top))
                                  .SetBadgeCount(text)
                                  .SetShape(shape)
                                  .Bind(FindViewById(Resource.Id.rl_root));

            badgeView.SetX(x);
            badgeView.SetY(y);
            badgeView.Visibility = ViewStates.Visible;
            return(badgeView);
        }
Example #7
0
 public Badge Gain(Guid UserID)
 {
     return(BadgeFactory.CreateDominating(UserID));
 }
Example #8
0
 public Badge Gain(Guid UserID)
 {
     return(BadgeFactory.CreateEpicComeback(UserID));
 }
Example #9
0
 public Badge Gain(Guid UserID)
 {
     return(BadgeFactory.CreateWorkaholic(UserID));
 }