Пример #1
0
        private void DoPunchIn(string enrollmentId)
        {
            PunchManager     punchManager = new PunchManager();
            UserVoiceManager mgr          = new UserVoiceManager();

            EmployeeEnrollment enrollment = mgr.GetEmployeeEnrollment(enrollmentId);

            if (enrollment != null)
            {
                Punch p = new Punch
                {
                    ClientId            = enrollment.ClientId,
                    EmployeeUid         = enrollment.EmployeeUid,
                    DepartmentUid       = enrollment.DepartmentUid,
                    PunchDateTime       = DateTime.Now,
                    PunchSourceTypeId   = (byte)1, //manual
                    PunchActivityTypeId = (byte)1, //work
                    PunchStatusTypeId   = (byte)1, //auto
                    LaborAssociations   = new System.Collections.Generic.List <LaborPunchAssociation>(),
                    IsActive            = true,
                    CanBeProcessed      = true,
                    UserKey             = Guid.Parse("C00E2729-9FFA-E511-8893-005056BD7869")
                };

                punchManager.InsertPunch(p);
            }
            else
            {
                throw new Exception("Enrollment record could not be read from cosmosdb");
            }
        }
Пример #2
0
    private void Start()
    {
        m_animator = GetComponent <Animator>();
        m_rb       = GetComponent <Rigidbody2D>();
        m_sr       = GetComponent <SpriteRenderer>();
        m_pj       = GetComponent <PlayerJump>();
        m_pj.JumpEvent.AddListener(OnJumpEvent);
        m_pm = GetComponent <PunchManager>();
        m_pm.PunchEvent.AddListener(OnPunchEvent);
        m_na = GetComponent <NetworkAnimator>();

        m_animator.runtimeAnimatorController = CharSelector.GetInstance().chars[controllerIndex];
    }
Пример #3
0
        // Return value: whether to attempt breaking again.
        public static bool Start()
        {
            App.Status = "Initializing...";

            // Retrieve ProcessHandle.
            var ps = Process.GetProcessesByName("Growtopia");

            if (ps.Length == 0)
            {
                App.Status = "Growtopia isn't open.";
                return(false);
            }
            else if (ps.Length > 1)
            {
                App.Status = "More than one Growtopia detected.";
                return(false);
            }
            Process       process = ps.Single();
            ProcessHandle handle  = process.GetHandle();

            // Prepare local variables.
            MovementManager movementManager = new MovementManager();
            PunchManager    punchManager    = new PunchManager();

            bool direction = false;

            if (!UserSettings.Current.DebugMode && (!handle.GetNextBlockInfo()?.IsBlock() ?? true))
            {
                App.Status = "No blocks found.";
                return(false);
            }

            /* var sw = Stopwatch.StartNew(); */

            // Breaking.
            Discord.Update(DiscordStatus.Breaking, rows);
            App.Status = "Breaking...";
            bool NextRowCondition = false;

            while (Active)
            {
                /* App.Status = ((double)sw.ElapsedTicks * 1000 / Stopwatch.Frequency).ToString(); */
                /* sw.Restart(); */

                // Getting distance.
                var info = handle.GetNextBlockInfo();
                int distance;
                if (!UserSettings.Current.DebugMode)
                {
                    if (!info?.IsBlock() ?? true)
                    {
                        if (info?.IsDoor() ?? false)
                        {
                            NextRowCondition = true;
                        }
                        break;
                    }
                    distance = info.Distance;
                }
                else
                {
                    distance = info?.Distance ?? -128;
                }

                direction = handle.GetDirection();

                // Simulating punch.
                if (!UserSettings.Current.DebugMode && UserSettings.Current.Punch)
                {
                    bool?punch = punchManager.Update();
                    if (punch != null)
                    {
                        handle.SendKey(Keys.Space, punch.Value);
                    }
                }

                // Simulating movement.
                // Determining movement based on time/distance.
                if (!UserSettings.Current.DebugMode)
                {
                    bool?down = movementManager.Update(Move(distance, direction));
                    if (down != null)
                    {
                        handle.SendKey(direction ? Keys.D : Keys.A, down.Value);
                    }
                }

                if (info == null)
                {
                    App.Status = "No blocks found.";
                }
                else
                {
                    App.Status = "FG: " + info.Foreground + ", BG: " + info.Background + ", distance: " + info.Distance + ".";
                }
            }

            // Cancelling input if there's any.
            handle.SendKey(direction ? Keys.D : Keys.A, false);
            handle.SendKey(Keys.Space, false);

            if (Active == true)
            {
                rows++;
                if (!UserSettings.Current.DebugMode && UserSettings.Current.Continue && NextRowCondition)
                {
                    App.Status = "Executing custom script...";
                    Discord.Update(DiscordStatus.Advancing, rows);
                    handle.ExecuteScript(direction);
                    if (!Active)
                    {
                        App.Status = "Finished: manual request.";
                        return(false);
                    }
                }
                else
                {
                    App.Status = "Finished: out of blocks.";
                }
                return(UserSettings.Current.Continue && !UserSettings.Current.DebugMode);
            }
            else
            {
                App.Status = "Finished: manual request.";
                return(false);
            }
        }
Пример #4
0
	private void Awake() {
		instance = this;
	}