private static List <object> PrepareParameters(ProcessingElement current, UnitContext octx, TransferingContext tctx) { List <object> parameters = new List <object>(); if (current.Method != null) { // TODO memoize me // TODO inject headers foreach (var parameterInfo in current.Method.GetParameters()) { if (parameterInfo.ParameterType.IsAssignableFrom(octx.GetUnitType())) { parameters.Add(octx.Unit); } else if (parameterInfo.ParameterType == typeof(TransferingContext)) { parameters.Add(tctx); } else if (parameterInfo.ParameterType == typeof(UnitContext)) { parameters.Add(octx); } else { throw new ParameterTypeMissmatchException(current.Carrier, current.Method.Name, octx.GetUnitType(), parameterInfo.ParameterType); } } } return(parameters); }
public List <UnitContext> GenerateDiapason(DatesDiapason diapason, UnitContext ctx) { var diapasonSize = diapason.To - diapason.From; return(Enumerable.Range(0, (int)diapasonSize.TotalDays + 1) .Select(dayNumber => diapason.From.AddDays(dayNumber)) .Select(el => new UnitContext(ctx.ProcessingId, $"{el}", el, ctx.Headers)).ToList()); }
public void Init(UnitContext context, int level, int id, UnitLevelController _main) { myContext = context; main = _main; myId = id; mySprite.sprite = context.image; currentLevel = level; PrintData(); }
public BossActiveSkillUsingSystem(Contexts contexts, TurnNotification noti, SystemController syscon) : base(contexts) { _cardContext = contexts.card; _unitContext = contexts.unit; _eventContext = contexts.gameEvent; _noti = noti; _syscon = syscon; }
public void SetAllContexts() { bullet = new BulletContext(); globals = new GlobalsContext(); input = new InputContext(); unit = new UnitContext(); CreateContextObserver(bullet); CreateContextObserver(globals); CreateContextObserver(input); CreateContextObserver(unit); }
public IEnumerator <UnitContext> Generate(UnitContext ctx) { foreach (var i in Ints) { if (i > 100) { throw new Exception("More than 100."); } var nctx = new UnitContext(Guid.NewGuid().ToString("n"), $"id:{i}", i); yield return(nctx); } }
public UpdateUnitShooting(UnitContext unitContext) { var idx = new EntityIndex <UnitEntity, int>( unitContext.GetGroup(UnitMatcher.Team), (entity, component) => { var team = component as Team; return(team != null ? team.id : entity.team.id); }); unitContext.AddEntityIndex(TARGETS_INDEX_NAME, idx); _units = unitContext; _shooters = unitContext.GetGroup(UnitMatcher.Team); }
public async Task Process(TransferingContext tctx, object seed, string unitId = "", string operationId = "", Headers headers = null) { tctx.Set("pipelineid", Id); try { var octx = new UnitContext(string.IsNullOrEmpty(operationId) ? Guid.NewGuid().ToString("n") : operationId, unitId, seed, headers?.Dict); await mAction(tctx, octx); } catch (Exception e) { tctx.Exception = e; } }
// shaderType = GetShaderType() public ShaderContext(Type shaderType) { _shader = LoadReflection(shaderType); _shaderType = shaderType; Varyings = CollectVaryings(); Uniforms = CollectUniforms(); Ins = CollectIns(); Outs = CollectOuts(); Attribs = new List <VariableDescription>(); FragmentUnit = CollectFuncs <FragmentShaderAttribute>(ShaderType.FragmentShader); VertexUnit = CollectFuncs <VertexShaderAttribute>(ShaderType.VertexShader); _shader = null; }
private static void SetCollectedUnit(Splitter current, UnitContext octx, Dictionary <string, IList <UnitContext> > dict) { var runit = dict.Select(el => { foreach (var ctx in el.Value) { ctx.Set("$collection_id", el.Key); } return(el.Value); }).ToList(); octx.Unit = current.ConnectedCollector.Method != null ? (object)runit : runit.First(); }
public UnitController(UnitContext context) { _context = context; if (_context.Units.Count() == 0) { _context.Units.Add(new Unit { UnitName = "Web Application Development", UnitCode = "FIT5032" }); _context.Units.Add(new Unit { UnitName = "Programming Foundations in Java", UnitCode = "FIT9131" }); _context.Units.Add(new Unit { UnitName = "Introduction to Databases", UnitCode = "FIT9132" }); _context.SaveChanges(); } }
public Contexts() { buff = new BuffContext(); card = new CardContext(); game = new GameContext(); gameEvent = new GameEventContext(); tile = new TileContext(); unit = new UnitContext(); var postConstructors = System.Linq.Enumerable.Where( GetType().GetMethods(), method => System.Attribute.IsDefined(method, typeof(Entitas.CodeGeneration.Attributes.PostConstructorAttribute)) ); foreach (var postConstructor in postConstructors) { postConstructor.Invoke(this, null); } }
private static Exception ProcessException(ProcessingElement current, TransferingContext tctx, Exception exception, UnitContext octx, object obj, bool exceptionAllowed = false) { if (current?.ErrorProcessorMethod == null) { return(exception); } octx.Exception = exception; var errParams = new List <object>(); foreach (var param in current.ErrorProcessorMethod.GetParameters()) { if (param.ParameterType == typeof(Exception)) { errParams.Add(exception); } if (param.ParameterType == typeof(UnitContext)) { errParams.Add(octx); } if (param.ParameterType == typeof(TransferingContext)) { errParams.Add(tctx); } } try { var result = (bool)current.ErrorProcessorMethod.Invoke(obj, errParams.ToArray()) && exceptionAllowed; return(!result ? exception : null); } catch (Exception errorProcessingException) { var exceptions = new AggregateException(exception, errorProcessingException); tctx.Exception = exceptions; return(exceptions); } }
public UnitContext unit() { UnitContext _localctx = new UnitContext(Context, State); EnterRule(_localctx, 0, RULE_unit); int _la; try { EnterOuterAlt(_localctx, 1); { State = 23; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la == T__0) { { { State = 20; _localctx._def = def(); _localctx._defs.Add(_localctx._def); } } State = 25; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } } } catch (RecognitionException re) { _localctx.exception = re; ErrorHandler.ReportError(this, re); ErrorHandler.Recover(this, re); } finally { ExitRule(); } return(_localctx); }
public LocalCharacterFlagSystem(Contexts contexts) : base(contexts.game) { _context = contexts.unit; }
public UpdateShootingCooldown(UnitContext units, GlobalsContext globals) { _cooldownUnits = units.GetGroup(UnitMatcher.ShootingCooldown); _globals = globals; }
public bool Collect(UnitContext ctx, List <int> list) { Lists.TryAdd(ctx.UnitId, list); return(true); }
public LocalPlayerStartGameFocusSystem(Contexts contexts) : base(contexts) { _unitContext = contexts.unit; }
public PlayerCharacterCreatingSystem(Contexts contexts) { _gameContext = contexts.game; _tileContext = contexts.tile; _unitContext = contexts.unit; }
public ContextManager(Unit unit) { this.unit = unit; this.context = new UnitContext(unit); }
public static System.Collections.Generic.HashSet <UnitEntity> GetEntitiesWithId(this UnitContext context, int Id) { return(((Entitas.EntityIndex <UnitEntity, int>)context.GetEntityIndex(Contexts.Id)).GetEntities(Id)); }
public ProductRepository(UnitContext dbContext) { _dbContext = dbContext; }
public override ASTNode VisitUnit([NotNull] UnitContext ctx) => new SourceNode(ctx.NAME().GetText(), this.Visit(ctx.block()));
public UnitReactiveSystem(Contexts contexts) : base(contexts.unit) { _context = contexts.unit; }
public UnitsController(UnitContext context) { _context = context; }
public static System.Collections.Generic.HashSet <UnitEntity> GetEntitiesWithMapPosition(this UnitContext context, Position Value) { return(((Entitas.EntityIndex <UnitEntity, Position>)context.GetEntityIndex(Contexts.MapPosition)).GetEntities(Value)); }
public PlayersController(UnitContext context) { _context = context; }
public MissionBossSetupSystem(Contexts contexts) : base(contexts) { _unitContext = contexts.unit; _tileContext = contexts.tile; }
public DestroyUnits(UnitContext bullets) : base(bullets) { _bullets = bullets; }
public PlatoonsController(UnitContext context) { _context = context; }