static void SetPowerType(PowerType type, params ShapeshiftForm[] forms) { foreach (var form in forms) { SpellHandler.GetShapeshiftEntry(form).PowerType = type; } }
public void returns_expected_result_when_argument_is_valid(string value, PowerType expectedResult) { var parser = BuildParser(); var result = parser.ParseProperty(value); Assert.AreEqual(expectedResult, result); }
public InventoryPower(PowerType type, bool infinite, string name = null){ this.type = type; this.infinite = infinite; quantity = 1; if(name == null) this.name = type.ToString(); else this.name = name; }
void Awake(){ powerPrefabs = GetComponent<PowerPrefabs>(); GameObject placementRoot = Instantiate(PlacementUIPrefab, PlacementUIPrefab.transform.position, Quaternion.identity) as GameObject; placementUI = placementRoot.GetComponent<PlacementUI>(); //if starting powers are the same remove the second one and make it undefined before adding to UI if (firstPower == secondPower) { secondPower = PowerType.UNDEFINED; } placementUI.Initialize (powerPrefabs, firstPower, secondPower); }
public bool CreateSpecialWithType(List<Chuzzle> comb, PowerType powerType) { var ordered = comb; var targetTile = comb[Random.Range(0, ordered.Count)]; var cellForNew = targetTile.Current; foreach (var chuzzle in ordered) { if (chuzzle != targetTile) { chuzzle.MoveTo = cellForNew; } } var powerUp = Gamefield.PowerTypePrefabs.First(x => x.Type == powerType && x.ChuzzleType == targetTile.Type).Prefab; var powerUpChuzzle = Gamefield.Level.CreateChuzzle(targetTile.Current.x, targetTile.Current.y, powerUp); powerUpChuzzle.Type = targetTile.Type; powerUpChuzzle.PowerType = powerType; Debug.Log("Child number: " + powerUpChuzzle.transform.childCount); var child = powerUpChuzzle.transform.GetChild(0).gameObject; Object.Destroy(child.GetComponent<BoxCollider>()); Gamefield.Level.ScaleSprite(child.GetComponent<tk2dSprite>()); Object.Destroy(targetTile.gameObject); Gamefield.Level.ActiveChuzzles.Remove(targetTile); Gamefield.Level.Chuzzles.Remove(targetTile); ordered.Remove(targetTile); foreach (var c in ordered) { Gamefield.RemoveChuzzle(c); var targetPosition = new Vector3(c.MoveTo.x*c.Scale.x, c.MoveTo.y*c.Scale.y, 0); SpecialTilesAnimated.Add(c); iTween.MoveTo(c.gameObject, iTween.Hash( "x", targetPosition.x, "y", targetPosition.y, "z", targetPosition.z, "time", 0.3f, "easetype", iTween.EaseType.easeInOutQuad, "oncomplete", new Action<object>(OnCreateLineTweenComplete), "oncompleteparams", c )); } return true; }
private void UpdatePower() { var c = powerIcon.color; c.a = Mathf.Max(0, powerTime) / 20; powerIcon.color = c; if (powerType != PowerType.none) powerIcon.texture = powerTextures[(int)powerType]; powerTime -= Time.deltaTime; if (powerTime < 0) powerType = PowerType.none; }
public void ProcessPowerCommand(PowerType command) { switch (command) { case PowerType.Shutdown: Process.Start("shutdown", "/s /t 0"); break; case PowerType.Restart: Process.Start("shutdown", "/r /t 0"); break; case PowerType.Hibernate: System.Windows.Forms.Application.SetSuspendState(PowerState.Hibernate, true, true); break; case PowerType.Close: System.Windows.Application.Current.Shutdown(); break; } }
public IEnumerable<TrainMovementResult> CallingAtStation(string crsCode, DateTime? startDate = null, DateTime? endDate = null, string atocCode = null, PowerType? powerType = null) { startDate = startDate ?? DateTime.UtcNow.AddDays(-1); endDate = endDate ?? DateTime.UtcNow.Date.Add(new TimeSpan(23, 59, 59)); if ((endDate.Value - startDate.Value) > TimeSpan.FromDays(1)) { endDate = startDate.Value.AddDays(1); } // get tiploc id to improve query var tiplocs = _tiplocRepository.GetAllByCRSCode(crsCode) .Select(t => t.TiplocId); if (!tiplocs.Any()) return Enumerable.Empty<TrainMovementResult>(); return CallingAt(tiplocs, startDate.Value, endDate.Value, atocCode, powerType); }
internal static PowerUp PowerUpFromType(PowerType pType) { switch (pType) { case PowerType.SHIELD: return(new PowerUpShield()); case PowerType.BOOST: return(new PowerUpBoost()); case PowerType.HEAL: return(new PowerUpHeal()); case PowerType.BACK_TURN: return(new PowerUpBackTurn()); default: return(null); } }
private decimal CalculateCurrentExpeditionPower(ExpeditionData data, PowerType powerType) { switch (powerType) { case PowerType.Military: return(this._unitLogic.GetMilitaryPower(data.RemainingUnits, MilitarySide.Both)); case PowerType.Science: return(this._unitLogic.GetSciencePower(data.RemainingUnits)); case PowerType.Labour: return(this._unitLogic.GetLabourPower(data.RemainingUnits)); case PowerType.Electric: throw new NotSupportedException("Power.Electric does not apply to Expedition calculations."); default: throw new ArgumentOutOfRangeException(nameof(powerType), powerType, null); } }
public void InitPower(RiverSides side, PowerType power) { int nbPlayer = side == RiverSides.Right ? 0 : 1; switch (power) { case (PowerType.Bomb): actualSprite[nbPlayer].sprite = powerSprites[0]; break; case (PowerType.Jump): actualSprite[nbPlayer].sprite = powerSprites[1]; break; case (PowerType.TractorBeam): actualSprite[nbPlayer].sprite = powerSprites[2]; break; } cooldownText[nbPlayer].enabled = false; }
public void AddPowerGraphAction(PowerType powerType, DateTime startTime, DateTime endTime, string graphName) { if (powerType == null) { throw new Exception("Please choose the category"); } if (TimeHandler.DataTooBig(startTime, endTime, powerType.Interval)) { return; } startTime = TimeHandler.ConvertToLocalTime(startTime); endTime = TimeHandler.ConvertToLocalTime(endTime); try { TimeHandler.IsTimeValid(startTime, endTime); IsPlotNameValid(graphName); var series_task = Task.Run(() => Fingrid.Get(powerType, startTime, endTime)); try { series_task.Wait(); var series = series_task.Result; series.Name = graphName + " (" + powerType.Source + ")"; DataPlot.Data.Add(series); } catch (AggregateException e) { Console.WriteLine("Cannot add data to plot"); foreach (var ex in e.InnerExceptions) { Console.WriteLine(ex.Message); } throw new Exception("Cannot add data to plot"); } } catch (Exception e) { throw e; } }
public bool CancelCommand(long gid, PowerType powerType) { // Lista sinhronih masina nad kojima se komanduje List <SynchronousMachine> ders = GetDERsForGlobalID(gid); // Lista sa komandama za brisanje List <Command> commandsForRemove = new List <Command>(); // Ako nema sinhronih masina -> kraj if (ders == null || ders.Count.Equals(0)) { return(false); } foreach (SynchronousMachine der in ders) { AnalogValue analogValue = CalculationEngineModel.Instance.AnalogPointsOriginal.Where(o => o.SynchronousMachine.Equals(der.GlobalId) && o.PowerType.Equals(powerType)).FirstOrDefault(); if (analogValue == null) { continue; } List <Command> commands = null; CalculationEngineModel.Instance.AppliedCommands.TryGetValue(analogValue.GlobalId, out commands); if (commands == null) { continue; } commandsForRemove.AddRange(commands.Where(o => o.EndTime > DateTime.Now.Ticks).ToList()); } foreach (Command command in commandsForRemove) { CalculationEngineModel.Instance.RemoveCommand(command); } return(true); }
/// <summary> /// Return the HashCode of this object. /// </summary> /// <returns>The HashCode of this object.</returns> public override Int32 GetHashCode() { unchecked { return((PowerType.HasValue ? PowerType.GetHashCode() * 7 : 0) ^ (Voltage.HasValue ? Voltage.GetHashCode() * 5 : 0) ^ (Amperage.HasValue ? Amperage.GetHashCode() * 3 : 0) ^ (Power.HasValue ? Power.GetHashCode() : 0)); } }
public void SetPowerupType(PowerType newType) { myPower = newType; Renderer ren = GetComponent <Renderer>(); switch (newType) { case PowerType.WIND: ren.material = windPowerup; break; case PowerType.SPEED: ren.material = speedPowerup; break; case PowerType.INVINCIBLE: ren.material = invinciblePowerup; break; } }
public IEnumerable<TrainMovementResult> CallingBetweenLocations(string fromStanox, string toStanox, DateTime? startDate = null, DateTime? endDate = null, string atocCode = null, PowerType? powerType = null) { startDate = startDate ?? DateTime.UtcNow.AddDays(-1); endDate = endDate ?? DateTime.UtcNow.Date.Add(new TimeSpan(23, 59, 59)); if ((endDate.Value - startDate.Value) > TimeSpan.FromDays(1)) { endDate = startDate.Value.AddDays(1); } // get tiploc id to improve query var tiplocsFrom = _tiplocRepository.GetTiplocsByStanox(fromStanox) .Select(t => t.TiplocId); var tiplocsTo = _tiplocRepository.GetTiplocsByStanox(toStanox) .Select(t => t.TiplocId); if (!tiplocsFrom.Any() || !tiplocsTo.Any()) return Enumerable.Empty<TrainMovementResult>(); return CallingBetween(tiplocsFrom, tiplocsTo, startDate.Value, endDate.Value, atocCode, powerType); }
private void UserInput() { //Set selector Position if (m_Input.DirectionalMovement.x > 0.1f && m_CycleTimer < Time.time) { m_CycleTimer = Time.time + m_CycleDelay; ++m_Selected_System; if (m_Selected_System == PowerType.COUNT) { m_Selected_System = PowerType.Doors; } SetUI(); } else if (m_Input.DirectionalMovement.x < -0.1f && m_CycleTimer < Time.time) { m_CycleTimer = Time.time + m_CycleDelay; if (m_Selected_System == PowerType.Doors) { m_Selected_System = PowerType.Weapons; } else { --m_Selected_System; } SetUI(); } //Add remove power if (m_Input.DirectionalMovement.z > 0.1f && m_CycleTimer < Time.time) { m_CycleTimer = Time.time + m_CycleDelay; AddPowerToSystem(m_Selected_System); SetUI(); } else if (m_Input.DirectionalMovement.z < -0.1f && m_CycleTimer < Time.time) { m_CycleTimer = Time.time + m_CycleDelay; RemovePowerFromSystem(m_Selected_System); SetUI(); } }
/** * Get a single and latest data point from Fingrid API */ public static async Task <IData> Get(PowerType powerType, string format = null) { if (format == null) { format = DEFAULT_FORMAT; } string requestUri = $"{SERVER_URL}/{powerType.Id}/event/{format}"; var httpRequestMessage = new HttpRequestMessage(); httpRequestMessage.Method = HttpMethod.Get; httpRequestMessage.RequestUri = new Uri(requestUri); SetHeaders(httpRequestMessage, format); HttpResponseMessage response; try { response = await _client.SendAsync(httpRequestMessage); response.EnsureSuccessStatusCode(); } catch (HttpRequestException e) { throw new HttpRequestException(e.Message); } var body = await response.Content.ReadAsStringAsync(); if (format == "xml") { IData singleData = ParseXMLToSingleData(powerType.Id, body); return(singleData); } else { Console.WriteLine($"Return data type {format} doesn't support yet"); throw new NotImplementedException($"Return data type {format} doesn't support yet"); } }
public bool CommandExists(long gid, PowerType powerType) { // Lista sinhroni masina nad kojima se komanduje List <SynchronousMachine> ders = GetDERsForGlobalID(gid); // Ako nema sinhroni masina -> kraj if (ders == null || ders.Count.Equals(0)) { return(false); } foreach (SynchronousMachine der in ders) { AnalogValue analogValue = CalculationEngineModel.Instance.AnalogPointsOriginal.Where(o => o.SynchronousMachine.Equals(der.GlobalId) && o.PowerType.Equals(powerType)).FirstOrDefault(); if (analogValue == null) { continue; } List <Command> commands = null; CalculationEngineModel.Instance.AppliedCommands.TryGetValue(analogValue.GlobalId, out commands); if (commands == null) { continue; } List <Command> exist = commands.Where(o => o.EndTime >= DateTime.Now.Ticks).ToList(); if (exist.Count == 0 || exist == null) { continue; } return(true); } return(false); }
public void PowerTest() { List <Role> roles = new List <Role>() { new Role() { RoleId = 1, RoleName = "admin", RolePower = 7 }, new Role() { RoleId = 1, RoleName = "user", RolePower = 5 }, new Role() { RoleId = 1, RoleName = "guest", RolePower = 4 }, }; PowerType t7 = PowerType.r & PowerType.w & PowerType.x; var r = roles.Where(a => (t7 & (PowerType)a.RolePower) == 0); Assert.AreEqual <int>(r.Count(), 3); }
private void CreateMinRequirement(List <Requirement> RequirementObjects, PowerType type, int value) { if (value > 0) { if (type == PowerType.Mana) { RequirementObjects.Add(new Requirement { HasRequirement = () => playerReader.ManaCurrent >= value || playerReader.Buffs.Clearcasting, LogMessage = () => $"{type} {playerReader.ManaCurrent} >= {value}" }); } else { RequirementObjects.Add(new Requirement { HasRequirement = () => playerReader.PTCurrent >= value || playerReader.Buffs.Clearcasting, LogMessage = () => $"{type} {playerReader.PTCurrent} >= {value}" }); } } }
public void SetPower(PowerType powerType) { currentPowerType = powerType; switch (currentPowerType) { case PowerType.WhiteBall: currentPower = powers[0]; break; case PowerType.FireBall: currentPower = powers[1]; break; case PowerType.IceBall: currentPower = powers[2]; break; case PowerType.LightningBall: currentPower = powers[3]; break; } }
public void CmdSetPowerDistribution(PowerType type, int val) { Debug.Log("Power setting :" + type.ToString()); switch (type) { case PowerType.Doors: _Power_Doors += val; break; case PowerType.Engines: _Power_Engines += val; break; case PowerType.Lights: _Power_Lights += val; break; case PowerType.MedBay: _Power_MedBay += val; break; case PowerType.Navigation: _Power_Navigation += val; break; case PowerType.Oxygen: _Power_Oxygen += val; break; case PowerType.Shields: _Power_Shields += val; break; case PowerType.Weapons: _Power_Weapons += val; break; } }
internal static FlightPathHeadOption FlightPathHeadOptionFromType(PowerType powUpT) { switch (powUpT) { case PowerType.NORMAL: return(new FlightPathHeadOption("flightPathHead.png", PowerType.NORMAL)); case PowerType.SHIELD: return(new FlightPathHeadOption("shield.png", PowerType.SHIELD)); case PowerType.BOOST: return(new FlightPathHeadOption("boost.png", PowerType.BOOST)); case PowerType.HEAL: return(new FlightPathHeadOption("heal.png", PowerType.HEAL)); case PowerType.BACK_TURN: return(new FlightPathHeadOption("backTurn.png", PowerType.BACK_TURN)); default: return(null); } }
///<summary> /// The event when the Text blank message change its value /// </summary> static void OnPower_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e) { PowerSelector ctrl = sender as PowerSelector; PowerType ptp = (PowerType)e.NewValue; if (ptp == PowerType.HP) { ctrl.Watts.Visibility = Visibility.Collapsed; ctrl.Hp.Visibility = Visibility.Visible; } else { ctrl.Watts.Visibility = Visibility.Visible; ctrl.Hp.Visibility = Visibility.Collapsed; if (ptp == PowerType.Watts) { ctrl.wattsInput.IsChecked = true; } else { ctrl.wattsInput.IsChecked = false; } } }
// 根据权限设置多选列的显隐 public static void SetGridCheckColumnByPower(FineUI.Grid grid, PowerType power) { grid.EnableCheckBoxSelect = Common.CheckPower(power); }
public static void AddSpellDamageOrHealingPower(item_template t, PowerType powerType) { float power = t.ItemLevel; switch (t.InventoryType) { case 17: power *= 5.635f; break; case 13: case 14: case 21: case 22: power *= 4.169f; break; default: // 1h return; } switch (t.Quality) { case 0: power /= 1.3f * 1.3f * 1.3f * 1.3f; break; case 1: power /= 1.3f * 1.3f * 1.3f; break; case 2: power /= 1.3f * 1.3f; break; case 3: power /= 1.3f; break; case 4: break; case 5: power *= 1.3f; break; case 6: power *= 1.3f * 1.3f; break; default: power = 0; break; } power /= 1.25f; if (powerType == PowerType.SpellPower) power /= 1.5f; if (power > 1) { switch (powerType) { case PowerType.SpellPower: { if (t.stat_type1 == 0) { t.stat_type1 = 45; t.stat_value1 = (int)power; } else if (t.stat_type2 == 0) { t.stat_type2 = 45; t.stat_value2 = (int)power; } else if (t.stat_type3 == 0) { t.stat_type3 = 45; t.stat_value3 = (int)power; } else if (t.stat_type4 == 0) { t.stat_type4 = 45; t.stat_value4 = (int)power; } else if (t.stat_type5 == 0) { t.stat_type5 = 45; t.stat_value5 = (int)power; } else if (t.stat_type6 == 0) { t.stat_type6 = 45; t.stat_value6 = (int)power; } else if (t.stat_type7 == 0) { t.stat_type7 = 45; t.stat_value7 = (int)power; } else if (t.stat_type8 == 0) { t.stat_type8 = 45; t.stat_value8 = (int)power; } else if (t.stat_type9 == 0) { t.stat_type9 = 45; t.stat_value9 = (int)power; } else if (t.stat_type10 == 0) { t.stat_type10 = 45; t.stat_value10 = (int)power; } break; } case PowerType.HealPower: { if (t.stat_type1 == 0) { t.stat_type1 = 41; t.stat_value1 = (int)power; } else if (t.stat_type2 == 0) { t.stat_type2 = 41; t.stat_value2 = (int)power; } else if (t.stat_type3 == 0) { t.stat_type3 = 41; t.stat_value3 = (int)power; } else if (t.stat_type4 == 0) { t.stat_type4 = 41; t.stat_value4 = (int)power; } else if (t.stat_type5 == 0) { t.stat_type5 = 41; t.stat_value5 = (int)power; } else if (t.stat_type6 == 0) { t.stat_type6 = 41; t.stat_value6 = (int)power; } else if (t.stat_type7 == 0) { t.stat_type7 = 41; t.stat_value7 = (int)power; } else if (t.stat_type8 == 0) { t.stat_type8 = 41; t.stat_value8 = (int)power; } else if (t.stat_type9 == 0) { t.stat_type9 = 41; t.stat_value9 = (int)power; } else if (t.stat_type10 == 0) { t.stat_type10 = 41; t.stat_value10 = (int)power; } break; } case PowerType.DamagePower: { if (t.stat_type1 == 0) { t.stat_type1 = 42; t.stat_value1 = (int)power; } else if (t.stat_type2 == 0) { t.stat_type2 = 42; t.stat_value2 = (int)power; } else if (t.stat_type3 == 0) { t.stat_type3 = 42; t.stat_value3 = (int)power; } else if (t.stat_type4 == 0) { t.stat_type4 = 42; t.stat_value4 = (int)power; } else if (t.stat_type5 == 0) { t.stat_type5 = 42; t.stat_value5 = (int)power; } else if (t.stat_type6 == 0) { t.stat_type6 = 42; t.stat_value6 = (int)power; } else if (t.stat_type7 == 0) { t.stat_type7 = 42; t.stat_value7 = (int)power; } else if (t.stat_type8 == 0) { t.stat_type8 = 42; t.stat_value8 = (int)power; } else if (t.stat_type9 == 0) { t.stat_type9 = 42; t.stat_value9 = (int)power; } else if (t.stat_type10 == 0) { t.stat_type10 = 42; t.stat_value10 = (int)power; } } break; } } }
//Displays the labels with score and player info void ShowScoresLocally(float roundscore, float totalscore, string playername, int playernumber, CharacterStyle playercolor, PowerType lastdeath, Character playermodel){ string color = ColorCheck(playercolor); GameObject playerpose; playerpose = DetermineColor(color, playermodel); RoundFinish(roundscore, totalscore, playername, playernumber, playerpose, lastdeath); }
private IEnumerable<RunningScheduleTrain> GetCallingBetweenSchedules(IEnumerable<short> tiplocsFrom, IEnumerable<short> tiplocsTo, DateTime date, TimeSpan startTime, TimeSpan endTime, string atocCode, PowerType? powerType) { var schedules = GetDistinctSchedules(GetRunningCallingBetweenSchedules(tiplocsFrom, tiplocsTo, date, startTime, endTime, atocCode, powerType), date, atocCode, powerType); return GetRunningTrainSchedules(schedules, date); }
public ActivatedPower(PowerType type, int PlayerNum) { this.type = type; this.PlayerNum = PlayerNum; }
private IEnumerable<ScheduleHolder> GetRunningCallingBetweenSchedules(IEnumerable<short> tiplocsFrom, IEnumerable<short> tiplocsTo, DateTime date, TimeSpan startTime, TimeSpan endTime, string atocCode, PowerType? powerType) { if (!tiplocsFrom.Any() || !tiplocsTo.Any()) return Enumerable.Empty<ScheduleHolder>(); const string getSchedulesSql = @" SELECT [ScheduleTrain].[ScheduleId] ,[ScheduleTrain].[TrainUid] ,[ScheduleTrain].[STPIndicatorId] FROM [ScheduleTrain] INNER JOIN [ScheduleTrainStop] [FromStop] ON [ScheduleTrain].[ScheduleId] = [FromStop].[ScheduleId] INNER JOIN [ScheduleTrainStop] [ToStop] ON [ScheduleTrain].[ScheduleId] = [ToStop].[ScheduleId] WHERE [FromStop].[TiplocId] IN @tiplocsFrom AND [ToStop].[TiplocId] IN @tiplocsTo AND [FromStop].[StopNumber] < [ToStop].[StopNumber] AND [ScheduleTrain].[Runs{0}] = 1 AND @date >= [ScheduleTrain].[StartDate] AND @date <= [ScheduleTrain].[EndDate] AND COALESCE([FromStop].[Arrival], [FromStop].[Departure], [FromStop].[Pass]) >= @startTime AND COALESCE([FromStop].[Arrival], [FromStop].[Departure], [FromStop].[Pass]) < @endTime AND [ScheduleTrain].[Deleted] = 0{1}{2} ORDER BY COALESCE([FromStop].[Arrival], [FromStop].[Departure], [FromStop].[Pass])"; return Query<ScheduleHolder>(string.Format(getSchedulesSql, date.DayOfWeek, (!string.IsNullOrEmpty(atocCode) ? _atocCodeFilter : string.Empty), (powerType.HasValue ? _powerTypeFilter : string.Empty)), new { tiplocsFrom, tiplocsTo, date = date.Date, startTime, endTime, atocCode, powerType }); }
private IEnumerable<RunningScheduleTrain> GetTerminatingAtSchedules(IEnumerable<short> tiplocs, DateTime date, TimeSpan startTime, TimeSpan endTime, string atocCode, PowerType? powerType) { var schedules = GetDistinctSchedules(GetRunningTerminatingAtSchedules(tiplocs, date, startTime, endTime, atocCode, powerType), date, atocCode, powerType); return GetRunningTrainSchedules(schedules, date); }
private IEnumerable<ScheduleHolder> GetRunningAtSchedules(IEnumerable<short> tiplocs, DateTime date, TimeSpan startTime, TimeSpan endTime, string atocCode, PowerType? powerType) { if (!tiplocs.Any()) return Enumerable.Empty<ScheduleHolder>(); const string sameDayTimeQuery = " AND COALESCE(Arrival, Departure, Pass) >= @startTime AND COALESCE(Arrival, Departure, Pass) < @endTime"; const string diffDayTimeQuery = " AND (COALESCE(Arrival, Departure, Pass) >= @startTime OR COALESCE(Arrival, Departure, Pass) < @endTime)"; const string getSchedulesSql = @" SELECT [ScheduleTrain].[ScheduleId] ,[ScheduleTrain].[TrainUid] ,[ScheduleTrain].[STPIndicatorId] FROM [ScheduleTrain] INNER JOIN [ScheduleTrainStop] ON [ScheduleTrain].[ScheduleId] = [ScheduleTrainStop].[ScheduleId] WHERE [ScheduleTrainStop].[TiplocId] IN @tiplocs AND [ScheduleTrain].[Runs{0}] = 1 AND @date >= [ScheduleTrain].[StartDate] AND @date <= [ScheduleTrain].[EndDate] {1}{2}{3} ORDER BY COALESCE(Arrival, Departure, Pass)"; return Query<ScheduleHolder>(string.Format(getSchedulesSql, date.DayOfWeek, endTime < startTime ? diffDayTimeQuery : sameDayTimeQuery, (!string.IsNullOrEmpty(atocCode) ? _atocCodeFilter : string.Empty), (powerType.HasValue ? _powerTypeFilter : string.Empty)), new { tiplocs, date = date.Date, startTime, endTime, atocCode, powerType }); }
/// <summary> /// this will pick up cancelled schedules which dont have any stops /// </summary> private IEnumerable<ScheduleHolder> GetMatchingSchedules(IEnumerable<ScheduleHolder> schedules, DateTime date, string atocCode, PowerType? powerType) { if (!schedules.Any()) return Enumerable.Empty<ScheduleHolder>(); const string sql = @" SELECT [ScheduleTrain].[ScheduleId] ,[ScheduleTrain].[TrainUid] ,[ScheduleTrain].[STPIndicatorId] FROM [ScheduleTrain] WHERE [TrainUid] IN @trainUids AND @date >= [StartDate] AND @date <= [EndDate] AND [Deleted] = 0 AND [Runs{0}] = 1{1}{2} ORDER BY [STPIndicatorId]"; return Query<ScheduleHolder>(string.Format(sql, date.DayOfWeek, (!string.IsNullOrEmpty(atocCode) ? _atocCodeFilter : string.Empty), (powerType.HasValue ? _powerTypeFilter : string.Empty)), new { trainUids = schedules.Select(t => t.TrainUid).Distinct(), date = date.Date, atocCode, powerType }); }
private IEnumerable<ScheduleHolder> GetDistinctSchedules(IEnumerable<ScheduleHolder> schedules, DateTime date, string atocCode, PowerType? powerType) { if (!schedules.Any()) return Enumerable.Empty<ScheduleHolder>(); return schedules .Union(GetMatchingSchedules(schedules, date, atocCode, powerType)) .GroupBy(s => s.TrainUid) .Select(s => { var firstSchedule = s .OrderBy(sub => sub.STPIndicatorId) .First(); // if is cancellation then wont have any stops associated, so get previous schedule if applicable if (firstSchedule.STPIndicatorId == STPIndicator.Cancellation) { firstSchedule.StopsScheduleId = s .Except(new[] { firstSchedule }) .OrderBy(sub => sub.STPIndicatorId) .Select(sub => sub.ScheduleId) .FirstOrDefault(); } // store all potential schedule ids firstSchedule.ScheduleIds = s.Select(sc => sc.ScheduleId).ToList(); return firstSchedule; }) .ToList(); }
public static void SetPowerRegenCalculator(PowerType type, RegenCalculator calc) { PowerRegenCalculators[(int)type] = calc; }
public int CalcPowerCost(Unit caster, DamageSchool school, Spell spell, PowerType type) { var cost = PowerCost + (PowerCostPerlevel * GetMaxLevelDiff(caster.Level)); if (PowerCostPercentage > 0) { cost += (PowerCostPercentage * ((type == PowerType.Health ? caster.BaseHealth : caster.BasePower))) / 100; } return caster.GetPowerCost(school, spell, cost); }
private void UpdateControllerPowerCal(PowerType powerType, BindingSource bsCalValues, BindingSource bsRC_B_vals) { UInt16[] CalList = new UInt16[5]; Single[] RCList = new Single[4]; Single[] BList = new Single[4]; // sort ascending using the ADC column bsCalValues.Sort = "ADC ASC"; int i = 0; foreach (DataRowView row in bsRC_B_vals) { i++; RCList[i-1] = Convert.ToSingle(row["RC"]); BList[i-1] = Convert.ToSingle(row["B"]); if (i == 4) break; } i = 0; foreach (DataRowView row in bsCalValues) { i++; CalList[i-1] = Convert.ToUInt16(row["ADC"]); if (i == 5) break; } comm.SendMessage(Main.MsgIDsToMCU.SET_CAL_POWERS_ADC2W_RC_B, (byte)powerType, (byte)i , CalList, RCList, BList ); tabPagePower_Enter(null, null); // request refresh data }
/// <summary> /// Correct for 3.0.9 /// </summary> /// <param name="caster"></param> /// <param name="target"></param> /// <param name="spellId"></param> /// <param name="powerType"></param> /// <param name="value"></param> public static void SendEnergizeLog(WorldObject caster, Unit target, uint spellId, PowerType powerType, int value) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELLENERGIZELOG, 25)) { target.EntityId.WritePacked(packet); caster.EntityId.WritePacked(packet); packet.Write(spellId); packet.Write((int)powerType); packet.Write(value); caster.SendPacketToArea(packet, true, false); } }
/// <summary> /// Correct for 3.0.9 /// </summary> /// <param name="caster"></param> /// <param name="target"></param> /// <param name="spellId"></param> /// <param name="powerType"></param> /// <param name="value"></param> public static void SendEnergizeLog(WorldObject caster, Unit target, uint spellId, PowerType powerType, int value) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELLENERGIZELOG, 25)) { target.EntityId.WritePacked(packet); caster.EntityId.WritePacked(packet); packet.Write(spellId); packet.Write(value); packet.Write((int)powerType); caster.SendPacketToArea(packet, true); } }
//This happens for every game where victory isnt being declared void RoundFinish(float roundscore, float totalscore, string playername, int playernumber, GameObject playerpose, PowerType lastdeath){ DisplayDeath(lastdeath, playernumber); //Instantiate Label Objects var playerlabel = (GameObject)Instantiate(PlayerLabel, new Vector2(0,0), transform.rotation); var killlabel = (GameObject)Instantiate(KillLabel, new Vector2(0,0), transform.rotation); var favorlabel = (GameObject)Instantiate(FavorLabel, new Vector2(0,0), transform.rotation); //Add them to the UI playerlabel.transform.parent = GameObject.Find("UI Root").transform; playerpose.transform.parent = GameObject.Find ("UI Root").transform; killlabel.transform.parent = GameObject.Find("UI Root").transform; favorlabel.transform.parent = GameObject.Find("UI Root").transform; //Rescale them to fit properly playerlabel.transform.localScale = new Vector3(1, 1, 1); playerpose.transform.localScale = new Vector3(80,80,1); favorlabel.transform.localScale = new Vector3(1,1,1); killlabel.transform.localScale = new Vector3(1,1,1); //Locate them to the proper locations playerlabel.transform.localPosition = new Vector2(-444, 350+(-150*playernumber)); playerpose.transform.localPosition = new Vector2(-200, 350+(-150*playernumber)); killlabel.transform.localPosition = new Vector2(350, 350+(-150*playernumber)); favorlabel.transform.localPosition = new Vector2(520, 350+(-150*playernumber)); //Find the Text component var playertext = playerlabel.GetComponent<UILabel>(); var killstext = killlabel.GetComponent<UILabel>(); var favortext = favorlabel.GetComponent<UILabel>(); //Add score text to the box playertext.text = playername; killstext.text = "+" + roundscore; favortext.text = "" + totalscore; //need ref to time label since it is constantly updated }
// Use this for initialization void Start() { EnablePowerup(false); CurrentPower = PowerType.SpeedBoost; }
public static void SendPowerUpdate(Unit unit, PowerType type, int value) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_POWER_UPDATE, 17)) { unit.EntityId.WritePacked(packet); packet.Write((byte)type); packet.Write(value); unit.SendPacketToArea(packet, true); } }
public DrawCardResult(PowerType powerType) { this.PowerType = powerType; }
/// <summary> /// Process the power command /// </summary> /// <param name="command"></param> private void RunPowerCommand(PowerType command) { using (PowerVM power = new PowerVM()) { power.ProcessPowerCommand(command); } }
public PowerPctOrderPred(PowerType power, bool ascending = true) { m_power = power; m_ascending = ascending; }
public static void SetPowerRegenCalculator(PowerType type, RegenCalculator calc) { RegenerationFormulas.PowerRegenCalculators[(int)type] = calc; }
public Power(string name, int price, PowerType powerType, int minXp) : base(name, price) { this.PowerType = powerType; this.MinXp = minXp; }
public static void SetBasePowerCalculator(PowerType type, RegenCalculator calc) { RegenerationFormulas.BasePowerForLevelCalculators[(int)type] = calc; }
public override void UpdateMaxPower(PowerType power) { }
public void ActivateTalentGroup(ChrSpecializationRecord spec) { if (GetActiveTalentGroup() == spec.OrderIndex) { return; } if (IsNonMeleeSpellCast(false)) { InterruptNonMeleeSpells(false); } SQLTransaction trans = new SQLTransaction(); _SaveActions(trans); DB.Characters.CommitTransaction(trans); // TO-DO: We need more research to know what happens with warlock's reagent Pet pet = GetPet(); if (pet) { RemovePet(pet, PetSaveMode.NotInSlot); } ClearAllReactives(); UnsummonAllTotems(); ExitVehicle(); RemoveAllControlled(); // remove single target auras at other targets var scAuras = GetSingleCastAuras(); foreach (var aura in scAuras) { if (aura.GetUnitOwner() != this) { aura.Remove(); } } // Let client clear his current Actions SendActionButtons(2); foreach (var talentInfo in CliDB.TalentStorage.Values) { // unlearn only talents for character class // some spell learned by one class as normal spells or know at creation but another class learn it as talent, // to prevent unexpected lost normal learned spell skip another class talents if (talentInfo.ClassID != (int)GetClass()) { continue; } if (talentInfo.SpellID == 0) { continue; } SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID, Difficulty.None); if (spellInfo == null) { continue; } RemoveSpell(talentInfo.SpellID, true); // search for spells that the talent teaches and unlearn them foreach (SpellEffectInfo effect in spellInfo.GetEffects()) { if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell) { RemoveSpell(effect.TriggerSpell, true); } } if (talentInfo.OverridesSpellID != 0) { RemoveOverrideSpell(talentInfo.OverridesSpellID, talentInfo.SpellID); } } foreach (var talentInfo in CliDB.PvpTalentStorage.Values) { SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID, Difficulty.None); if (spellInfo == null) { continue; } RemoveSpell(talentInfo.SpellID, true); // search for spells that the talent teaches and unlearn them foreach (SpellEffectInfo effect in spellInfo.GetEffects()) { if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell) { RemoveSpell(effect.TriggerSpell, true); } } if (talentInfo.OverridesSpellID != 0) { RemoveOverrideSpell(talentInfo.OverridesSpellID, talentInfo.SpellID); } } // Remove spec specific spells RemoveSpecializationSpells(); foreach (uint glyphId in GetGlyphs(GetActiveTalentGroup())) { RemoveAurasDueToSpell(CliDB.GlyphPropertiesStorage.LookupByKey(glyphId).SpellID); } SetActiveTalentGroup(spec.OrderIndex); SetPrimarySpecialization(spec.Id); foreach (var talentInfo in CliDB.TalentStorage.Values) { // learn only talents for character class if (talentInfo.ClassID != (int)GetClass()) { continue; } if (talentInfo.SpellID == 0) { continue; } if (HasTalent(talentInfo.Id, GetActiveTalentGroup())) { LearnSpell(talentInfo.SpellID, false); // add the talent to the PlayerSpellMap if (talentInfo.OverridesSpellID != 0) { AddOverrideSpell(talentInfo.OverridesSpellID, talentInfo.SpellID); } } } for (byte slot = 0; slot < PlayerConst.MaxPvpTalentSlots; ++slot) { PvpTalentRecord talentInfo = CliDB.PvpTalentStorage.LookupByKey(GetPvpTalentMap(GetActiveTalentGroup())[slot]); if (talentInfo == null) { continue; } if (talentInfo.SpellID == 0) { continue; } AddPvpTalent(talentInfo, GetActiveTalentGroup(), slot); } LearnSpecializationSpells(); if (CanUseMastery()) { for (uint i = 0; i < PlayerConst.MaxMasterySpells; ++i) { uint mastery = spec.MasterySpellID[i]; if (mastery != 0) { LearnSpell(mastery, false); } } } InitTalentForLevel(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_ACTIONS_SPEC); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, GetActiveTalentGroup()); WorldSession mySess = GetSession(); mySess.GetQueryProcessor().AddCallback(DB.Characters.AsyncQuery(stmt).WithCallback(result => { // in case player logs out before db response (player would be deleted in that case) Player thisPlayer = mySess.GetPlayer(); if (thisPlayer != null) { thisPlayer.LoadActions(result); } })); UpdateDisplayPower(); PowerType pw = GetPowerType(); if (pw != PowerType.Mana) { SetPower(PowerType.Mana, 0); // Mana must be 0 even if it isn't the active power type. } SetPower(pw, 0); UpdateItemSetAuras(false); // update visible transmog for (byte i = EquipmentSlot.Start; i < EquipmentSlot.End; ++i) { Item equippedItem = GetItemByPos(InventorySlots.Bag0, i); if (equippedItem) { SetVisibleItemSlot(i, equippedItem); } } foreach (uint glyphId in GetGlyphs(spec.OrderIndex)) { CastSpell(this, CliDB.GlyphPropertiesStorage.LookupByKey(glyphId).SpellID, true); } ActiveGlyphs activeGlyphs = new ActiveGlyphs(); foreach (uint glyphId in GetGlyphs(spec.OrderIndex)) { List <uint> bindableSpells = Global.DB2Mgr.GetGlyphBindableSpells(glyphId); foreach (uint bindableSpell in bindableSpells) { if (HasSpell(bindableSpell) && !m_overrideSpells.ContainsKey(bindableSpell)) { activeGlyphs.Glyphs.Add(new GlyphBinding(bindableSpell, (ushort)glyphId)); } } } activeGlyphs.IsFullUpdate = true; SendPacket(activeGlyphs); Item item = GetItemByEntry(PlayerConst.ItemIdHeartOfAzeroth, ItemSearchLocation.Everywhere); if (item != null) { AzeriteItem azeriteItem = item.ToAzeriteItem(); if (azeriteItem != null) { if (azeriteItem.IsEquipped()) { ApplyAllAzeriteEmpoweredItemMods(false); ApplyAzeritePowers(azeriteItem, false); } azeriteItem.SetSelectedAzeriteEssences(spec.Id); if (azeriteItem.IsEquipped()) { ApplyAzeritePowers(azeriteItem, true); ApplyAllAzeriteEmpoweredItemMods(true); } azeriteItem.SetState(ItemUpdateState.Changed, this); } } var shapeshiftAuras = GetAuraEffectsByType(AuraType.ModShapeshift); foreach (AuraEffect aurEff in shapeshiftAuras) { aurEff.HandleShapeshiftBoosts(this, false); aurEff.HandleShapeshiftBoosts(this, true); } }
public static void SetBasePowerCalculator(PowerType type, RegenCalculator calc) { BasePowerForLevelCalculators[(int)type] = calc; }
public void ActivateTalentGroup(ChrSpecializationRecord spec) { if (GetActiveTalentGroup() == spec.OrderIndex) { return; } if (IsNonMeleeSpellCast(false)) { InterruptNonMeleeSpells(false); } SQLTransaction trans = new SQLTransaction(); _SaveActions(trans); DB.Characters.CommitTransaction(trans); // TO-DO: We need more research to know what happens with warlock's reagent Pet pet = GetPet(); if (pet) { RemovePet(pet, PetSaveMode.NotInSlot); } ClearAllReactives(); UnsummonAllTotems(); ExitVehicle(); RemoveAllControlled(); // Let client clear his current Actions SendActionButtons(2); foreach (var talentInfo in CliDB.TalentStorage.Values) { // unlearn only talents for character class // some spell learned by one class as normal spells or know at creation but another class learn it as talent, // to prevent unexpected lost normal learned spell skip another class talents if (talentInfo.ClassID != (int)GetClass()) { continue; } if (talentInfo.SpellID == 0) { continue; } SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID); if (spellInfo == null) { continue; } RemoveSpell(talentInfo.SpellID, true); // search for spells that the talent teaches and unlearn them foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(Difficulty.None)) { if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell) { RemoveSpell(effect.TriggerSpell, true); } } if (talentInfo.OverridesSpellID != 0) { RemoveOverrideSpell(talentInfo.OverridesSpellID, talentInfo.SpellID); } } // Remove spec specific spells RemoveSpecializationSpells(); foreach (uint glyphId in GetGlyphs(GetActiveTalentGroup())) { RemoveAurasDueToSpell(CliDB.GlyphPropertiesStorage.LookupByKey(glyphId).SpellID); } SetActiveTalentGroup(spec.OrderIndex); SetUInt32Value(PlayerFields.CurrentSpecId, spec.Id); if (GetPrimarySpecialization() == 0) { SetPrimarySpecialization(spec.Id); } foreach (var talentInfo in CliDB.TalentStorage.Values) { // learn only talents for character class if (talentInfo.ClassID != (int)GetClass()) { continue; } if (talentInfo.SpellID == 0) { continue; } if (HasTalent(talentInfo.SpellID, GetActiveTalentGroup())) { LearnSpell(talentInfo.SpellID, false); // add the talent to the PlayerSpellMap if (talentInfo.OverridesSpellID != 0) { AddOverrideSpell(talentInfo.OverridesSpellID, talentInfo.SpellID); } } } LearnSpecializationSpells(); if (CanUseMastery()) { for (uint i = 0; i < PlayerConst.MaxMasterySpells; ++i) { uint mastery = spec.MasterySpellID[i]; if (mastery != 0) { LearnSpell(mastery, false); } } } InitTalentForLevel(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_ACTIONS_SPEC); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, GetActiveTalentGroup()); _LoadActions(DB.Characters.Query(stmt)); SendActionButtons(1); UpdateDisplayPower(); PowerType pw = getPowerType(); if (pw != PowerType.Mana) { SetPower(PowerType.Mana, 0); // Mana must be 0 even if it isn't the active power type. } SetPower(pw, 0); UpdateItemSetAuras(false); // update visible transmog for (byte i = EquipmentSlot.Start; i < EquipmentSlot.End; ++i) { Item equippedItem = GetItemByPos(InventorySlots.Bag0, i); if (equippedItem) { SetVisibleItemSlot(i, equippedItem); } } foreach (uint glyphId in GetGlyphs(spec.OrderIndex)) { CastSpell(this, CliDB.GlyphPropertiesStorage.LookupByKey(glyphId).SpellID, true); } ActiveGlyphs activeGlyphs = new ActiveGlyphs(); foreach (uint glyphId in GetGlyphs(spec.OrderIndex)) { List <uint> bindableSpells = Global.DB2Mgr.GetGlyphBindableSpells(glyphId); foreach (uint bindableSpell in bindableSpells) { if (HasSpell(bindableSpell) && !m_overrideSpells.ContainsKey(bindableSpell)) { activeGlyphs.Glyphs.Add(new GlyphBinding(bindableSpell, (ushort)glyphId)); } } } activeGlyphs.IsFullUpdate = true; SendPacket(activeGlyphs); }
public static void AddPower(PowerType type, int PlayerNum) { //start effect for player for (int i = 0; i < MAX_ACTIVE_POWERS; i++) { if (!playerPowers[PlayerNum][i].active) { if (PlayerCollection.ChargeMoneyForPlayer(PlayerNum, powerInformation[(int)type].cost)) { playerPowers[PlayerNum][i].active = true; playerPowers[PlayerNum][i].Type = type; playerPowers[PlayerNum][i].PlayerNum = PlayerNum; activatedPowers.Add(new ActivatedPower(type, PlayerNum)); switch (type) { case PowerType.StrongTowers: StrongTowers(PlayerNum); playerPowers[PlayerNum][i].maxTime = rand.Next(10000, 30000); playerPowers[PlayerNum][i].timeLeft = 0; break; case PowerType.Rezoning: Rezone(PlayerNum); playerPowers[PlayerNum][i].maxTime = rand.Next(5000, 10000); playerPowers[PlayerNum][i].timeLeft = 0; break; case PowerType.FreezeEnemies: FreezeEnemies(PlayerNum); playerPowers[PlayerNum][i].maxTime = rand.Next(5000, 10000); playerPowers[PlayerNum][i].timeLeft = 0; break; case PowerType.EMP: EMP(PlayerNum); playerPowers[PlayerNum][i].maxTime = rand.Next(5000, 15000); playerPowers[PlayerNum][i].timeLeft = 0; break; case PowerType.Bombastic: Bombastic(PlayerNum); playerPowers[PlayerNum][i].active = false; //instance activation break; } break; } } } }
void Update() { if (actualPlayer == 1) { if (Input.GetKeyDown(KeyCode.RightArrow)) { switch (powerText.text) { case "Bomb": powerText.text = PowerType.Jump.ToString(); break; case "Jump": powerText.text = PowerType.TractorBeam.ToString(); break; case "TractorBeam": powerText.text = PowerType.Bomb.ToString(); break; } PowerTextAnimation(); // Audio audioSource.clip = moveSelection; audioSource.Play(); } if (Input.GetKeyDown(KeyCode.LeftArrow)) { switch (powerText.text) { case "Bomb": powerText.text = PowerType.TractorBeam.ToString(); break; case "Jump": powerText.text = PowerType.Bomb.ToString(); break; case "TractorBeam": powerText.text = PowerType.Jump.ToString(); break; } PowerTextAnimation(); // Audio audioSource.clip = moveSelection; audioSource.Play(); } if (Input.GetKeyDown(KeyCode.P)) { powerJ1 = (PowerType)System.Enum.Parse(typeof(PowerType), powerText.text); actualPlayer = 2; playerText.text = "Player 2 :\nChoose your powerized crab !"; press.text = "Press C to select, Q & D to choose"; // Audio audioSource.clip = validateSelection; audioSource.Play(); } } if (actualPlayer == 2) { if (Input.GetKeyDown(KeyCode.Q) || (Input.GetKeyDown(KeyCode.A))) { switch (powerText.text) { case "Bomb": powerText.text = PowerType.Jump.ToString(); break; case "Jump": powerText.text = PowerType.TractorBeam.ToString(); break; case "TractorBeam": powerText.text = PowerType.Bomb.ToString(); break; } PowerTextAnimation(); // Audio audioSource.clip = moveSelection; audioSource.Play(); } if (Input.GetKeyDown(KeyCode.D)) { switch (powerText.text) { case "Bomb": powerText.text = PowerType.TractorBeam.ToString(); break; case "Jump": powerText.text = PowerType.Bomb.ToString(); break; case "TractorBeam": powerText.text = PowerType.Jump.ToString(); break; } PowerTextAnimation(); // Audio audioSource.clip = moveSelection; audioSource.Play(); } if (Input.GetKeyDown(KeyCode.C)) { powerJ2 = (PowerType)System.Enum.Parse(typeof(PowerType), powerText.text); // Audio audioSource.clip = validateSelection; audioSource.Play(); // Load Next scene DOTween.Clear(true); StartCoroutine(LoadGame()); } } }
public List <PowerGame> Parse(bool createJsonFile, bool createCleanLog) { List <PowerGame> powerGames = new List <PowerGame>(); // PowerState currentPowerState = PowerState.Start; // PowerGame currentPowerGame = null; PowerType currentPowerType = 0; // Dictionary<string, int> currentNameToIdDict; // PowerHistoryEntry currentPowerHistoryEntry = null; StringBuilder cleanLog = new StringBuilder(); string line; while ((line = file.ReadLine()) != null) { Match matchLogRgx = logRgx.Match(line); if (matchLogRgx.Success) { string entryType = matchLogRgx.Groups[1].Value; string timestamp = matchLogRgx.Groups[2].Value; string classType = matchLogRgx.Groups[3].Value; string debugType = matchLogRgx.Groups[4].Value; string content = matchLogRgx.Groups[5].Value; if (!classType.Equals("GameState") || debugType.Equals("DebugPrintOptions")) { continue; } string contentLine = content.Trim(); cleanLog.AppendLine($"{("[" + debugType.ToString() + "] ").PadLeft(27)}{content}"); PowerType nextPowerType; if (Enum.TryParse <PowerType>(contentLine.Split(' ')[0], out nextPowerType)) { currentPowerType = nextPowerType; } ; switch (currentPowerType) { case PowerType.CREATE_GAME: break; } } else { Console.WriteLine("matchLogRgx: '" + line + "'"); } } if (createJsonFile) { string jsonStr = JsonConvert.SerializeObject(powerGames, Formatting.Indented, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All }); File.WriteAllText(filePath + "powerLog.json", jsonStr); } if (createCleanLog) { File.WriteAllText(filePath + "cleanLog.log", cleanLog.ToString()); } //while (powerGame.PowerHistory.Count > 0) //{ // var powerHistoryEntry = powerGame.PowerHistory.Dequeue(); // powerHistoryEntry.Process(powerGame); //} //File.WriteAllText(filePath + "powerLogProc.json", JsonConvert.SerializeObject(powerGame, Formatting.Indented)); return(powerGames); }
//Visually display death for players void DisplayDeath(PowerType lastdeath, int playernumber){ print ("goober"); if(lastdeath != PowerType.UNDEFINED){ GameObject label; if(PowerType.ELECTRIC == lastdeath){ label = (GameObject)Instantiate(electricicon, new Vector2(0,0), transform.rotation); } else if(PowerType.BOULDER == lastdeath){ label = (GameObject)Instantiate(bouldericon, new Vector2(0,0), transform.rotation); } else if(PowerType.EARTH == lastdeath){ label = (GameObject)Instantiate(earthicon, new Vector2(0,0), transform.rotation); } else if(PowerType.EXPLOSIVE == lastdeath){ label = (GameObject)Instantiate(stickyicon, new Vector2(0,0), transform.rotation); } else if(PowerType.FIREBALL == lastdeath){ label = (GameObject)Instantiate(fireicon, new Vector2(0,0), transform.rotation); } else if(PowerType.FREEZE == lastdeath){ label = (GameObject)Instantiate(iceicon, new Vector2(0,0), transform.rotation); } else if(PowerType.POWERHOOK == lastdeath){ label = (GameObject)Instantiate(hookicon, new Vector2(0,0), transform.rotation); } else if(PowerType.BH_INNER == lastdeath || PowerType.BH_OUTER == lastdeath){ label = (GameObject)Instantiate(blackholeicon, new Vector2(0,0), transform.rotation); } else if(PowerType.PLAGUE == lastdeath){ label = (GameObject)Instantiate(plagueicon, new Vector2(0,0), transform.rotation); } else if(PowerType.SPIKES == lastdeath){ label = (GameObject)Instantiate(spikeicon, new Vector2(0,0), transform.rotation); }else if(PowerType.DEFLECTIVE == lastdeath){ label = (GameObject)Instantiate(deflecticon, new Vector2(0,0), transform.rotation); }else if(PowerType.FREEZE == lastdeath){ label = (GameObject)Instantiate(freezeicon, new Vector2(0,0), transform.rotation); } else { print ("Trophy Bug" + lastdeath); label = (GameObject)Instantiate(spikeicon, new Vector2(0,0), transform.rotation); } label.transform.parent = GameObject.Find("UI Root").transform; label.transform.localScale = new Vector3(60,60,1); label.transform.localPosition = new Vector2(550, 1200+(-550*playernumber)); } }
protected CardAttribute(string name, int cost, PowerType type, Element[] elements) : this(name, cost, type, new ElementCounts(elements)) { }
private IEnumerable<TrainMovementResult> CallingBetween(IEnumerable<short> tiplocsFrom, IEnumerable<short> tiplocsTo, DateTime startDate, DateTime endDate, string atocCode, PowerType? powerType) { IEnumerable<RunningScheduleTrain> nextDaySchedules = null; if (startDate.Date != endDate.Date) { nextDaySchedules = GetCallingBetweenSchedules(tiplocsFrom, tiplocsTo, endDate.Date, endDate.Date.TimeOfDay, endDate.TimeOfDay, atocCode, powerType); endDate = startDate.Date.AddDays(1).AddMinutes(-1); } else { nextDaySchedules = Enumerable.Empty<RunningScheduleTrain>(); } var allSchedules = GetCallingBetweenSchedules(tiplocsFrom, tiplocsTo, startDate.Date, startDate.TimeOfDay, endDate.TimeOfDay, atocCode, powerType) .Union(nextDaySchedules) .ToList(); // need to get live running data between these dates startDate = startDate.Date; endDate = endDate.Date.AddDays(1); var allActualData = GetActualSchedule(allSchedules.SelectMany(s => s.ScheduleIds).Distinct(), startDate, endDate); IEnumerable<ExtendedCancellation> cancellations = null; IEnumerable<Reinstatement> reinstatements = null; IEnumerable<ChangeOfOrigin> changeOfOrigins = null; if (allActualData.Any()) { using (DbConnection connection = CreateAndOpenConnection()) { cancellations = GetCancellations(allActualData.Select(s => s.Id), connection) .ToList(); reinstatements = GetReinstatements(allActualData.Select(s => s.Id), connection) .ToList(); changeOfOrigins = GetChangeOfOrigins(allActualData.Select(s => s.Id), connection) .ToList(); } } else { cancellations = Enumerable.Empty<ExtendedCancellation>(); reinstatements = Enumerable.Empty<Reinstatement>(); changeOfOrigins = Enumerable.Empty<ChangeOfOrigin>(); } ICollection<TrainMovementResult> results = new List<TrainMovementResult>(allSchedules.Count()); foreach (var schedule in allSchedules) { var actual = allActualData.FirstOrDefault(a => schedule.ScheduleIds.Contains(a.ScheduleId)); var can = actual != null ? cancellations.Where(c => c.TrainId == actual.Id).ToList() : Enumerable.Empty<ExtendedCancellation>(); var rein = actual != null ? reinstatements.Where(c => c.TrainId == actual.Id).ToList() : Enumerable.Empty<Reinstatement>(); var coo = actual != null ? changeOfOrigins.Where(c => c.TrainId == actual.Id).ToList() : Enumerable.Empty<ChangeOfOrigin>(); results.Add(new TrainMovementResult { Schedule = schedule, Actual = actual, Cancellations = can, Reinstatements = rein, ChangeOfOrigins = coo }); } return results .Where(s => { return s.Schedule.Stops != null && ( s.Schedule.Stops.Any(st => tiplocsFrom.Contains(st.Tiploc.TiplocId)) && s.Schedule.Stops.Any(st => tiplocsTo.Contains(st.Tiploc.TiplocId))); }) .OrderBy(s => s.Schedule.DateFor) .ThenBy(s => { if (s.Schedule.Stops == null || !s.Schedule.Stops.Any()) return default(TimeSpan?); var tiplocStops = s.Schedule.Stops.Where(stop => tiplocsFrom.Contains(stop.Tiploc.TiplocId)); if (!tiplocStops.Any()) return default(TimeSpan?); var firstStop = tiplocStops.First(); return firstStop.Departure ?? firstStop.PublicDeparture ?? firstStop.Pass; }); }