void SetState (string identifier, VariableState state) { var variable = usedVariables.FirstOrDefault (v => v.Name == identifier); if (variable == null) return; VariableState oldState; if (states.TryGetValue (variable, out oldState)) { if (oldState < state) states [variable] = state; } else { states [variable] = state; } }
private void BreakIntoPieces(VariableState newRockState) { for (int i = 0; i < NumberOfRocksToBreakInto; i++) { Rock newRock = RockBlaster.Factories.RockFactory.CreateNew(); newRock.Position = this.Position; newRock.Position.X += -1 + 2 * (float)(FlatRedBallServices.Random.NextDouble()); newRock.Position.Y += -1 + 2 * (float)(FlatRedBallServices.Random.NextDouble()); float randomAngle = (float)(FlatRedBallServices.Random.NextDouble() * System.Math.PI * 2); float speed = 0 + (float)(FlatRedBallServices.Random.NextDouble() * RandomSpeedOnBreak); newRock.Velocity = FlatRedBall.Math.MathFunctions.AngleToVector(randomAngle) * speed; newRock.CurrentState = newRockState; } }
public FlatRedBall.Glue.StateInterpolation.Tweener InterpolateTo(VariableState toState, double secondsToTake, FlatRedBall.Glue.StateInterpolation.InterpolationType interpolationType, FlatRedBall.Glue.StateInterpolation.Easing easing, object owner = null) { Gum.DataTypes.Variables.StateSave current = GetCurrentValuesOnState(toState); Gum.DataTypes.Variables.StateSave toAsStateSave = this.ElementSave.States.First(item => item.Name == toState.ToString()); FlatRedBall.Glue.StateInterpolation.Tweener tweener = new FlatRedBall.Glue.StateInterpolation.Tweener(from: 0, to: 1, duration: (float)secondsToTake, type: interpolationType, easing: easing); if (owner == null) { tweener.Owner = this; } else { tweener.Owner = owner; } tweener.PositionChanged = newPosition => this.InterpolateBetween(current, toAsStateSave, newPosition); tweener.Ended += () => this.CurrentVariableState = toState; tweener.Start(); StateInterpolationPlugin.TweenerManager.Self.Add(tweener); return(tweener); }
public static void PreloadStateContent(VariableState state, string contentManagerName) { ContentManagerName = contentManagerName; if (state == VariableState.adiamondshowing) { { object throwaway = adiamond; } } else if (state == VariableState.abariguessshowing) { { object throwaway = Bariguess; } } else if (state == VariableState.FRB_iconshowing) { { object throwaway = FRB_icon; } } else if (state == VariableState.somethingshowing) { { object throwaway = something; } } else if (state == VariableState.Veilstone_Corner_Moon_StoneShowing) { { object throwaway = Veilstone_Corner_Moon_Stone; } } else if (state == VariableState.ROLLING) { { object throwaway = RollingSlotsforall; } { object throwaway = "RollingSlots"; } } }
private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(VariableState state) { Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave(); switch (state) { case VariableState.Default: newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave() { SetsValue = true, Name = "Height", Type = "float", Value = Height + 100f } ); newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave() { SetsValue = true, Name = "Height Units", Type = "DimensionUnitType", Value = HeightUnits } ); newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave() { SetsValue = true, Name = "Width", Type = "float", Value = Width + 100f } ); newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave() { SetsValue = true, Name = "Width Units", Type = "DimensionUnitType", Value = WidthUnits } ); break; } return(newState); }
/// <summary> /// Odczyt wartości jednej zmiennej /// </summary> /// <param name="aVariableModel">Model zmiennej. Jego pole mName zawiera nazwe zmiennej.</param> void ReadVariableValue(Demo2VariableModel aVariableModel) { try { AsixRestClient asixRestClient = new AsixRestClient(); // Odczyt wartości zmiennej z serwera REST VariableState variableState = asixRestClient.ReadVariableState(aVariableModel.mName); // Obsług błędu odczytu if (!variableState.readSucceeded) { aVariableModel.mReadError = variableState.readStatusString; return; } // Formatowanie wartości zmiennej if (variableState.IsQualityGood()) { // Formatowanie wartości o jakości dobrej double value = (double)variableState.value; aVariableModel.mValueFormatted = value.ToString("F0"); } else if (variableState.IsQualityUncertain()) { // Formatowanie wartości o jakości niepewnej double value = (double)variableState.value; aVariableModel.mValueFormatted = value.ToString("F0") + "?"; } else { // Dla wartości o jakości złej wyświetlimy pytajnik aVariableModel.mValueFormatted = "?"; } } catch (Exception e) { aVariableModel.mReadError = e.Message; } }
public void CheckState(VariableState variableState, ExecutionState state, HashSet <VariableState> visited, Configuration configuration) { if (!visited.Add(variableState)) { return; } foreach (var propertyStatesValue in variableState.PropertyStates.Values) { CheckState(propertyStatesValue, state, visited, configuration); } var symbol = state.GetSymbol(variableState.Node); if (symbol == null) { return; } // Only if it is the constructor of the HttpCookie instance if (!symbol.IsConstructor() || !symbol.ContainingSymbol.ToString().Equals("System.Web.HttpCookie")) { return; } if (!variableState.PropertyStates.TryGetValue("Secure", out var secureState) || (secureState.Taint == VariableTaint.Constant && secureState.Value is bool isSecure && !isSecure) || configuration.AuditMode && secureState.Taint != VariableTaint.Constant) { state.AnalysisContext.ReportDiagnostic(Diagnostic.Create(RuleSecure, variableState.Node.GetLocation())); } if (!variableState.PropertyStates.TryGetValue("HttpOnly", out var httpOnly) || (httpOnly.Taint == VariableTaint.Constant && httpOnly.Value is bool isHttpOnly && !isHttpOnly) || configuration.AuditMode && httpOnly.Taint != VariableTaint.Constant) { state.AnalysisContext.ReportDiagnostic(Diagnostic.Create(RuleHttpOnly, variableState.Node.GetLocation())); } }
public void Clear() { var defaultValue = new DummyValue(-1); var state = new VariableState <DummyValue>(defaultValue); var value1 = new DummyValue(1); var value2 = new DummyValue(2); var value3 = new DummyValue(2); state[_variables[0]] = value1; state[_variables[1]] = value2; state[_variables[2]] = value3; state.Clear(); Assert.Equal(defaultValue, state[_variables[0]]); Assert.Equal(defaultValue, state[_variables[1]]); Assert.Equal(defaultValue, state[_variables[2]]); Assert.Equal(defaultValue, state[_variables[3]]); Assert.Equal(defaultValue, state[_variables[4]]); }
public override void ApplyState(Gum.DataTypes.Variables.StateSave state) { bool matches = this.ElementSave.AllStates.Contains(state); if (matches) { var category = this.ElementSave.Categories.FirstOrDefault(item => item.States.Contains(state)); if (category == null) { if (state.Name == "Default") { this.mCurrentVariableState = VariableState.Default; } if (state.Name == "Selected") { this.mCurrentVariableState = VariableState.Selected; } } } base.ApplyState(state); }
public void InterpolateBetween(VariableState firstState, VariableState secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new System.Exception("interpolationValue cannot be NaN"); } #endif bool setSpriteInstanceAlpha = true; float SpriteInstanceAlphaFirstValue = 0; float SpriteInstanceAlphaSecondValue = 0; if (firstState == VariableState.Enabled) { SpriteInstanceAlphaFirstValue = 1f; } else if (firstState == VariableState.Disabled) { SpriteInstanceAlphaFirstValue = 0.1f; } if (secondState == VariableState.Enabled) { SpriteInstanceAlphaSecondValue = 1f; } else if (secondState == VariableState.Disabled) { SpriteInstanceAlphaSecondValue = 0.1f; } if (setSpriteInstanceAlpha) { SpriteInstanceAlpha = SpriteInstanceAlphaFirstValue * (1 - interpolationValue) + SpriteInstanceAlphaSecondValue * interpolationValue; } if (interpolationValue < 1) { mCurrentState = firstState; } else { mCurrentState = secondState; } }
private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(VariableState state) { Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave(); switch (state) { case VariableState.Default: newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave() { SetsValue = true, Name = "PlayerSelectionUIInstance.ReadyToStartState", Type = "ReadyToStartState", Value = PlayerSelectionUIInstance.CurrentReadyToStartState } ); newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave() { SetsValue = true, Name = "PlayerSelectionUIInstance.State", Type = "State", Value = PlayerSelectionUIInstance.CurrentVariableState } ); newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave() { SetsValue = true, Name = "PlayerSelectionUIInstance.VisibilityState", Type = "VisibilityState", Value = PlayerSelectionUIInstance.CurrentVisibilityState } ); break; case VariableState.PlayerSelection: break; case VariableState.Game: break; } return(newState); }
public FlatRedBall.Instructions.Instruction InterpolateToState(VariableState stateToInterpolateTo, double secondsToTake) { switch (stateToInterpolateTo) { case VariableState.Easy: break; case VariableState.NormalOffensive: break; case VariableState.NormalDefensive: break; case VariableState.Hard: break; } var instruction = new FlatRedBall.Instructions.DelegateInstruction <VariableState>(StopStateInterpolation, stateToInterpolateTo); instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake; this.Instructions.Add(instruction); return(instruction); }
private static void ParseVariableLine(object state) { VariableState variableFileState = state as VariableState; if (IsTaskCanceled(variableFileState)) { return; } Variable variable = ScriptedVariablesParser.parseVariable(variableFileState.line); if (variable != null) { variable.FileName = variableFileState.file.Name.Substring(0, variableFileState.file.Name.LastIndexOf(".")); lock (variableFileState.variables) { if (!variableFileState.variables.Contains(variable)) { variableFileState.variables.Add(variable); } } } }
public void AllocateNew( VersionedVariable result, ISymbolicHeapContext context) { this.cachedState = null; var newState = VariableState.CreateValue(this.nextVariableStateId, this.nextReferenceValue); this.nextVariableStateId++; this.nextReferenceValue++; if (this.variableToStateIdMap.TryGetValue(result, out int curStateId)) { var curState = this.variableStates[curStateId]; Contract.Assert(curState.IsInput); // Unify a previously known value with its current allocated number context.AddAssertion(curState.Representation == newState.Representation); } this.MapToVariableState(result, newState); }
public void InterpolateBetween(VariableState firstState, VariableState secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new System.Exception("interpolationValue cannot be NaN"); } #endif switch (firstState) { case VariableState.Idle: break; case VariableState.Walk: break; case VariableState.Jump: break; } switch (secondState) { case VariableState.Idle: break; case VariableState.Walk: break; case VariableState.Jump: break; } if (interpolationValue < 1) { mCurrentState = (int)firstState; } else { mCurrentState = (int)secondState; } }
void SetState(ResolveResult rr, VariableState state) { IVariable variable = null; var lr = rr as LocalResolveResult; if (lr != null) { variable = lr.Variable; } var mr = rr as MemberResolveResult; if (mr != null) { variable = mr.Member as IVariable; } if (variable == null) { return; } var sv = variable as SpecializedField; if (sv != null) { variable = sv.MemberDefinition as IVariable; } VariableState oldState; if (states.TryGetValue(variable, out oldState)) { if (oldState < state) { states [variable] = state; } } else { states [variable] = state; } }
public void StopStateInterpolation(VariableState stateToStop) { if (stateToStop == VariableState.abariguessshowing) { } else if (stateToStop == VariableState.adiamondshowing) { } else if (stateToStop == VariableState.FRB_iconshowing) { } else if (stateToStop == VariableState.somethingshowing) { } else if (stateToStop == VariableState.Veilstone_Corner_Moon_StoneShowing) { } else if (stateToStop == VariableState.ROLLING) { } CurrentState = stateToStop; }
void SetState(string identifier, VariableState state) { var variable = usedVariables.FirstOrDefault(v => v.Name == identifier); if (variable == null) { return; } VariableState oldState; if (states.TryGetValue(variable, out oldState)) { if (oldState < state) { states [variable] = state; } } else { states [variable] = state; } }
public void AssignReference( VersionedVariable result, VersionedVariable value, ISymbolicHeapContext context) { this.cachedState = null; var resultState = this.GetVariableStateOrNull(result); var valueState = this.GetVariableStateOrNull(value); if (resultState != null && valueState != null) { Contract.Assert(resultState.IsInput); context.AddAssertion(resultState.Representation == valueState.Representation); this.MapToVariableState(result, valueState); } else if (resultState == null && valueState == null) { var newVar = context.CreateVariable(Sort.Int, value.Variable.ToString()); var newState = VariableState.CreateInput(this.nextVariableStateId, newVar, true); this.nextVariableStateId++; this.MapToVariableState(result, newState); this.MapToVariableState(value, newState); } else if (resultState != null) { Contract.Assert(valueState == null); this.MapToVariableState(value, resultState); } else { Contract.Assert(valueState != null && resultState == null); this.MapToVariableState(result, valueState); } }
public override void VisitStatement(CSharpSyntax.StatementSyntax node, ExecutionState state, VariableState statementState, Configuration projectConfiguration) { if (!XssPreventionAnalyzer.ExecutionStates.ContainsKey(state)) { return; } var returnStatements = node.DescendantNodesAndSelf().OfType <CSharpSyntax.ReturnStatementSyntax>(); if (!returnStatements.Any()) { return; } if ((statementState.Taint & VariableTaint.Tainted) != 0 && (((ulong)statementState.Taint) & projectConfiguration.TaintTypeNameToBit["HtmlEscaped"]) == 0) { XssPreventionAnalyzer.Check(node, state, projectConfiguration, returnStatements); } }
/// <summary> /// 删除符合指定状态的所有条目(不删变量) /// </summary> internal void DelEntry(VariableState state) { var rowDelList = new List <DataGridViewRow>(); foreach (DataGridViewRow row in VariableDataGrid.Rows) { if (row.IsNewRow) { continue; } var(stateString, _, _) = this.GetEntryItem(row); // 仅仅添加到删除列表,若直接删除,会造成Rows索引变化,出现不能完全删除的现象 if (stateString == _variableStates[state]) { rowDelList.Add(row); } } // 批量删除 foreach (var row in rowDelList) { VariableDataGrid.Rows.Remove(row); } }
private bool?TryGetConstantComparisonResult(VariableState leftState, VariableState rightState) { Contract.Assert(leftState != null); Contract.Assert(rightState != null); if (leftState == rightState) { return(true); } else if (leftState.Value.HasValue && leftState.Value == rightState.Value) { return(true); } else if ((leftState.IsNull && !rightState.CanBeNull) || (rightState.IsNull && !leftState.CanBeNull)) { return(false); } else { return(null); } }
private bool?NullComparisionCheck(ConditionCode condition, VariableState operand1, VariableState operand2) { // not null check if (condition == ConditionCode.Equal) { if (operand2.IsSingleConstant && operand2.ConstantSignedLongInteger == 0 && operand1.IsReferenceDefinedNotNull) { return(false); } if (operand1.IsSingleConstant && operand1.ConstantSignedLongInteger == 0 && operand2.IsReferenceDefinedNotNull) { return(false); } } else if (condition == ConditionCode.NotEqual) { if (operand2.IsSingleConstant && operand2.ConstantSignedLongInteger == 0 && operand1.IsReferenceDefinedNotNull) { return(true); } if (operand1.IsSingleConstant && operand1.ConstantSignedLongInteger == 0 && operand2.IsReferenceDefinedNotNull) { return(true); } } else if (condition == ConditionCode.UnsignedGreater) { if (operand2.IsSingleConstant && operand2.ConstantSignedLongInteger == 0 && operand1.IsReferenceDefinedNotNull) { return(true); } } return(null); }
public void TagVariables(ISymbol symbol, VariableState variableRightState) { // Only PasswordValidator properties will cause a new tag to be added if (AnalyzerUtil.SymbolMatch(symbol, type: "PasswordValidator", name: "RequiredLength")) { variableRightState.AddTag(VariableTag.RequiredLengthIsSet); } else if (AnalyzerUtil.SymbolMatch(symbol, type: "PasswordValidator", name: "RequireDigit")) { variableRightState.AddTag(VariableTag.RequireDigitIsSet); } else if (AnalyzerUtil.SymbolMatch(symbol, type: "PasswordValidator", name: "RequireLowercase")) { variableRightState.AddTag(VariableTag.RequireLowercaseIsSet); } else if (AnalyzerUtil.SymbolMatch(symbol, type: "PasswordValidator", name: "RequireNonLetterOrDigit")) { variableRightState.AddTag(VariableTag.RequireNonLetterOrDigitIsSet); } else if (AnalyzerUtil.SymbolMatch(symbol, type: "PasswordValidator", name: "RequireUppercase")) { variableRightState.AddTag(VariableTag.RequireUppercaseIsSet); } }
public override void ApplyState(Gum.DataTypes.Variables.StateSave state) { bool matches = this.ElementSave.AllStates.Contains(state); if (matches) { var category = this.ElementSave.Categories.FirstOrDefault(item => item.States.Contains(state)); if (category == null) { if (state.Name == "Default") { this.mCurrentVariableState = VariableState.Default; } } else if (category.Name == "WindLevel") { if (state.Name == "Level1") { this.mCurrentWindLevelState = WindLevel.Level1; } if (state.Name == "Level2") { this.mCurrentWindLevelState = WindLevel.Level2; } if (state.Name == "Level3") { this.mCurrentWindLevelState = WindLevel.Level3; } if (state.Name == "Level4") { this.mCurrentWindLevelState = WindLevel.Level4; } } } base.ApplyState(state); }
public override void ApplyState(Gum.DataTypes.Variables.StateSave state) { bool matches = this.ElementSave.AllStates.Contains(state); if (matches) { var category = this.ElementSave.Categories.FirstOrDefault(item => item.States.Contains(state)); if (category == null) { if (state.Name == "Default") { this.mCurrentVariableState = VariableState.Default; } } else if (category.Name == "ButtonCategory") { if (state.Name == "Enabled") { this.mCurrentButtonCategoryState = ButtonCategory.Enabled; } if (state.Name == "Disabled") { this.mCurrentButtonCategoryState = ButtonCategory.Disabled; } if (state.Name == "Highlighted") { this.mCurrentButtonCategoryState = ButtonCategory.Highlighted; } if (state.Name == "Pushed") { this.mCurrentButtonCategoryState = ButtonCategory.Pushed; } } } base.ApplyState(state); }
private static bool?Compare(VariableState operand1, VariableState operand2, ConditionCode conditionCode) { switch (conditionCode) { case ConditionCode.Equal: return(operand1.ConstantUnsignedLongInteger == operand2.ConstantUnsignedLongInteger); case ConditionCode.NotEqual: return(operand1.ConstantUnsignedLongInteger != operand2.ConstantUnsignedLongInteger); case ConditionCode.GreaterOrEqual: return(operand1.ConstantUnsignedLongInteger >= operand2.ConstantUnsignedLongInteger); case ConditionCode.GreaterThan: return(operand1.ConstantUnsignedLongInteger > operand2.ConstantUnsignedLongInteger); case ConditionCode.LessOrEqual: return(operand1.ConstantUnsignedLongInteger <= operand2.ConstantUnsignedLongInteger); case ConditionCode.LessThan: return(operand1.ConstantUnsignedLongInteger < operand2.ConstantUnsignedLongInteger); case ConditionCode.Always: return(true); case ConditionCode.Never: return(false); // unknown integer comparison default: return(null); } }
public static void PreloadStateContent(VariableState state, string contentManagerName) { ContentManagerName = contentManagerName; switch (state) { case VariableState.X: { object throwaway = TileXTexture; } break; case VariableState.O: { object throwaway = TileOTexture; } break; case VariableState.None: { object throwaway = TileNone; } break; } }
private void SetVariableState(VariableState state) { switch (state) { case VariableState.SelectModeView: case VariableState.PlacingBuilding: this.WidthUnits = Gum.DataTypes.DimensionUnitType.Absolute; this.HeightUnits = Gum.DataTypes.DimensionUnitType.Absolute; this.Width = 32; this.Height = 32; break; case VariableState.BuildMenuSelected: case VariableState.SelectedEntity: this.WidthUnits = Gum.DataTypes.DimensionUnitType.RelativeToChildren; this.HeightUnits = Gum.DataTypes.DimensionUnitType.RelativeToChildren; this.Width = 8; this.Height = 8; ReactToUpdateUiChangeEvent(null, UpdateUiEventArgs.RollOffValue); break; } this.CurrentVariableState = state; }
public void InterpolateBetween(VariableState firstState, VariableState secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new System.Exception("interpolationValue cannot be NaN"); } #endif switch (firstState) { case VariableState.Default: break; } switch (secondState) { case VariableState.Default: break; } var wasSuppressed = mIsLayoutSuspended; if (wasSuppressed == false) { SuspendLayout(true); } if (interpolationValue < 1) { mCurrentVariableState = firstState; } else { mCurrentVariableState = secondState; } if (!wasSuppressed) { ResumeLayout(true); } }
private static bool IsNullStateAndVarState( VariableState leftState, VariableState rightState, out VariableState varState) { Contract.Requires(leftState != null); Contract.Requires(rightState != null); if (leftState == VariableState.Null && rightState != VariableState.Null) { varState = rightState; return(true); } else if (rightState == VariableState.Null && leftState != VariableState.Null) { varState = leftState; return(true); } else { varState = null; return(false); } }
private static bool? Compare(VariableState operand1, VariableState operand2, ConditionCode conditionCode) { switch (conditionCode) { case ConditionCode.Equal: return operand1.ConstantUnsignedLongInteger == operand2.ConstantUnsignedLongInteger; case ConditionCode.NotEqual: return operand1.ConstantUnsignedLongInteger != operand2.ConstantUnsignedLongInteger; case ConditionCode.GreaterOrEqual: return operand1.ConstantUnsignedLongInteger >= operand2.ConstantUnsignedLongInteger; case ConditionCode.GreaterThan: return operand1.ConstantUnsignedLongInteger > operand2.ConstantUnsignedLongInteger; case ConditionCode.LessOrEqual: return operand1.ConstantUnsignedLongInteger <= operand2.ConstantUnsignedLongInteger; case ConditionCode.LessThan: return operand1.ConstantUnsignedLongInteger < operand2.ConstantUnsignedLongInteger; case ConditionCode.Always: return true; case ConditionCode.Never: return false; // unknown integer comparison default: return null; } }
public void StopStateInterpolation(VariableState stateToStop) { switch(stateToStop) { case VariableState.Regular: break; case VariableState.Pressed: break; case VariableState.Disabled: break; case VariableState.Hover: break; } CurrentState = stateToStop; }
public FlatRedBall.Instructions.Instruction InterpolateToState (VariableState stateToInterpolateTo, double secondsToTake) { switch(stateToInterpolateTo) { case VariableState.Orden1: break; case VariableState.Orden2: break; } var instruction = new FlatRedBall.Instructions.DelegateInstruction<VariableState>(StopStateInterpolation, stateToInterpolateTo); instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake; this.Instructions.Add(instruction); return instruction; }
private void UpdateToOverDefined(VariableState variable) { if (variable.IsOverDefined) return; variable.IsOverDefined = true; if (MainTrace.Active) MainTrace.Log(variable.ToString()); AddInstruction(variable); }
private void UpdateToConstant(VariableState variable, long value) { UpdateToConstant(variable, (ulong)value); }
public static void PreloadStateContent (VariableState state, string contentManagerName) { ContentManagerName = contentManagerName; switch(state) { case VariableState.Hayek: { object throwaway = "SuperHayek"; } break; case VariableState.Keynes: { object throwaway = "SuperKeynes"; } break; case VariableState.Malthus: { object throwaway = "SuperMalthus"; } break; case VariableState.Smith: { object throwaway = "SuperSmith"; } break; } }
public void InterpolateBetween (VariableState firstState, VariableState secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new System.Exception("interpolationValue cannot be NaN"); } #endif switch(firstState) { case VariableState.Hayek: if (interpolationValue < 1) { this.SpriteCurrentChainName = "SuperHayek"; } break; case VariableState.Keynes: if (interpolationValue < 1) { this.SpriteCurrentChainName = "SuperKeynes"; } break; case VariableState.Malthus: if (interpolationValue < 1) { this.SpriteCurrentChainName = "SuperMalthus"; } break; case VariableState.Smith: if (interpolationValue < 1) { this.SpriteCurrentChainName = "SuperSmith"; } break; } switch(secondState) { case VariableState.Hayek: if (interpolationValue >= 1) { this.SpriteCurrentChainName = "SuperHayek"; } break; case VariableState.Keynes: if (interpolationValue >= 1) { this.SpriteCurrentChainName = "SuperKeynes"; } break; case VariableState.Malthus: if (interpolationValue >= 1) { this.SpriteCurrentChainName = "SuperMalthus"; } break; case VariableState.Smith: if (interpolationValue >= 1) { this.SpriteCurrentChainName = "SuperSmith"; } break; } if (interpolationValue < 1) { mCurrentState = (int)firstState; } else { mCurrentState = (int)secondState; } }
public void StopStateInterpolation (VariableState stateToStop) { switch(stateToStop) { case VariableState.Hayek: break; case VariableState.Keynes: break; case VariableState.Malthus: break; case VariableState.Smith: break; } CurrentState = stateToStop; }
public FlatRedBall.Instructions.Instruction InterpolateToState(VariableState stateToInterpolateTo, double secondsToTake) { switch(stateToInterpolateTo) { case VariableState.Activated: OverallAlphaVelocity = (1f - OverallAlpha) / (float)secondsToTake; break; case VariableState.Deactivated: OverallAlphaVelocity = (0f - OverallAlpha) / (float)secondsToTake; break; } var instruction = new FlatRedBall.Instructions.DelegateInstruction<VariableState>(StopStateInterpolation, stateToInterpolateTo); instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake; this.Instructions.Add(instruction); return instruction; }
public void InterpolateBetween (VariableState firstState, VariableState secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new System.Exception("interpolationValue cannot be NaN"); } #endif switch(firstState) { case VariableState.Orden1: if (interpolationValue < 1) { this.ChainName = "Orden1"; } break; case VariableState.Orden2: if (interpolationValue < 1) { this.ChainName = "Orden2"; } break; } switch(secondState) { case VariableState.Orden1: if (interpolationValue >= 1) { this.ChainName = "Orden1"; } break; case VariableState.Orden2: if (interpolationValue >= 1) { this.ChainName = "Orden2"; } break; } if (interpolationValue < 1) { mCurrentState = (int)firstState; } else { mCurrentState = (int)secondState; } }
private void AddInstruction(VariableState variable) { foreach (var use in variable.Operand.Uses) { if (executedStatements.Contains(use)) { AddInstruction(use); } } }
private VariableState GetVariableState(Operand operand) { VariableState variable; if (!variableStates.TryGetValue(operand, out variable)) { variable = new VariableState(operand); variableStates.Add(operand, variable); } return variable; }
public void InterpolateBetween(VariableState firstState, VariableState secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new Exception("interpolationValue cannot be NaN"); } #endif bool setOverallAlpha = true; float OverallAlphaFirstValue= 0; float OverallAlphaSecondValue= 0; switch(firstState) { case VariableState.Activated: OverallAlphaFirstValue = 1f; break; case VariableState.Deactivated: OverallAlphaFirstValue = 0f; break; } switch(secondState) { case VariableState.Activated: OverallAlphaSecondValue = 1f; break; case VariableState.Deactivated: OverallAlphaSecondValue = 0f; break; } if (setOverallAlpha) { OverallAlpha = OverallAlphaFirstValue * (1 - interpolationValue) + OverallAlphaSecondValue * interpolationValue; } if (interpolationValue < 1) { mCurrentState = (int)firstState; } else { mCurrentState = (int)secondState; } }
private void UpdateToConstant(VariableState variable, ulong value) { Debug.Assert(!variable.IsOverDefined); if (variable.IsConstant && variable.ConstantUnsignedLongInteger != value) { UpdateToOverDefined(variable); return; } if (variable.IsConstant) return; variable.IsConstant = true; variable.ConstantUnsignedLongInteger = value; if (MainTrace.Active) MainTrace.Log(variable.ToString()); AddInstruction(variable); }
public FlatRedBall.Instructions.Instruction InterpolateToState (VariableState stateToInterpolateTo, double secondsToTake) { switch(stateToInterpolateTo) { case VariableState.Opaque: SpriteObject.AlphaRate = (1f - SpriteObject.Alpha) / (float)secondsToTake; break; case VariableState.Transparent: SpriteObject.AlphaRate = (0f - SpriteObject.Alpha) / (float)secondsToTake; break; } var instruction = new FlatRedBall.Instructions.DelegateInstruction<VariableState>(StopStateInterpolation, stateToInterpolateTo); instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake; FlatRedBall.Instructions.InstructionManager.Add(instruction); return instruction; }
public bool AreConstantsEqual(VariableState other) { if (!other.IsConstant || !IsConstant) return false; return (other.ConstantUnsignedLongInteger == ConstantUnsignedLongInteger); }
public void InterpolateBetween (VariableState firstState, VariableState secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new System.Exception("interpolationValue cannot be NaN"); } #endif bool setSpriteObjectAlpha = true; float SpriteObjectAlphaFirstValue= 0; float SpriteObjectAlphaSecondValue= 0; switch(firstState) { case VariableState.Opaque: SpriteObjectAlphaFirstValue = 1f; break; case VariableState.Transparent: SpriteObjectAlphaFirstValue = 0f; break; } switch(secondState) { case VariableState.Opaque: SpriteObjectAlphaSecondValue = 1f; break; case VariableState.Transparent: SpriteObjectAlphaSecondValue = 0f; break; } if (setSpriteObjectAlpha) { SpriteObjectAlpha = SpriteObjectAlphaFirstValue * (1 - interpolationValue) + SpriteObjectAlphaSecondValue * interpolationValue; } if (interpolationValue < 1) { mCurrentState = (int)firstState; } else { mCurrentState = (int)secondState; } }
/// <summary>Sets the current state, and pushes that state onto the back stack.</summary> public void PushState(VariableState state) { this.CurrentState = state; #if !MONOGAME ScreenManager.PushStateToStack((int)this.CurrentState); #endif }
public void StopStateInterpolation(VariableState stateToStop) { switch(stateToStop) { case VariableState.Activated: OverallAlphaVelocity = 0; break; case VariableState.Deactivated: OverallAlphaVelocity = 0; break; } CurrentState = stateToStop; }
public void StopStateInterpolation (VariableState stateToStop) { switch(stateToStop) { case VariableState.Opaque: SpriteObject.AlphaRate = 0; break; case VariableState.Transparent: SpriteObject.AlphaRate = 0; break; } CurrentState = stateToStop; }
public void InterpolateBetween(VariableState firstState, VariableState secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new Exception("interpolationValue cannot be NaN"); } #endif switch(firstState) { case VariableState.Regular: break; case VariableState.Pressed: break; case VariableState.Disabled: break; case VariableState.Hover: break; } switch(secondState) { case VariableState.Regular: break; case VariableState.Pressed: break; case VariableState.Disabled: break; case VariableState.Hover: break; } }
protected void AddInstruction(VariableState variable) { foreach (var use in variable.Operand.Uses) { if (executedStatements.Contains(use)) { var context = new Context(InstructionSet, use); AddInstruction(context); } } }
public Instruction InterpolateToState(VariableState stateToInterpolateTo, double secondsToTake) { switch(stateToInterpolateTo) { case VariableState.Regular: break; case VariableState.Pressed: break; case VariableState.Disabled: break; case VariableState.Hover: break; } var instruction = new DelegateInstruction<VariableState>(StopStateInterpolation, stateToInterpolateTo); instruction.TimeToExecute = TimeManager.CurrentTime + secondsToTake; this.Instructions.Add(instruction); return instruction; }
public void InterpolateBetween(VariableState firstState, VariableState secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new System.Exception("interpolationValue cannot be NaN"); } #endif bool setAlphaFirstValue = false; bool setAlphaSecondValue = false; int AlphaFirstValue = 0; int AlphaSecondValue = 0; bool setBlueFirstValue = false; bool setBlueSecondValue = false; int BlueFirstValue = 0; int BlueSecondValue = 0; bool setGreenFirstValue = false; bool setGreenSecondValue = false; int GreenFirstValue = 0; int GreenSecondValue = 0; bool setHeightFirstValue = false; bool setHeightSecondValue = false; float HeightFirstValue = 0; float HeightSecondValue = 0; bool setRedFirstValue = false; bool setRedSecondValue = false; int RedFirstValue = 0; int RedSecondValue = 0; bool setRotationFirstValue = false; bool setRotationSecondValue = false; float RotationFirstValue = 0; float RotationSecondValue = 0; bool setTextureHeightFirstValue = false; bool setTextureHeightSecondValue = false; int TextureHeightFirstValue = 0; int TextureHeightSecondValue = 0; bool setTextureHeightScaleFirstValue = false; bool setTextureHeightScaleSecondValue = false; float TextureHeightScaleFirstValue = 0; float TextureHeightScaleSecondValue = 0; bool setTextureLeftFirstValue = false; bool setTextureLeftSecondValue = false; int TextureLeftFirstValue = 0; int TextureLeftSecondValue = 0; bool setTextureTopFirstValue = false; bool setTextureTopSecondValue = false; int TextureTopFirstValue = 0; int TextureTopSecondValue = 0; bool setTextureWidthFirstValue = false; bool setTextureWidthSecondValue = false; int TextureWidthFirstValue = 0; int TextureWidthSecondValue = 0; bool setTextureWidthScaleFirstValue = false; bool setTextureWidthScaleSecondValue = false; float TextureWidthScaleFirstValue = 0; float TextureWidthScaleSecondValue = 0; bool setWidthFirstValue = false; bool setWidthSecondValue = false; float WidthFirstValue = 0; float WidthSecondValue = 0; bool setXFirstValue = false; bool setXSecondValue = false; float XFirstValue = 0; float XSecondValue = 0; bool setYFirstValue = false; bool setYSecondValue = false; float YFirstValue = 0; float YSecondValue = 0; switch (firstState) { case VariableState.Default: setAlphaFirstValue = true; AlphaFirstValue = 255; if (interpolationValue < 1) { this.Animate = false; } setBlueFirstValue = true; BlueFirstValue = 255; if (interpolationValue < 1) { this.FlipHorizontal = false; } if (interpolationValue < 1) { this.FlipVertical = false; } setGreenFirstValue = true; GreenFirstValue = 255; setHeightFirstValue = true; HeightFirstValue = 100f; if (interpolationValue < 1) { this.HeightUnits = Gum.DataTypes.DimensionUnitType.PercentageOfSourceFile; } setRedFirstValue = true; RedFirstValue = 255; setRotationFirstValue = true; RotationFirstValue = 0f; if (interpolationValue < 1) { SetProperty("SourceFile", ""); } if (interpolationValue < 1) { this.TextureAddress = Gum.Managers.TextureAddress.EntireTexture; } setTextureHeightFirstValue = true; TextureHeightFirstValue = 0; setTextureHeightScaleFirstValue = true; TextureHeightScaleFirstValue = 0f; setTextureLeftFirstValue = true; TextureLeftFirstValue = 0; setTextureTopFirstValue = true; TextureTopFirstValue = 0; setTextureWidthFirstValue = true; TextureWidthFirstValue = 0; setTextureWidthScaleFirstValue = true; TextureWidthScaleFirstValue = 0f; if (interpolationValue < 1) { this.Visible = true; } setWidthFirstValue = true; WidthFirstValue = 100f; if (interpolationValue < 1) { this.WidthUnits = Gum.DataTypes.DimensionUnitType.PercentageOfSourceFile; } if (interpolationValue < 1) { this.Wrap = false; } setXFirstValue = true; XFirstValue = 0f; if (interpolationValue < 1) { this.XOrigin = RenderingLibrary.Graphics.HorizontalAlignment.Left; } if (interpolationValue < 1) { this.XUnits = Gum.Converters.GeneralUnitType.PixelsFromSmall; } setYFirstValue = true; YFirstValue = 0f; if (interpolationValue < 1) { this.YOrigin = RenderingLibrary.Graphics.VerticalAlignment.Top; } if (interpolationValue < 1) { this.YUnits = Gum.Converters.GeneralUnitType.PixelsFromSmall; } break; } switch (secondState) { case VariableState.Default: setAlphaSecondValue = true; AlphaSecondValue = 255; if (interpolationValue >= 1) { this.Animate = false; } setBlueSecondValue = true; BlueSecondValue = 255; if (interpolationValue >= 1) { this.FlipHorizontal = false; } if (interpolationValue >= 1) { this.FlipVertical = false; } setGreenSecondValue = true; GreenSecondValue = 255; setHeightSecondValue = true; HeightSecondValue = 100f; if (interpolationValue >= 1) { this.HeightUnits = Gum.DataTypes.DimensionUnitType.PercentageOfSourceFile; } setRedSecondValue = true; RedSecondValue = 255; setRotationSecondValue = true; RotationSecondValue = 0f; if (interpolationValue >= 1) { SetProperty("SourceFile", ""); } if (interpolationValue >= 1) { this.TextureAddress = Gum.Managers.TextureAddress.EntireTexture; } setTextureHeightSecondValue = true; TextureHeightSecondValue = 0; setTextureHeightScaleSecondValue = true; TextureHeightScaleSecondValue = 0f; setTextureLeftSecondValue = true; TextureLeftSecondValue = 0; setTextureTopSecondValue = true; TextureTopSecondValue = 0; setTextureWidthSecondValue = true; TextureWidthSecondValue = 0; setTextureWidthScaleSecondValue = true; TextureWidthScaleSecondValue = 0f; if (interpolationValue >= 1) { this.Visible = true; } setWidthSecondValue = true; WidthSecondValue = 100f; if (interpolationValue >= 1) { this.WidthUnits = Gum.DataTypes.DimensionUnitType.PercentageOfSourceFile; } if (interpolationValue >= 1) { this.Wrap = false; } setXSecondValue = true; XSecondValue = 0f; if (interpolationValue >= 1) { this.XOrigin = RenderingLibrary.Graphics.HorizontalAlignment.Left; } if (interpolationValue >= 1) { this.XUnits = Gum.Converters.GeneralUnitType.PixelsFromSmall; } setYSecondValue = true; YSecondValue = 0f; if (interpolationValue >= 1) { this.YOrigin = RenderingLibrary.Graphics.VerticalAlignment.Top; } if (interpolationValue >= 1) { this.YUnits = Gum.Converters.GeneralUnitType.PixelsFromSmall; } break; } if (setAlphaFirstValue && setAlphaSecondValue) { Alpha = FlatRedBall.Math.MathFunctions.RoundToInt(AlphaFirstValue * (1 - interpolationValue) + AlphaSecondValue * interpolationValue); } if (setBlueFirstValue && setBlueSecondValue) { Blue = FlatRedBall.Math.MathFunctions.RoundToInt(BlueFirstValue * (1 - interpolationValue) + BlueSecondValue * interpolationValue); } if (setGreenFirstValue && setGreenSecondValue) { Green = FlatRedBall.Math.MathFunctions.RoundToInt(GreenFirstValue * (1 - interpolationValue) + GreenSecondValue * interpolationValue); } if (setHeightFirstValue && setHeightSecondValue) { Height = HeightFirstValue * (1 - interpolationValue) + HeightSecondValue * interpolationValue; } if (setRedFirstValue && setRedSecondValue) { Red = FlatRedBall.Math.MathFunctions.RoundToInt(RedFirstValue * (1 - interpolationValue) + RedSecondValue * interpolationValue); } if (setRotationFirstValue && setRotationSecondValue) { Rotation = RotationFirstValue * (1 - interpolationValue) + RotationSecondValue * interpolationValue; } if (setTextureHeightFirstValue && setTextureHeightSecondValue) { TextureHeight = FlatRedBall.Math.MathFunctions.RoundToInt(TextureHeightFirstValue * (1 - interpolationValue) + TextureHeightSecondValue * interpolationValue); } if (setTextureHeightScaleFirstValue && setTextureHeightScaleSecondValue) { TextureHeightScale = TextureHeightScaleFirstValue * (1 - interpolationValue) + TextureHeightScaleSecondValue * interpolationValue; } if (setTextureLeftFirstValue && setTextureLeftSecondValue) { TextureLeft = FlatRedBall.Math.MathFunctions.RoundToInt(TextureLeftFirstValue * (1 - interpolationValue) + TextureLeftSecondValue * interpolationValue); } if (setTextureTopFirstValue && setTextureTopSecondValue) { TextureTop = FlatRedBall.Math.MathFunctions.RoundToInt(TextureTopFirstValue * (1 - interpolationValue) + TextureTopSecondValue * interpolationValue); } if (setTextureWidthFirstValue && setTextureWidthSecondValue) { TextureWidth = FlatRedBall.Math.MathFunctions.RoundToInt(TextureWidthFirstValue * (1 - interpolationValue) + TextureWidthSecondValue * interpolationValue); } if (setTextureWidthScaleFirstValue && setTextureWidthScaleSecondValue) { TextureWidthScale = TextureWidthScaleFirstValue * (1 - interpolationValue) + TextureWidthScaleSecondValue * interpolationValue; } if (setWidthFirstValue && setWidthSecondValue) { Width = WidthFirstValue * (1 - interpolationValue) + WidthSecondValue * interpolationValue; } if (setXFirstValue && setXSecondValue) { X = XFirstValue * (1 - interpolationValue) + XSecondValue * interpolationValue; } if (setYFirstValue && setYSecondValue) { Y = YFirstValue * (1 - interpolationValue) + YSecondValue * interpolationValue; } if (interpolationValue < 1) { mCurrentVariableState = firstState; } else { mCurrentVariableState = secondState; } }
public void InterpolateBetween(VariableState firstState, VariableState secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new Exception("interpolationValue cannot be NaN"); } #endif switch(firstState) { case VariableState.R_Idle: break; case VariableState.L_Idle: break; case VariableState.R_Hurt: break; case VariableState.L_Hurt: break; case VariableState.R_Die: break; case VariableState.L_Die: break; case VariableState.R_Attack: break; case VariableState.L_Attack: break; case VariableState.R_Walking: break; case VariableState.L_Walking: break; } switch(secondState) { case VariableState.R_Idle: break; case VariableState.L_Idle: break; case VariableState.R_Hurt: break; case VariableState.L_Hurt: break; case VariableState.R_Die: break; case VariableState.L_Die: break; case VariableState.R_Attack: break; case VariableState.L_Attack: break; case VariableState.R_Walking: break; case VariableState.L_Walking: break; } }
public void StopStateInterpolation (VariableState stateToStop) { switch(stateToStop) { case VariableState.Orden1: break; case VariableState.Orden2: break; } CurrentState = stateToStop; }
public Instruction InterpolateToState(VariableState stateToInterpolateTo, double secondsToTake) { switch(stateToInterpolateTo) { case VariableState.R_Idle: break; case VariableState.L_Idle: break; case VariableState.R_Hurt: break; case VariableState.L_Hurt: break; case VariableState.R_Die: break; case VariableState.L_Die: break; case VariableState.R_Attack: break; case VariableState.L_Attack: break; case VariableState.R_Walking: break; case VariableState.L_Walking: break; } var instruction = new DelegateInstruction<VariableState>(StopStateInterpolation, stateToInterpolateTo); instruction.TimeToExecute = TimeManager.CurrentTime + secondsToTake; this.Instructions.Add(instruction); return instruction; }
public static void PreloadStateContent (VariableState state, string contentManagerName) { ContentManagerName = contentManagerName; switch(state) { case VariableState.Orden1: { object throwaway = "Orden1"; } break; case VariableState.Orden2: { object throwaway = "Orden2"; } break; } }
public void StopStateInterpolation(VariableState stateToStop) { switch(stateToStop) { case VariableState.R_Idle: break; case VariableState.L_Idle: break; case VariableState.R_Hurt: break; case VariableState.L_Hurt: break; case VariableState.R_Die: break; case VariableState.L_Die: break; case VariableState.R_Attack: break; case VariableState.L_Attack: break; case VariableState.R_Walking: break; case VariableState.L_Walking: break; } CurrentState = stateToStop; }