Пример #1
0
 private void getCounts(JobHolder jh)
 {
     for (int i = 1; i < 4; i++)
     {
         f["days"] = f.safeInt("count" + i.ToString()).ToString();
         f["next"] = i == 3 ? "-1" : f.safeInt("count" + (i + 1).ToString()).ToString();
         jh.AddRange(eng.db2().GetZooTechJobs(f, JobType.CountKids));
     }
 }
Пример #2
0
 private TValue CheckJobCompletion(TKey key, JobHolder job)
 {
     if (job.handle.IsCompleted)
     {
         job.handle.Complete();
         var result = GetResultFromJob(job.job);
         Debug.Log($"Job for key {key} completed in {Time.realtimeSinceStartup - job.startTime} seconds");
         return(result);
     }
     return(null);
 }
Пример #3
0
 public void SetJobs()
 {
     if (gameObject.tag == "Player") // for player with jobs in backpackinventory
     {
         jobs = new JobHolder[playerClasses.classInventory.Length];
         for (int i = 0; i < jobs.Length; i++)
         {
             jobs[i] = new JobHolder(playerClasses.classInventory[i]);
         }
     }
     else // for enemies with only one job
     {
         jobs    = new JobHolder[1];
         jobs[0] = new JobHolder(job);
     }
 }
Пример #4
0
        public void ScheduleJob(TKey key, Action <TKey, TValue> completionAction)
        {
            if (_jobs.ContainsKey(key))
            {
                Debug.Log($"Job already scheduled for key {key}");
                return;
            }

            var job       = CreateJob(key);
            var jobHandle = job.Schedule();

            var jobHolder = new JobHolder()
            {
                job              = job,
                handle           = jobHandle,
                startTime        = Time.realtimeSinceStartup,
                completionAction = completionAction
            };

            _jobs.Add(key, jobHolder);
        }
Пример #5
0
        public ZootehJob[] makeZooTehPlan(Filters f, int type)
        {
            JobHolder zjobs = new JobHolder();

            this.f = f;

            switch (type)
            {
            case 0:
                if (f.safeValue("act", "O").Contains("O"))
                {
                    zjobs.AddRange(eng.db2().GetZooTechJobs(f, JobType.Okrol));
                }
                break;

            case 1:
                if (f.safeValue("act", "V").Contains("V"))
                {
                    zjobs.AddRange(eng.db2().GetZooTechJobs(f, JobType.NestOut));
                }
                break;

            case 2:
                if (f.safeValue("act", "C").Contains("C"))
                {
                    this.getCounts(zjobs);
                }
                break;

            case 3:
                if (f.safeValue("act", "P").Contains("P"))
                {
                    zjobs.AddRange(eng.db2().GetZooTechJobs(f, JobType.PreOkrol));
                }
                break;

            case 4:
                if (f.safeValue("act", "R").Contains("R"))
                {
                    this.getBoysGirlsOut(zjobs);
                }
                break;

            case 5:
                if (f.safeValue("act", "F").Contains("F"))
                {
                    this.getFucks(zjobs, 0);
                }
                break;

            case 6:
                if (f.safeValue("act", "f").Contains("f"))
                {
                    this.getFucks(zjobs, 1);
                }
                break;

            case 7:
                if (f.safeValue("act", "v").Contains("v"))
                {
                    zjobs.AddRange(eng.db2().GetZooTechJobs(f, JobType.Vaccine));
                }
                break;

            case 8:
                if (f.safeValue("act", "N").Contains("N"))
                {
                    zjobs.AddRange(eng.db2().GetZooTechJobs(f, JobType.NestSet));
                }
                break;

            case 9:
                if (f.safeValue("act", "B").Contains("B"))
                {
                    zjobs.AddRange(eng.db2().GetZooTechJobs(f, JobType.BoysByOne));
                }
                break;

            case 10:
                if (f.safeValue("act", "S").Contains("S"))
                {
                    zjobs.AddRange(eng.db2().GetZooTechJobs(f, JobType.SpermTake));
                }
                break;
            }

            return(zjobs.ToArray());
        }
Пример #6
0
 /// <summary>
 /// Добавляет к работам Случки или Вязки
 /// </summary>
 /// <param name="jh">Список работ</param>
 /// <param name="type">0- Случка, 1-Вязка</param>
 private void getFucks(JobHolder jh, int type)
 {
     f[Filters.MAKE_BRIDE] = eng.brideAge().ToString();
     f[Filters.TYPE]       = type.ToString();
     jh.AddRange(eng.db2().GetZooTechJobs(f, JobType.F**k));//ztGetZooFuck(f));
 }
Пример #7
0
 private void getBoysGirlsOut(JobHolder jh)
 {
     jh.AddRange(eng.db2().GetZooTechJobs(f, JobType.BoysOut));
     jh.AddRange(eng.db2().GetZooTechJobs(f, JobType.GirlsOut));
 }
Пример #8
0
    public override Chunk LoadChunkAt(Vector3 worldOrigin)
    {
        int   size  = world.chunkSize;
        float scale = world.voxelSize;

        int buffer = size + 1;

        if (!_jobs.ContainsKey(worldOrigin))
        {
            var job = CreateJob(worldOrigin);

            var handle = job.Schedule();

            //Check to see if we completed it
            if (handle.IsCompleted)
            {
                handle.Complete();

                var sample = ChunkFromJob(job);

                var c = new Chunk(world.OriginToPoint(worldOrigin), sample, size, world.Height);

                c.Recalculate(size, scale, worldOrigin, true);

                if (fileLoader != null)
                {
                    fileLoader.SaveChunk(c);
                }

                _jobs.Remove(worldOrigin);

                return(c);
            }

            var holder = new JobHolder()
            {
                job       = job,
                handle    = handle,
                startTime = Time.time
            };

            _jobs.Add(worldOrigin, holder);
        }
        else
        {
            var holder = _jobs[worldOrigin];

            if (holder.handle.IsCompleted)
            {
                holder.handle.Complete();

                var sample = ChunkFromJob(holder.job);

                var c = new Chunk(world.OriginToPoint(worldOrigin), sample, size, world.Height);

                c.Recalculate(size, scale, worldOrigin, true);

                if (fileLoader != null)
                {
                    fileLoader.SaveChunk(c);
                }

                _jobs.Remove(worldOrigin);

                float duration = Time.time - holder.startTime;

                runningSum += duration;

                JobsCompleted++;

                TimeSpentAverage = runningSum / JobsCompleted;

                return(c);
            }
        }

        return(null);
    }
Пример #9
0
 public void Update()
 {
     playerEquipedJob = player.jobs[player.currentJobIdx];
 }