Ejemplo n.º 1
0
    private void render()
    {
        copylist.Clear();
        copylist.InsertRange(0, list);
        float time = Time.time;

        for (int i = 0; i < copylist.Count; i++)
        {
            HandleTask task = copylist[i];
            if (task.calltime == time)
            {
                continue;
            }
            float runTime = task.calltime + task.deletime;
            if (time < runTime)
            {
                continue;
            }
            task.Do();
            //copylist.Remove(task);
            //i--;
            list.Remove(task);
        }
        if (copylist.Count == 0)
        {
            MyTickManager.Remove(render);
        }
    }
Ejemplo n.º 2
0
 private bool tryGetTask(Action <object> handle, out HandleTask task)
 {
     task = null;
     if (handle == null)
     {
         return(false);
     }
     for (int i = 0; i < list.Count; i++)
     {
         if (list[i].Equle(handle))
         {
             task = list[i];
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 3
0
        public RequestTimeConsumer(IConfiguration config, HandleTask <RegisterFace> handleTaskRegister, HandleTask <DetectFace> handleTaskDetect, HandleTask <DeleteFace> handleTaskDelete)
        {
            Config = config;
            var consumerConfig = new ConsumerConfig()
            {
                GroupId          = Config["OutsideSystems:Kafka:ConsumerSettings:GroupId"],
                BootstrapServers = Config["OutsideSystems:Kafka:ConsumerSettings:BootstrapServers"]
            };

            this.kafkaConsumer = new ConsumerBuilder <string, string>(consumerConfig).Build();

            //get list kenh dang ky
            this.Channels = config.GetSection("OutsideSystems:Kafka:AllowedSucribers").Get <IEnumerable <string> >();
            Console.WriteLine(JsonConvert.SerializeObject(Channels));
            HandleTaskRegister = handleTaskRegister;
            HandleTaskDetect   = handleTaskDetect;
            HandleTaskDelete   = handleTaskDelete;
        }