public IActionResult ActivityInfo(int activityId, int userId) { if (HttpContext.Session.GetString("UserEmail") == null) { return(RedirectToAction("Logout", "Home")); } else { User userInDb = dbContext.Users.FirstOrDefault(u => u.Email == HttpContext.Session.GetString("UserEmail")); ViewBag.LoggedIn = userInDb; List <User> activityParticipants = dbContext.Users.Include(g => g.Participants).Where(c => c.Participants.Any(pId => pId.ActivesId == activityId)).ToList(); ViewBag.Participant = activityParticipants; Actives Activity = dbContext.Activities.Include(u => u.ActivityCreator).ThenInclude(c => c.Participants).Include(c => c.ActivityParticipants).FirstOrDefault(w => w.ActivityId == activityId); ViewBag.Activity = Activity; List <Actives> allActivities = dbContext.Activities.Include(u => u.ActivityCreator).ThenInclude(c => c.Participants).Include(c => c.ActivityParticipants).ToList(); ViewBag.Activities = allActivities; List <Participant> part = dbContext.Participants.Include(u => u.User).ThenInclude(u => u.Activities).Include(u => u.Actives).ThenInclude(c => c.ActivityParticipants).ToList(); ViewBag.Part = part; // // List<Actives> part = dbContext.Activities.Include(a => a.ActivityParticipants).ThenInclude(u => u.User).Include(u => u.ActivityParticipants).ThenInclude(a => a.Actives).Where(u => u.UserId == userInDb.UserId).ToList(); return(View("ActivityInfo", Activity)); } }
protected void InitSkillTree() { if (PlayerData.Class == CLASS.Warrior) { GameObject SkillTreeOJ; SkillTreeOJ = Resources.Load("SkillPrefabs/WarriorSkillTree") as GameObject; CachedTreeSkills = SkillTreeOJ.GetComponent <SkillTreeController>().SkillTree; } else if (PlayerData.Class == CLASS.Mage) { } else if (PlayerData.Class == CLASS.Rogue) { } for (int i = 0; i < Patch.SkillTreeSize; i++) { CachedTreeSkills[i].GenerateDescription(); if (CachedTreeSkills[i] != null && PlayerData.SkillTreelvls[i] != 0) //Does lvl+skill check here { Skill s = CachedTreeSkills[i].Instantiate(); s.InitSkill(GetComponent <ObjectController>(), PlayerData.SkillTreelvls[i]); if (s.GetType().IsSubclassOf(typeof(PassiveSkill))) { Passives.Add((PassiveSkill)s); } else { Actives.Add((ActiveSkill)s); } } } }
public Scene(string[] map, int blockSize, Game game) { Game = game; var blocks = new List <Block>(); for (var i = 0; i < map.Length; i++) { for (var j = 0; j < map[i].Length; j++) { switch (map[i][j]) { case '#': blocks.Add(new Block(j * blockSize, i * blockSize, blockSize, blockSize)); break; case 'T': Actives.Add(new Turret(j * blockSize, i * blockSize, game)); break; case 'M': Actives.Add(new Tank( j * blockSize, i * blockSize, map[i][j + 1] == 'L' ? Direction.Left : Direction.Right, game)); j++; break; } } } LandScape = new Ground(map, blockSize); }
// Set default attributes void Start() { this.lives = 3; this.activeExpireTime = -1; this.amountOfPowerUpItem = -1; this.currentPowerup = PowerUps.NONE; this.currentActive = Actives.NONE; }
/// <summary> /// Handles the Unchecked event of the SearchEngineMenuItem control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void SearchEngineMenuItemUnchecked(object sender, RoutedEventArgs e) { if (Actives.Contains((sender as MenuItem).Tag as string)) { Actives.Remove((sender as MenuItem).Tag as string); Settings.Set("Active Subtitle Sites", Actives); } }
// Do active effect on player public void setActive(int active) { this.currentActive = (Actives)active; switch (this.currentActive) { case Actives.SUSHI: gainLife(); this.currentActive = Actives.NONE; break; } }
public void Remove(IGameObject gameObject) { if (gameObject is Player) { Game.Over(false); } if (gameObject is IActive active) { Actives.Remove(active); } }
// Set default attributes void Start() { this.lives = 5; this.activeExpireTime = -1; this.powerUpDelayTime = -1; this.currentDelayTime = -1; this.hitMarkerExpireTime = -1; this.currentPowerup = PowerUps.NONE; this.currentActive = Actives.NONE; this.originalPlayerColor = transform.Find("pCylinder3").GetComponent <Renderer>().materials[1].color; this.displayCam = GameObject.Find("DisplayCam"); }
// Resets player to their original state and removes the active private void stopActive() { switch (this.currentActive) { case Actives.BOOST: this.setMoveSpeed(this.getMoveSpeed() - 5.0f); break; case Actives.GAME_FREEZE: GameObject.FindWithTag("GameController").GetComponent <GameManager>().toggleCameraMovement(); break; } ; this.currentActive = Actives.NONE; }
public IActionResult Delete(int activityId) { if (HttpContext.Session.GetString("UserEmail") == null) { return(RedirectToAction("Logout", "Home")); } else { User userInDb = dbContext.Users.FirstOrDefault(u => u.Email == HttpContext.Session.GetString("UserEmail")); Actives delete = dbContext.Activities.FirstOrDefault(w => w.ActivityId == activityId); dbContext.Activities.Remove(delete); dbContext.SaveChanges(); return(RedirectToAction("Home")); } }
public void Update() { foreach (var active in Actives) { active.Update(); } foreach (var active in ToAdd) { active.Update(); Actives.Add(active); } ToAdd = new List <IActive>(); }
// Create a random active private void instantiateRandomActive(int xVal, int zVal) { Actives generateActive = (Actives)(Random.Range(0, System.Enum.GetValues(typeof(Actives)).Length)); switch (generateActive) { case Actives.SUSHI: allObjects[xVal].Add(Instantiate(sushiPrefab, new Vector3(xVal * 10, 5, (zVal * 10) - 45), sushiPrefab.transform.rotation) as GameObject); break; default: // Should never hit here Debug.Log("Active token not found"); break; } }
protected void UpdateSkillTreeState() { for (int i = 0; i < Patch.SkillTreeSize; i++) { if (CachedTreeSkills[i].GetType().IsSubclassOf(typeof(ActiveSkill))) { ActiveSkill active = GetActive(CachedTreeSkills[i].GetType()); if (active && PlayerData.SkillTreelvls[i] != 0) { active.InitSkill(GetComponent <ObjectController>(), PlayerData.SkillTreelvls[i]); } else if (active && PlayerData.SkillTreelvls[i] == 0) { Actives.Remove(active); active.Delete(); } else if (active == null && PlayerData.SkillTreelvls[i] != 0) { Skill s = CachedTreeSkills[i].Instantiate(); s.InitSkill(GetComponent <ObjectController>(), PlayerData.SkillTreelvls[i]); Actives.Add((ActiveSkill)s); } } else { PassiveSkill passive = GetPassive(CachedTreeSkills[i].GetType()); if (passive && PlayerData.SkillTreelvls[i] != 0) { passive.InitSkill(GetComponent <ObjectController>(), PlayerData.SkillTreelvls[i]); } else if (passive && PlayerData.SkillTreelvls[i] == 0) { Passives.Remove(passive); passive.Delete(); } else if (passive == null && PlayerData.SkillTreelvls[i] != 0) { Skill s = CachedTreeSkills[i].Instantiate(); s.InitSkill(GetComponent <ObjectController>(), PlayerData.SkillTreelvls[i]); Passives.Add((PassiveSkill)s); } } } }
public List <Actives> getAllByProgram(Int32 pCode) { String sql = "SP_GETALLACTIVESBYPROGRAM"; try { SqlCommand oCommand = new SqlCommand(sql); oCommand.CommandType = System.Data.CommandType.StoredProcedure; oCommand.Parameters.AddWithValue("@PROGRAM_ID", pCode); DataTable oDataTable = DAO.getInstance().executeQuery(oCommand); List <Actives> listActives = new List <Actives>(); foreach (DataRow oDataRow in oDataTable.Rows) { Actives oActivites = new Actives(); ClassRoom oClassRoom = new ClassRoom(); Program oProgram = new Program(); ActivesStatus oStatus = new ActivesStatus(); oActivites.code = Convert.ToInt32(oDataRow[0].ToString()); oStatus.activesSatus_ID = Convert.ToInt32(oDataRow[1].ToString()); oStatus.description = oDataRow[2].ToString(); oActivites.codeAlphaNumeric = oDataRow[3].ToString(); oActivites.description = oDataRow[4].ToString(); oClassRoom.code = Convert.ToInt32(oDataRow[5].ToString()); oClassRoom.num_room = oDataRow[6].ToString(); oProgram.code = Convert.ToInt32(oDataRow[7].ToString()); oProgram.name = oDataRow[8].ToString(); oActivites.oClassRoom = oClassRoom; oActivites.oProgram = oProgram; oActivites.status = oStatus; listActives.Add(oActivites); } return(listActives); } catch (Exception ex) { throw ex; } finally { } }
// Do active effect on player public void setActive(int active) { this.currentActive = (Actives)active; switch (this.currentActive) { case Actives.SUSHI: gainLife(); this.currentActive = Actives.NONE; break; case Actives.BOOST: this.activeExpireTime = 3.0f; this.setMoveSpeed(this.getMoveSpeed() + 5.0f); break; case Actives.GAME_FREEZE: this.activeExpireTime = 10.0f; GameObject.FindWithTag("GameController").GetComponent <GameManager>().toggleCameraMovement(); displayCam.GetComponent <DisplayUI>().applyFreezeEffect(this.activeExpireTime); break; } }
public Int32 modify(Actives oActives) { String oSql = "SP_MODIFYACTIVES"; try { SqlCommand oCommand = new SqlCommand(oSql); oCommand.CommandType = CommandType.StoredProcedure; oCommand.Parameters.AddWithValue("@ID", oActives.code); oCommand.Parameters.AddWithValue("@DESCRIPTION", oActives.description); oCommand.Parameters.AddWithValue("@STATEACTIVE", oActives.status.activesSatus_ID); oCommand.Parameters.AddWithValue("@CLASSROOM_ID", oActives.oClassRoom.code); oCommand.Parameters.AddWithValue("@PROGRAM_ID", oActives.oProgram.code); return(DAO.getInstance().executeSQL(oCommand)); } catch (Exception ex) { throw ex; } finally { } }
public IActionResult AddActivity(Actives addActivity) { User userInDb = dbContext.Users.FirstOrDefault(u => u.Email == HttpContext.Session.GetString("UserEmail")); if (userInDb == null) { return(RedirectToAction("Logout", "Home")); } else { if (ModelState.IsValid) { addActivity.UserId = userInDb.UserId; dbContext.Activities.Add(addActivity); dbContext.SaveChanges(); return(RedirectToAction("ActivityInfo", addActivity)); } else { return(View("NewActivity", addActivity)); } } }
/// <summary> /// Loads the engines. /// </summary> /// <param name="reload">if set to <c>true</c> it will reload all variables; otherwise, it will just load the variables which are null.</param> public void LoadEngines(bool reload = false) { if (reload || availableEngines.Items.Count == 0) { availableEngines.Items.Clear(); foreach (var engine in SearchEngines) { var mi = new MenuItem { Header = new StackPanel { Orientation = Orientation.Horizontal }, IsCheckable = true, IsChecked = Actives.Contains(engine.Name), StaysOpenOnClick = true, Tag = engine.Name }; (mi.Header as StackPanel).Children.Add(new Image { Source = new BitmapImage(engine.Icon != null ? new Uri(engine.Icon) : new Uri("/RSTVShowTracker;component/Images/navigation.png", UriKind.Relative), new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.CacheIfAvailable)), Width = 16, Height = 16, Margin = new Thickness(3, -2, 0, 0) }); (mi.Header as StackPanel).Children.Add(new Label { Content = engine.Name, Padding = new Thickness(5, 0, 0, 0), Width = 105 }); if (engine.Private) { var login = Settings.Get(engine.Name + " Login", string.Empty); var cookies = Settings.Get(engine.Name + " Cookies", string.Empty); var tooltip = string.Empty; if (string.IsNullOrWhiteSpace(login) && string.IsNullOrWhiteSpace(cookies)) { if (engine.CanLogin) { tooltip = "Go to Settings, click on the Parsers tab, then select this site and enter the username and password."; } else { tooltip = "Go to Settings, click on the Parsers tab, then select this site and enter the extracted cookies."; } } if (!string.IsNullOrWhiteSpace(login)) { try { var ua = Utils.Decrypt(engine, login); tooltip = "You have supplied login credentials for " + ua[0] + "."; } catch (Exception ex) { tooltip = "Error while decrypting login credentials: " + ex.Message; } } else if (!string.IsNullOrWhiteSpace(cookies)) { try { var cs = Utils.Decrypt(engine, cookies)[0]; tooltip = "You have supplied the following cookies:"; foreach (var cookie in cs.Split(';')) { if (cookie.TrimStart().StartsWith("pass")) { tooltip += "\r\n - " + Regex.Replace(cookie.Trim(), "(?<=pass=.{4})(.+)", m => new string('▪', m.Groups[1].Value.Length)).CutIfLonger(60); } else { tooltip += "\r\n - " + cookie.Trim().CutIfLonger(60); } } } catch (Exception ex) { tooltip = "Error while decrypting cookies: " + ex.Message; } } (mi.Header as StackPanel).Children.Add(new Image { Source = new BitmapImage(new Uri("/RSTVShowTracker;component/Images/" + (string.IsNullOrWhiteSpace(login) && string.IsNullOrWhiteSpace(cookies) ? "lock" : "key") + ".png", UriKind.Relative)), Width = 16, Height = 16, Margin = new Thickness(3, -2, -100, 0), ToolTip = "This is a private site and therefore a valid account is required to search on it.\r\n" + tooltip }); } mi.Checked += SearchEngineMenuItemChecked; mi.Unchecked += SearchEngineMenuItemUnchecked; availableEngines.Items.Add(mi); } } }
public AccountOBJ GetAccountFromDB(string username) { CHeck(); AccountOBJ account = null; Users usr = session.QueryOver <Users>().Where(x => x.UserName == username).List().FirstOrDefault(); if (usr != null) { account = new AccountOBJ(usr); IList <Characters> chars = session.QueryOver <Characters>().Where(x => x.UserId == account.Id).List(); account.Skins = new SortedList <uint, CharacterOBJ>(); for (int c = 0; c < chars.Count; c++) { Characters character = chars[c]; CharacterOBJ objchar = new CharacterOBJ(character); account.Skins.Add(objchar.PlayerId, objchar); } if (chars.Count == 0) { using (ITransaction transaction = session.BeginTransaction()) { short skinId = Settings.randomSkins[new Random().Next(Settings.randomSkins.Length)]; ConfiModel model = ConfigManager.GetModel(skinId); if (model != null) { Characters ccc = new Characters(account.Id, skinId) { SkinColorId = model.SkinColorId, EyeColorId = model.EyeColorId, HairColorId = model.HairColorId, ShirtColorId = model.ShirtColorId, PantsColorId = model.PantsColorId, BootsColorId = model.BootsColorId, GlovesColorId = model.GlovesColorId }; session.Save(ccc); transaction.Commit(); } } chars = session.QueryOver <Characters>().Where(x => x.UserId == account.Id).List(); for (int c = 0; c < chars.Count; c++) { Characters character = chars[c]; CharacterOBJ objchar = new CharacterOBJ(character); account.Skins.Add(objchar.PlayerId, objchar); } } IList <Actives> actives = session.QueryOver <Actives>().Where(x => x.UserId == account.Id).List(); ActivesConfig[] allActives = ConfigManager.GetActives(); if (allActives.Length != actives.Count) { for (int c = 0; c < actives.Count; c++) { Actives active = actives[c]; ActivesOBJ objactive = new ActivesOBJ(active); account.Actives.Add(objactive.ActiveId, objactive); } using (ITransaction transaction = session.BeginTransaction()) { for (int a = 0; a < allActives.Length; a++) { ActivesConfig ac = allActives[a]; if (!account.Actives.ContainsKey(ac.ActiveId)) { Actives active = new Actives { UserId = account.Id, value = 0, ActiveId = ac.ActiveId, collected = false }; session.Save(active); // <-- this ActivesOBJ objactive = new ActivesOBJ(active); account.Actives.Add(objactive.ActiveId, objactive); } } transaction.Commit(); } account.Actives.Clear(); actives = session.QueryOver <Actives>().Where(x => x.UserId == account.Id).List(); for (int c = 0; c < actives.Count; c++) { Actives active = actives[c]; ActivesOBJ objactive = new ActivesOBJ(active); account.Actives.Add(objactive.ActiveId, objactive); } } else { for (int c = 0; c < actives.Count; c++) { Actives active = actives[c]; ActivesOBJ objactive = new ActivesOBJ(active); account.Actives.Add(objactive.ActiveId, objactive); } } } return(account); }
public void LoadActives() { Actives allActives = new Actives(); Actives = new ObservableCollection <Active>(allActives); }