private void SessionOnLoginFailed(FailReason reason) { SendOutMessage(new ConnectMessage { Error = new InvalidOperationException(reason.GetDescription()) }); }
public override void OnLoadingFailed(string imageUri, View view, FailReason failReason) { string message = null; if (failReason.Type == FailReason.FailType.IoError) { message = "Input/Output error"; } else if (failReason.Type == FailReason.FailType.DecodingError) { message = "Image can't be decoded"; } else if (failReason.Type == FailReason.FailType.NetworkDenied) { message = "Downloads are denied"; } else if (failReason.Type == FailReason.FailType.OutOfMemory) { message = "Out Of Memory error"; } else if (failReason.Type == FailReason.FailType.Unknown) { message = "Unknown error"; } Toast.MakeText(view.Context, message, ToastLength.Short).Show(); mSpinner.Visibility = ViewStates.Gone; }
static void OnFailedEventHandler(string zoneId, FailReason reason) { if (OnFailed != null) { OnFailed(zoneId, reason); } }
/// <summary> /// asynchronously wait for GameEvent to be processed /// </summary> /// <returns>waitable task </returns> public async Task <GameEvent> WaitAsync(TimeSpan timeSpan, CancellationToken token) { bool processed = false; #if DEBUG Owner?.Logger.WriteDebug($"Begin wait for event {Id}"); #endif try { processed = await Task.Run(() => _eventFinishedWaiter.WaitOne(timeSpan), token); } catch (TaskCanceledException) { processed = true; } if (!processed) { Owner?.Logger.WriteError("Waiting for event to complete timed out"); Owner?.Logger.WriteDebug($"{Id}, {Type}, {Data}, {Extra}, {FailReason.ToString()}, {Message}, {Origin}, {Target}"); #if DEBUG //throw new Exception(); #endif } // this lets us know if the the action timed out FailReason = FailReason == EventFailReason.None && !processed ? EventFailReason.Timeout : FailReason; return(this); }
void HandleError(XElement element, FailReason failReason) { string innerXml = null; string elementXml; var firstOrDefault = element.Ancestors("SerializedObject").FirstOrDefault(); if (firstOrDefault != null && firstOrDefault != element) { innerXml = element.ToString(); elementXml = firstOrDefault.ToString(); } else { elementXml = element.ToString(); } if (_errorHandling == ErrorHandling.CreateErrorObjects) { var errorInfoObject = (IIOError)_objectSpace.CreateObject(XafTypesInfo.Instance.FindBussinessObjectType <IIOError>()); errorInfoObject.Reason = failReason; errorInfoObject.ElementXml = elementXml; errorInfoObject.InnerXml = innerXml; } else if (_errorHandling == ErrorHandling.ThrowException) { throw new UserFriendlyException(new Exception("ImportFailed", new Exception("Reason=" + failReason + "ELEMENTXML=" + elementXml + " INNERXML=" + innerXml))); } }
public IResponse GetResponse(bool isSuccess, object data, FailReason failReason) { _response.IsSuccess = isSuccess; _response.Data = data; _response.FailReason = failReason; return(_response); }
public IResponse GetResponse(bool isSuccess, FailReason failReason) { _response.IsSuccess = isSuccess; _response.Data = null; _response.FailReason = failReason; return(_response); }
public static string GetDescription(this FailReason reason) { switch (reason) { case FailReason.DataError: return(LocalizedStrings.Str2580); case FailReason.Disabled: return(LocalizedStrings.Str2581); case FailReason.DisconnectedByOwner: return(LocalizedStrings.Str2582); case FailReason.Expired: return(LocalizedStrings.Str2583); case FailReason.InvalidClientVersion: return(LocalizedStrings.Str2584); case FailReason.InvalidUserOrPassword: return(LocalizedStrings.Str2585); case FailReason.Locked: return(LocalizedStrings.Str2586); case FailReason.SoftwareNotPermitted: return(LocalizedStrings.Str2587); case FailReason.UserAlreadyConnected: return(LocalizedStrings.Str2588); } return(reason.ToString()); }
void HandleError(XElement element, FailReason failReason, ElementSchema elementSchema, IObjectSpace objectSpace = null) { objectSpace = objectSpace ?? _objectSpace; string innerXml = null; string elementXml; var firstOrDefault = element.Ancestors(elementSchema.SerializedObject).FirstOrDefault(); if (firstOrDefault != null && firstOrDefault != element) { innerXml = element.ToString(); elementXml = firstOrDefault.ToString(); } else { elementXml = element.ToString(); } if (_errorHandling == ErrorHandling.CreateErrorObjects) { var errorInfoObject = objectSpace.Create <IIOError>(); errorInfoObject.Reason = failReason; errorInfoObject.ElementXml = elementXml; errorInfoObject.InnerXml = innerXml; objectSpace.CommitChanges(); throw new UserFriendlyException("Import failed check IOError list for details."); } if (_errorHandling == ErrorHandling.ThrowException) { throw new UserFriendlyException(new Exception("ImportFailed", new Exception("Reason=" + failReason + "ELEMENTXML=" + elementXml + " INNERXML=" + innerXml))); } }
public static void Fail(this Dispatcher dispatcher, FailReason reason, Action shutdown) { const string CAPTION = "Failure"; string message = null; switch (reason) { case FailReason.EarlyStageInitFailure: message = PR.EarlyStageInitFailure; break; case FailReason.FailureDialogInternalError: message = PR.FailureDialogInternalError; break; } dispatcher.BeginInvoke((Action)(() => { Modal.FailureDialog(null, CAPTION, message); shutdown(); })); }
private async Task UploadFailed(UploadInfo uploaditem, FailReason reason, string message) { switch (reason) { case FailReason.ZeroLength: var item = await FetchNode(uploaditem.Path); item?.MakeNotUploading(); await onStatisticsUpdated(cloud, StatisticUpdateReason.UploadFinished, new UploadStatisticInfo(uploaditem)); return; case FailReason.FileNotFound: case FailReason.Conflict: case FailReason.NoFolderNode: await onStatisticsUpdated(cloud, StatisticUpdateReason.UploadAborted, new UploadStatisticInfo(uploaditem, message)); return; case FailReason.Cancelled: if (!uploaditem.Overwrite) { itemsTreeCache.DeleteFile(uploaditem.Path); } await onStatisticsUpdated(cloud, StatisticUpdateReason.UploadFinished, new UploadStatisticInfo(uploaditem)); return; } await onStatisticsUpdated(cloud, StatisticUpdateReason.UploadFailed, new UploadStatisticInfo(uploaditem, message)); itemsTreeCache.DeleteFile(uploaditem.Path); }
public OperatorData Failed(IActorRef parent, FailReason reason, string?errorData) { var failed = new TransferError(OperationId, reason, errorData); TargetManager.Tell(failed, parent); parent.Tell(failed.ToFailed()); return(Copy(failed: failed)); }
void IImageLoadingListener.OnLoadingFailed(string imageUri, View view, FailReason failReason) { var handler = loadingFailed; if (handler != null) { handler(imageUri, view, failReason); } }
private static HybridDictionary CreateColumnMaps(ICsvReader reader, CultureInfo culture, out FailReason failReson) { HybridDictionary returnVal = null; failReson = FailReason.None; var debitIndex = GetIndexOfKey(DebitKeys, reader.FieldHeaders, culture); if (debitIndex > -1) { var creditIndex = GetIndexOfKey(CreditKeys, reader.FieldHeaders, culture); if (creditIndex > -1) { var transactionDetailsIndex = GetIndexOfKey(TransactionDetailsKeys, reader.FieldHeaders, culture); if (transactionDetailsIndex > -1) { var transactionDateIndex = GetIndexOfKey(TransactionDateKeys, reader.FieldHeaders, culture); if (transactionDateIndex > -1) { //stupid bug in ING var noOffset = (transactionDateIndex == 0) || (debitIndex == 0) || (creditIndex == 0) || (transactionDetailsIndex == 0); returnVal = new HybridDictionary { ["Debit"] = noOffset ? debitIndex : debitIndex - 1, ["Credit"] = noOffset ? creditIndex : creditIndex - 1, ["TransactionDetails"] = noOffset ? transactionDetailsIndex : transactionDetailsIndex - 1, ["Date"] = noOffset ? transactionDateIndex : transactionDateIndex - 1 }; } else { failReson = FailReason.NoTransactionDateColumn; } } else { failReson = FailReason.NoTransactionDetailsColumn; } } else { failReson = FailReason.NoCreditColumn; } } else { failReson = FailReason.NoDebitColumn; } return(returnVal); }
private void SessionOnLoginFailed(FailReason reason) { SendOutMessage(new ConnectMessage { Error = new InvalidOperationException(reason.GetDescription()) }); SessionHolder.Session.Dispose(); SessionHolder.Session = null; _isSessionOwner = false; }
private void Fail(Action <FailReason> fail, FailReason reason) { if (fail != null) { fail(reason); } EventHandler <ErrorEventArgs> h = Error; if (h != null) { h(this, new ErrorEventArgs(reason)); } }
public override int GetHashCode() { int hash = 1; if (EncounterId.Length != 0) { hash ^= EncounterId.GetHashCode(); } if (AttemptNumber != 0) { hash ^= AttemptNumber.GetHashCode(); } if (Success != false) { hash ^= Success.GetHashCode(); } if (FailReason != 0) { hash ^= FailReason.GetHashCode(); } if (CastTime != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(CastTime); } if (FailedCheckpointNumber != 0) { hash ^= FailedCheckpointNumber.GetHashCode(); } if (AverageDrawingError != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(AverageDrawingError); } if (MedianDrawingError != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(MedianDrawingError); } if (FinalSpellbarScore != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(FinalSpellbarScore); } if (EncounterProtoId.Length != 0) { hash ^= EncounterProtoId.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override string ToString() { if (Success) { return("Successfully attached."); } string message = "Failed. Reason was: " + FailReason.ToString(); var exception = Exception; int exceptionNumber = 1; while (exception != null) { message += Environment.NewLine + exceptionNumber++ + ") " + GetStringFromException(exception); exception = exception.InnerException; } return(message); }
private async Task UploadFailed(UploadInfo uploaditem, FailReason reason, string message) { switch (reason) { case FailReason.FileNotFound: case FailReason.Conflict: case FailReason.ContentIdMismatch: case FailReason.NoFolderNode: await onStatisticsUpdated(cloud, StatisticUpdateReason.UploadAborted, new UploadStatisticInfo(uploaditem, message)); return; case FailReason.Cancelled: if (!uploaditem.Overwrite) { itemsTreeCache.DeleteFile(uploaditem.Path); } await onStatisticsUpdated(cloud, StatisticUpdateReason.UploadFinished, new UploadStatisticInfo(uploaditem)); return; case FailReason.NoResultNode: break; case FailReason.NoOverwriteNode: break; case FailReason.Unexpected: break; default: throw new ArgumentOutOfRangeException(nameof(reason), reason, null); } await onStatisticsUpdated(cloud, StatisticUpdateReason.UploadFailed, new UploadStatisticInfo(uploaditem, message)); itemsTreeCache.DeleteFile(uploaditem.Path); }
private bool InformFailedParse(int argPos, FailReason reason) { switch (reason) { case FailReason.ParseFailed: DevConsole.LogError($"Failed to run command. Failed to parse arg at pos {argPos}."); break; case FailReason.NoArgsPassed: DevConsole.LogError("Failed to run command. This command requires args to be passed."); break; case FailReason.NotEnoughArgs: DevConsole.LogError("Failed to run command. Not enough args passed."); break; default: DevConsole.LogError($"Failed to run command. Arg type unknown or failed to parse an arg at pos {argPos}."); break; } return(false); }
public static void Fail(this Dispatcher dispatcher, FailReason reason, Action shutdown) { const string CAPTION = "Failure"; string message = null; switch (reason) { case FailReason.EarlyStageInitFailure: message = PR.EarlyStageInitFailure; break; case FailReason.FailureDialogInternalError: message = PR.FailureDialogInternalError; break; } dispatcher.BeginInvoke((Action)(() => { Modal.FailureDialog(null, CAPTION, message); shutdown(); })); }
internal ErrorEventArgs(FailReason reason) { this.Reason = reason; }
public Result(bool isPassed, FailReason failReason = FailReason.NoFailes, int failedTestNumber = -1) { IsPassed = isPassed; FailReason = failReason; FailedTestNumber = failedTestNumber; }
public DatabaseOperationResponse(bool hasSucceeded=false, string description="", FailReason reason= FailReason.Undefined) { HasSucceeded = hasSucceeded; Description = description; Reason = reason; }
public LoginFailPacket(GameClient client, FailReason reason) : base(client) { _reason = reason; }
public override void OnLoadingFailed(string imageUri, View view, FailReason failReason) { mHolder.ProgressBar.Visibility = ViewStates.Gone; }
bool _CalcBlockShoot(Player shooter, out bool bBlockable, out bool bBlockInRange, out IM.Number fBlockRate, out IM.Number fBlockValue, out IM.Vector3 attackerPos, out IM.Vector3 vBallDir, out bool bValid) { bBlockable = false; attackerPos = IM.Vector3.zero; fBlockRate = IM.Number.zero; fBlockValue = IM.Number.zero; bBlockInRange = false; vBallDir = GetBallVelocity(); bValid = false; if (shooter == null) { Debug.Log("Block failed, shooter is null."); m_failReason = FailReason.NoShooter; return(false); } attackerPos = shooter.position; if (!shooter.m_blockable.blockable) { if (shooter.m_blockable.tooEarly) { m_failReason = FailReason.TooEarly; } else if (shooter.m_blockable.tooLate) { m_failReason = FailReason.TooLate; } Debugger.Instance.m_steamer.message = "Out of block range."; return(false); } bBlockable = true; /* * AOD.Zone zone = shooter.m_AOD.GetStateByPos(m_player.position); * if( zone == AOD.Zone.eInvalid ) * { * Debugger.Instance.m_steamer.message = "Block failed, not in AOD"; * return false; * } */ if (!InBlockArea(shooter, m_player, m_basket.m_vShootTarget)) { Debugger.Instance.m_steamer.message = "Block failed, not in AOD"; m_failReason = FailReason.InvalidArea; return(false); } bBlockInRange = true; Dictionary <string, PlayerAnimAttribute.AnimAttr> blocks = m_player.m_animAttributes.m_block; int blockKey = blocks[m_player.animMgr.GetOriginName(m_curAction)].GetKeyFrame("OnBlock").frame; IM.Number fEventBlockTime = blockKey / m_player.animMgr.GetFrameRate(m_curAction); Dictionary <string, PlayerAnimAttribute.AnimAttr> shootAnims = shooter.m_animAttributes.m_shoot; SkillInstance shooterSkill = shooter.m_StateMachine.m_curState.m_curExecSkill; string shoot_id = shooter.m_skillSystem.ParseAction(shooterSkill.curAction.action_id, shooterSkill.matchedKeyIdx, Command.Shoot); int shootOutKey = shootAnims[shooter.animMgr.GetOriginName(shoot_id)].GetKeyFrame("OnShoot").frame; IM.Number fEventShootOutTime = shootOutKey / shooter.animMgr.GetFrameRate(shoot_id); IM.Number fShootEclipseTime = shooter.animMgr.curPlayInfo.time; if (fShootEclipseTime > fEventShootOutTime) { Debug.Log("PlayerState_Block: block failed, ball has been shot."); m_failReason = FailReason.InvalidBallShotState; return(false); } IM.Number fBallFlyTime = fEventBlockTime - (fEventShootOutTime - fShootEclipseTime); if (fBallFlyTime < IM.Number.zero) { Debug.Log("PlayerState_Block: block failed, ball will not be shot when block time."); m_failReason = FailReason.InvalidBallShotState; return(false); } IM.Number fSideEffect = IM.Number.one; SkillSideEffect effect; if (!m_curExecSkill.skill.side_effects.TryGetValue((int)SkillSideEffect.Type.eBlockRate, out effect)) { Debug.Log("No side effect data."); } else { fSideEffect = effect.value; } Dictionary <string, uint> data = shooter.m_finalAttrs; uint uBlockSkill = 0; m_player.m_skillSystem.HegdingToValue("addn_block", ref uBlockSkill); IM.Number blockAttr = new IM.Number((int)(m_player.m_finalAttrs["block"] + uBlockSkill)); IM.Number reduceScale = m_match.GetAttrReduceScale("block", m_player); blockAttr *= reduceScale; if ((Command)shooterSkill.skill.action_type == Command.Shoot) { uint anti_block = 0; shooter.m_skillSystem.HegdingToValue("addn_anti_block", ref anti_block); IM.Number fAntiBlock = new IM.Number((int)(data["anti_block"] + anti_block)); switch (shooterSkill.skill.area[0]) { case 3: //near fBlockRate = shootNearHedging.Calc(blockAttr, fAntiBlock); break; case 2: //middle fBlockRate = shootMiddleHedging.Calc(blockAttr, fAntiBlock); break; case 1: //far fBlockRate = shootFarHedging.Calc(blockAttr, fAntiBlock); break; default: break; } fBlockRate += fSideEffect; } SkillSpec skillSpc = shooter.GetSkillSpecialAttribute(SkillSpecParam.eShoot_antiBlock); if (skillSpc.paramOp == SkillSpecParamOp.eAdd) { fBlockRate += skillSpc.value; } else if (skillSpc.paramOp == SkillSpecParamOp.eMulti) { fBlockRate *= skillSpc.value; } SkillSpec skill = m_player.GetSkillSpecialAttribute(SkillSpecParam.eBlock_rate); if (skill.paramOp == SkillSpecParamOp.eAdd) { fBlockRate += skill.value; } else if (skill.paramOp == SkillSpecParamOp.eMulti) { fBlockRate *= skill.value; } fBlockRate = m_match.AdjustBlockRate(shooter, m_player, fBlockRate); bool sumValue = random[shooter].AdjustRate(ref fBlockRate); bValid = true; if (shooterSkill.curAction.block_key != null) { Debug.Log("m_curExecSkill.curInput.moveDir: " + m_curExecSkill.curInput.moveDir); Debug.Log("shooterSkill.curAction.block_key.moveDir: " + shooterSkill.curAction.block_key.moveDir); if (m_curExecSkill.curInput.moveDir == shooterSkill.curAction.block_key.moveDir) { fBlockRate *= GlobalConst.MATCHED_KEY_BLOCK_RATE_ADJUST; Debug.Log("Match block key."); } } fBlockValue = IM.Random.value; if (fBlockValue > fBlockRate) { m_failReason = FailReason.Random; return(false); } if (sumValue) { random[shooter].SumValue(); } return(true); }
bool _CalcBlockLayup(Player shooter, out bool bBlockable, out bool bBlockInRange, out IM.Number fBlockRate, out IM.Number fBlockValue, out IM.Vector3 attackerPos, out IM.Vector3 vBallDir, out bool bValid) { bBlockable = false; attackerPos = IM.Vector3.zero; fBlockRate = IM.Number.zero; fBlockValue = IM.Number.zero; bBlockInRange = false; vBallDir = GetBallVelocity(); bValid = false; if (shooter == null) { m_failReason = FailReason.NoShooter; return(false); } attackerPos = shooter.position; if (!shooter.m_blockable.blockable) { Debugger.Instance.m_steamer.message = "Out of block range."; Debug.Log("Out of block range."); if (shooter.m_blockable.tooEarly) { m_failReason = FailReason.TooEarly; } else if (shooter.m_blockable.tooLate) { m_failReason = FailReason.TooLate; } return(false); } bBlockable = true; /* * AOD.Zone zone = shooter.m_AOD.GetStateByPos(m_player.position); * if( zone == AOD.Zone.eInvalid ) * { * bBlockInRange = false; * Debugger.Instance.m_steamer.message = "Block failed, not in AOD"; * return false; * } */ if (!InBlockArea(shooter, m_player, m_basket.m_vShootTarget)) { Debugger.Instance.m_steamer.message = "Block failed, not in AOD"; m_failReason = FailReason.InvalidArea; return(false); } bBlockInRange = true; IM.Number fSideEffect = IM.Number.zero; SkillSideEffect effect; if (!m_curExecSkill.skill.side_effects.TryGetValue((int)SkillSideEffect.Type.eBlockRate, out effect)) { Debug.Log("No side effect data."); } else { fSideEffect = effect.value; } Dictionary <string, uint> data = shooter.m_finalAttrs; Dictionary <string, uint> shooterSkillAttr = shooter.GetSkillAttribute(); IM.Number blockAttr = new IM.Number((int)m_player.m_finalAttrs["block"]); IM.Number reduceScale = m_match.GetAttrReduceScale("block", m_player); blockAttr *= reduceScale; SkillInstance shooterSkill = shooter.m_StateMachine.m_curState.m_curExecSkill; { if ((Command)shooterSkill.skill.action_type == Command.Layup) { uint anti_block = 0; shooter.m_skillSystem.HegdingToValue("addn_anti_block", ref anti_block); IM.Number fAntiBlock = new IM.Number((int)(data["anti_block"] + anti_block)); switch (shooterSkill.skill.area[0]) { case 3: //near fBlockRate = layupNearHedging.Calc(blockAttr, fAntiBlock); break; case 2: //middle fBlockRate = layupMiddleHedging.Calc(blockAttr, fAntiBlock); break; default: break; } fBlockRate += fSideEffect; } } SkillSpec skill = m_player.GetSkillSpecialAttribute(SkillSpecParam.eBlock_rate); if (skill.paramOp == SkillSpecParamOp.eAdd) { fBlockRate += skill.value; } else if (skill.paramOp == SkillSpecParamOp.eMulti) { fBlockRate *= skill.value; } SkillSpec skillSpc = shooter.GetSkillSpecialAttribute(SkillSpecParam.eLayup_antiBlock); if (skillSpc.paramOp == SkillSpecParamOp.eAdd) { fBlockRate += skillSpc.value; } else if (skillSpc.paramOp == SkillSpecParamOp.eMulti) { fBlockRate *= skillSpc.value; } fBlockRate = m_match.AdjustBlockRate(shooter, m_player, fBlockRate); bool sumValue = random[shooter].AdjustRate(ref fBlockRate); bValid = true; fBlockValue = IM.Random.value; if (fBlockValue > fBlockRate) { m_failReason = FailReason.Random; return(false); } if (sumValue) { random[shooter].SumValue(); } return(true); }
public override void OnLoadingFailed(string imageUri, View view, FailReason failReason) { string message = null; if (failReason.Type == FailReason.FailType.IoError) { message = "Input/Output error"; } else if (failReason.Type == FailReason.FailType.DecodingError) { message = "Image can't be decoded"; } else if (failReason.Type == FailReason.FailType.NetworkDenied) { message = "Downloads are denied"; } else if (failReason.Type == FailReason.FailType.OutOfMemory) { message = "Out Of Memory error"; } else if (failReason.Type == FailReason.FailType.Unknown) { message = "Unknown error"; } Toast.MakeText(view.Context, message, ToastLength.Short).Show(); mSpinner.Visibility = ViewStates.Gone; }
private List<DisplayUser> BindingNodeState(SnapShotStatData snapData, FailReason reason, TreeNode node, string nodeName) { List<DisplayUser> list = new List<DisplayUser>(); List<StaSimuSiteResult> statSimuSiteResultList = snapData.StatSimuSiteResultList; List<User> userList = new List<User>(); List<SymbolElement> list4 = new List<SymbolElement>(); SymbolElement item = new SymbolElement(Color.Green); list4.Add(item); item = new SymbolElement(Color.Yellow); list4.Add(item); item = new SymbolElement(Color.Pink); list4.Add(item); item = new SymbolElement(Color.DarkRed); list4.Add(item); item = new SymbolElement(Color.OrangeRed); list4.Add(item); item = new SymbolElement(Color.PaleVioletRed); list4.Add(item); item = new SymbolElement(Color.DeepPink); list4.Add(item); item = new SymbolElement(Color.Black); list4.Add(item); item = new SymbolElement(Color.Red); list4.Add(item); userList = this.FindUserListByReason(snapData, reason, userList); foreach (User user in userList) { DisplayUser user2 = new DisplayUser(); StatSimuUserResult userResult = null; StatSimuCarrierResult carrier = null; this.getUserResult(user, snapData, out userResult, out carrier); user2.LTEUser = userResult; user2.SimulationName = node.Parent.Text; user2.SnapShotName = node.Text; user2.SymbolElement = list4[(int) reason]; user2.UserState = nodeName; if (carrier != null) { user2.BestServer = carrier.CarrierName; } else { user2.BestServer = ""; } list.Add(user2); } return list; }
private List<User> FindUserListByReason(SnapShotStatData snapData, FailReason reason, List<User> userList) { Dictionary<FailReason, List<User>> dictionary = new Dictionary<FailReason, List<User>>(); dictionary.Add(FailReason.CallDrop, snapData.OffLineList); dictionary.Add(FailReason.DlRsrpFail, snapData.DlRsrpFailList); dictionary.Add(FailReason.DlRsSinrFail, snapData.DlRsSinrFailList); dictionary.Add(FailReason.UlRsSinrFail, snapData.UlRsSinrFailList); dictionary.Add(FailReason.PuschAndPdschSinrFail, new List<User>()); dictionary.Add(FailReason.Satisfied, snapData.SatisfiedList); dictionary.Add(FailReason.UlRsrpFail, snapData.UlRsrpFailList); if (!dictionary.ContainsKey(reason)) { throw new ArgumentException(GeneralResource.GENERAL_ERROR); } return dictionary[reason]; }
private List<DisplayUser> BindingNodeState(SnapShotStatData snapData, FailReason reason, TreeNode node, string nodeName) { List<DisplayUser> list = new List<DisplayUser>(); List<StaSimuSiteResult> statSimuSiteResultList = snapData.StatSimuSiteResultList; List<User> list3 = new List<User>(); List<SymbolElement> list4 = new List<SymbolElement>(); List<Color> list5 = new List<Color>(); list5.Add(Color.Green); list5.Add(Color.Yellow); list5.Add(Color.Pink); list5.Add(Color.DarkRed); list5.Add(Color.OrangeRed); list5.Add(Color.PaleVioletRed); list5.Add(Color.DeepPink); list5.Add(Color.Black); list5.Add(Color.Red); foreach (Color color in list5) { SymbolElement item = new SymbolElement(color); list4.Add(item); } Dictionary<FailReason, List<User>> dictionary = new Dictionary<FailReason, List<User>>(); dictionary.Add(FailReason.CallDrop, snapData.OffLineList); dictionary.Add(FailReason.DlRsrpFail, snapData.DlRsrpFailList); dictionary.Add(FailReason.UlRsSinrFail, snapData.UlRsSinrFailList); dictionary.Add(FailReason.DlRsSinrFail, snapData.DlRsSinrFailList); dictionary.Add(FailReason.UlRsrpFail, snapData.UlRsrpFailList); dictionary.Add(FailReason.Satisfied, snapData.SatisfiedList); list3 = dictionary[reason]; foreach (User user in list3) { DisplayUser user2 = new DisplayUser(); StatSimuUserResult userResult = null; StatSimuCarrierResult carrier = null; this.getUserResult(user, snapData, out userResult, out carrier); user2.LTEUser = userResult; user2.SimulationName = node.Parent.Text; user2.SnapShotName = node.Text; user2.SymbolElement = list4[(int) reason]; user2.UserState = nodeName; if (carrier != null) { user2.BestServer = carrier.CarrierName; } else { user2.BestServer = ""; } list.Add(user2); } return list; }
private void Fail(Action<FailReason> fail, FailReason reason) { if (fail != null) fail(reason); EventHandler<ErrorEventArgs> h = Error; if (h != null) h(this, new ErrorEventArgs(reason)); }
public LoginFailPacket(FailReason resultCode) { ResultCode = resultCode; }
internal ErrorEventArgs(FailReason reason) { this.Reason = reason; }
public void OnLoadingFailed(string imageUri, View view, FailReason failReason) { }
public void OnLoadingFailed(string imageUri, View view, FailReason failReason) { try { GC.Collect(); Bitmap myBitmap; Resources res = Application.Context.Resources; if (imageUri.Contains("d-avatar.jpg") || imageUri.Contains("no_profile_image.png") || imageUri.Contains("no_profile_image_circle.png") || imageUri.Contains("d-cover.jpg") || imageUri.Contains("ImagePlacholder.jpg") || imageUri.Contains("ImagePlacholder_circel.png")) { if (Circle) { if (imageUri.Contains("d-avatar.jpg") || imageUri.Contains("no_profile_image_circle")) { myBitmap = BitmapFactory.DecodeResource(res, Resource.Drawable.no_profile_image_circle); } else if (imageUri.Contains("no_profile_image.png")) { myBitmap = BitmapFactory.DecodeResource(res, Resource.Drawable.no_profile_image); } else if (imageUri.Contains("ImagePlacholder.jpg")) { myBitmap = BitmapFactory.DecodeResource(res, Resource.Drawable.ImagePlacholder); } else if (imageUri.Contains("d-cover.jpg.jpg")) { myBitmap = BitmapFactory.DecodeResource(res, Resource.Drawable.bridge); } else if (imageUri.Contains("ImagePlacholder_circel.png")) { myBitmap = BitmapFactory.DecodeResource(res, Resource.Drawable.ImagePlacholder_circel); } else { myBitmap = BitmapFactory.DecodeResource(res, Resource.Drawable.no_profile_image); } Bitmap croppedBitmap = GetCroppedBitmap(myBitmap); Image.SetImageBitmap(croppedBitmap); } else { if (imageUri.Contains("d-avatar.jpg") || imageUri.Contains("no_profile_image_circle.png")) { Image.SetImageResource(Resource.Drawable.no_profile_image_circle); } else if (imageUri.Contains("no_profile_image.jpg")) { Image.SetImageResource(Resource.Drawable.no_profile_image); } else if (imageUri.Contains("ImagePlacholder.jpg")) { Image.SetImageResource(Resource.Drawable.ImagePlacholder); } else if (imageUri.Contains("ImagePlacholder_circel.png")) { Image.SetImageResource(Resource.Drawable.ImagePlacholder_circel); } else if (imageUri.Contains("d-cover.jpg.jpg")) { Image.SetImageResource(Resource.Drawable.bridge); } else { Image.SetImageResource(Resource.Drawable.no_profile_image); } } } else if (!string.IsNullOrEmpty(imageUri) && imageUri.Contains("http")) { Image.SetImageURI(Uri.Parse(imageUri)); } else if (!string.IsNullOrEmpty(imageUri) && (imageUri.Contains("file://") || imageUri.Contains("content://") || imageUri.Contains("storage"))) { var file = Android.Net.Uri.FromFile(new Java.IO.File(imageUri)); myBitmap = BitmapFactory.DecodeFile(file.Path); if (Circle) { Bitmap croppedBitmap = GetCroppedBitmap(myBitmap); Image.SetImageBitmap(croppedBitmap); } else { try { if (myBitmap != null) { Image.SetImageBitmap(myBitmap); } else { BitmapFactory.Options options = new BitmapFactory.Options(); options.InSampleSize = 2; Bitmap bitmap = BitmapFactory.DecodeFile(file.Path, options); Image.SetImageBitmap(bitmap); } } catch (Exception e) { Console.WriteLine(e); } catch (OutOfMemoryError ex) { GC.Collect(); Console.WriteLine(ex); } } } else { Image.SetImageResource(Resource.Drawable.no_profile_image); } Image.Dispose(); } catch (Exception e) { Console.WriteLine(e); } }
bool _CalcBlockDunk(Player shooter, out bool bBlockable, out bool bBlockInRange, out IM.Number fBlockRate, out IM.Number fBlockValue, out IM.Vector3 attackerPos, out IM.Vector3 vBallDir, out bool bValid) { bBlockable = false; attackerPos = IM.Vector3.zero; fBlockRate = IM.Number.zero; fBlockValue = IM.Number.zero; bBlockInRange = false; bValid = false; //vBallDir = GameUtils.HorizonalNormalized( shooter.position, m_player.position ); vBallDir = GetBallVelocity(); Player dunker = m_ball.m_owner; IM.Vector3 dirDunker2Player = m_player.position - dunker.position; dirDunker2Player.y = IM.Number.zero; if (!dunker.m_blockable.blockable) { Debugger.Instance.m_steamer.message = "Out of block range."; if (dunker.m_blockable.tooEarly) { m_failReason = FailReason.TooEarly; } else if (dunker.m_blockable.tooLate) { m_failReason = FailReason.TooLate; } return(false); } /* * AOD.Zone zone = shooter.m_AOD.GetStateByPos(m_player.position); * if( zone == AOD.Zone.eInvalid ) * { * bBlockInRange = false; * Debugger.Instance.m_steamer.message = "Block failed, not in AOD"; * return false; * } */ if (!InBlockArea(shooter, m_player, m_basket.m_vShootTarget)) { Debugger.Instance.m_steamer.message = "Block failed, not in AOD"; m_failReason = FailReason.InvalidArea; return(false); } bBlockInRange = true; Dictionary <string, PlayerAnimAttribute.AnimAttr> blocks = m_player.m_animAttributes.m_block; int blockKey = blocks[m_curAction].GetKeyFrame("OnBlock").frame; IM.Number fEventBlockTime = blockKey / m_player.animMgr.GetFrameRate(m_curAction); SkillInstance dunkSkill = dunker.m_StateMachine.m_curState.m_curExecSkill; string dunk_id = dunker.m_skillSystem.ParseAction(dunkSkill.curAction.action_id, dunkSkill.matchedKeyIdx, Command.Dunk); PlayerAnimAttribute.AnimAttr dunkAnims = dunker.m_animAttributes.GetAnimAttrById(Command.Dunk, dunk_id); int dunkInKey = dunkAnims.GetKeyFrame("OnDunk").frame; IM.Number fEventDunkInTime = dunkInKey / dunker.animMgr.GetFrameRate(dunk_id); IM.Number fDunkEclipseTime = dunker.animMgr.curPlayInfo.time; IM.Number fDunkFlyTime = fEventDunkInTime - fDunkEclipseTime; if (fDunkFlyTime < fEventBlockTime) { Debugger.Instance.m_steamer.message = "block too late, dunk goal!"; m_failReason = FailReason.InvalidBallShotState; return(false); } IM.Number fSideEffect = IM.Number.zero; SkillSideEffect effect; if (!m_curExecSkill.skill.side_effects.TryGetValue((int)SkillSideEffect.Type.eBlockRate, out effect)) { Debug.Log("No side effect data."); } else { fSideEffect = effect.value; } Dictionary <string, uint> data = dunker.m_finalAttrs; Dictionary <string, uint> dunkerSkillAttr = dunker.GetSkillAttribute(); IM.Number blockAttr = new IM.Number((int)(m_player.m_finalAttrs["block"])); IM.Number reduceScale = m_match.GetAttrReduceScale("block", m_player); blockAttr *= reduceScale; if ((Command)dunkSkill.skill.action_type == Command.Dunk) { uint anti_block = 0; shooter.m_skillSystem.HegdingToValue("addn_anti_block", ref anti_block); IM.Number fAntiBlock = new IM.Number((int)(data["anti_block"] + anti_block)); switch (dunkSkill.skill.area[0]) { case 3: //near fBlockRate = dunkNearHedging.Calc(blockAttr, fAntiBlock); break; case 2: //middle fBlockRate = dunkMiddleHedging.Calc(blockAttr, fAntiBlock); break; } fBlockRate += fSideEffect; } SkillSpec skillSpc = shooter.GetSkillSpecialAttribute(SkillSpecParam.eDunk_antiBlock); if (skillSpc.paramOp == SkillSpecParamOp.eAdd) { fBlockRate += skillSpc.value; } else if (skillSpc.paramOp == SkillSpecParamOp.eMulti) { fBlockRate *= skillSpc.value; } skillSpc = m_player.GetSkillSpecialAttribute(SkillSpecParam.eBlock_rate); if (skillSpc.paramOp == SkillSpecParamOp.eAdd) { fBlockRate += skillSpc.value; } else if (skillSpc.paramOp == SkillSpecParamOp.eMulti) { fBlockRate *= skillSpc.value; } fBlockRate = m_match.AdjustBlockRate(shooter, m_player, fBlockRate); bool sumValue = random[shooter].AdjustRate(ref fBlockRate); fBlockValue = IM.Random.value; Debugger.Instance.m_steamer.message = "block rate: " + fBlockRate; Debugger.Instance.m_steamer.message += "probability: " + fBlockValue; bValid = true; m_ball.m_bBlockSuccess = fBlockValue < fBlockRate; if (!m_ball.m_bBlockSuccess) { m_failReason = FailReason.Random; } if (m_ball.m_bBlockSuccess && sumValue) { random[shooter].SumValue(); } return(m_ball.m_bBlockSuccess); }
void Fail(FailReason reason, int hops) { Done (new RoutingResult (reason, hops)); _router.InvokeStatisticsNotice (StatisticsNoticeEventArgs.CreateFailure ()); }
override public void OnEnter(PlayerState lastState) { base.OnEnter(lastState); m_failReason = FailReason.None; Player attacker = m_ball.m_actor; if (attacker == null) { attacker = m_ball.m_owner; } //main player bool bBlockable = false, bBlockInRange = false; IM.Number fBlockRate = IM.Number.zero, fBlockValue = IM.Number.zero; IM.Vector3 attackerPos = IM.Vector3.zero; bool bValid = false; m_success = false; IM.Vector3 vBallVel = IM.Vector3.zero; IM.Vector3 vBallPos = IM.Vector3.zero; if (attacker != null) { m_player.FaceTo(attacker.position); //shooter is blocked.. set a ball solution to him m_failedShootSolution = GameSystem.Instance.shootSolutionManager.GetShootSolution(m_basket.m_vShootTarget, attacker.position, false); if (m_failedShootSolution == null) { Debug.LogError("No shoot solution can be set to block."); } m_bMoveForward = false; m_speed = IM.Vector3.zero; m_bFailDown = false; if (!m_ball.m_bBlockSuccess && m_ball.m_picker == null) { m_heightScale = IM.Number.one; if (m_ball != null && !m_ball.m_bReachMaxHeight && (m_ball.m_ballState == BallState.eUseBall_Shoot || m_ball.m_ballState == BallState.eUseBall)) { if (attacker.m_StateMachine.m_curState.m_eState == State.eShoot) { m_success = _CalcBlockShoot(attacker, out bBlockable, out bBlockInRange, out fBlockRate, out fBlockValue, out attackerPos, out vBallVel, out bValid); if (m_success) { _BeginBlockShoot(m_failedShootSolution, attacker, out vBallPos); } } else if (attacker.m_StateMachine.m_curState.m_eState == State.eLayup) { m_success = _CalcBlockLayup(attacker, out bBlockable, out bBlockInRange, out fBlockRate, out fBlockValue, out attackerPos, out vBallVel, out bValid); if (m_success) { _BeginBlockLayup(m_failedShootSolution, attacker, out vBallPos); } } else if (attacker.m_StateMachine.m_curState.m_eState == State.eDunk) { m_success = _CalcBlockDunk(attacker, out bBlockable, out bBlockInRange, out fBlockRate, out fBlockValue, out attackerPos, out vBallVel, out bValid); if (m_success) { _BeginBlockDunk(attacker, out vBallPos); } } else { Debug.Log("Block failed, cur attacker state: " + attacker.m_StateMachine.m_curState.m_eState); m_success = false; } string rateLog = "Block rate: " + fBlockRate + " value: " + fBlockValue; Debugger.Instance.m_steamer.message = rateLog; Debug.Log(rateLog); Debug.Log("block success: " + m_success); Debug.Log("block ball pos: " + vBallPos + ", vel: " + vBallVel); if (!m_success) { Debug.Log("Block fail reason: " + m_failReason); } m_player.mStatistics.SkillUsageSuccess(m_curExecSkill.skill.id, m_success); } else { m_success = false; Debug.Log("496 failed."); m_failReason = FailReason.TooLate; } }//if( !m_ball.m_bBlockSuccess ) } if (m_curExecSkill.skill.id == idBlockPassBall || m_curExecSkill.skill.id == idBlockGrabBall) { if (m_ball.m_picker != null || m_ball.m_bGoal) { m_success = false; } else { m_ball.m_picker = m_player; } } if (!m_success) { m_speed = m_player.forward; m_bMoveForward = false; if (attacker != null && attacker.m_StateMachine.m_curState.m_eState == State.eDunk && GameUtils.HorizonalDistance(m_player.position, attacker.position) < IM.Number.one) { m_bFailDown = IM.Random.value > IM.Number.half; } } if (!m_success) { List <SkillInstance> basicBlockSkills = m_player.m_skillSystem.GetBasicSkillsByCommand(Command.Block); m_curExecSkill = basicBlockSkills[0]; } else { //m_curExecSkill = _DecideBlockSkill(); bool bBlockPass = false; if (m_curExecSkill.skill.id == idBlockPassBall) { int value = IM.Random.Range(0, 2); bBlockPass = true; if (value == 0) { Player catcher = PassHelper.ChoosePassTarget(m_player); if (catcher != null) { m_player.m_passTarget = catcher; } } } m_loseBallContext.vInitPos = vBallPos; m_loseBallContext.vInitVel = vBallVel; } m_player.animMgr.Play(m_curAction, false); ++m_player.mStatistics.data.block_times; if (bValid) { ++m_player.mStatistics.data.valid_block_times; } }
void HandleError(XElement element, FailReason failReason) { string innerXml = null; string elementXml; var firstOrDefault = element.Ancestors("SerializedObject").FirstOrDefault(); if (firstOrDefault != null && firstOrDefault != element) { innerXml = element.ToString(); elementXml = firstOrDefault.ToString(); } else { elementXml = element.ToString(); } if (_errorHandling == ErrorHandling.CreateErrorObjects) { var errorInfoObject = (IIOError)XafTypesInfo.Instance.FindBussinessObjectType<IIOError>().CreateInstance(new object[] { _unitOfWork }); errorInfoObject.Reason = failReason; errorInfoObject.ElementXml = elementXml; errorInfoObject.InnerXml = innerXml; } else if (_errorHandling == ErrorHandling.ThrowException) { throw new UserFriendlyException(new Exception("ImportFailed", new Exception("Reason=" + failReason + "ELEMENTXML=" + elementXml + " INNERXML=" + innerXml))); } }
public OnLevelFailedSignal(FailReason reason) { Reason = reason; }
private TreeNode GetGroupChildNode(SnapShotStatData snapShotResult, FailReason failReason, TreeNode snapShotNode) { TreeNode node = new TreeNode(failReason.ToString()); node.ImageKey = "user"; node.SelectedImageKey = "user"; node.StateImageIndex = 1; node.Tag = this.BindingNodeState(snapShotResult, failReason, snapShotNode, failReason.ToString()); return node; }
private void SessionOnLoginFailed(FailReason reason) { SendOutMessage(new ConnectMessage { Error = new InvalidOperationException(reason.GetDescription()) }); }
static void OnFailedEventHandler (string zoneId, FailReason reason) { if (OnFailed != null) { OnFailed (zoneId, reason); } }