Esempio n. 1
0
        public async void AddWorketIntoProject()
        {
            string UserName = await Utils.InputDialog.InputBox(NavigationUtil.Navigation);

            User user = Database.Database.GetUser(UserName);

            if (user == null)
            {
                Toast.ShowToast("Error", "User not found!");
                return;
            }
            else
            {
                WorkerList.Add(new ProfileViewModel(user));
                Project.WorkerIDList.Add(user.ID);
                Database.Database.UpdateProject(Project);
            }
            BsonDocument bson = new BsonDocument();

            bson.Add("ProjectName", Project.Name);
            bson.Add("ManagerName", Auth.CurrentUser.Name);
            Notification notification = new Notification
            {
                From = Auth.CurrentUser.ID,
                To   = user.ID,
                Type = NotificationType.WorkerAddedToProject,
                Line = bson
            };

            Database.Database.AddNotification(ref notification);
            Toast.ShowToast("Complete!", "Worker has been added to project");
        }
Esempio n. 2
0
    void Awake()
    {
        workers = new WorkerList(wc.workersPerLevel, wc.levelsNum);

        wc.onAddWorker.RemoveAllListeners();
        wc.onLeaderDeath.RemoveAllListeners();
        wc.onMergeOver.RemoveAllListeners();

        workers.Add(leader);
    }
 /// <summary>
 /// Append worker to department and set his "department" field with current deparment name.
 /// </summary>
 /// <param name="worker"></param>
 public void AppendWorker(Worker worker)
 {
     worker.ChangeDepartment(DepartmentName);
     if (WorkerList.Count < 1)
     {
         worker.ChangeID(1);
     }
     else
     {
         worker.ChangeID(WorkerList[WorkerList.Count - 1].ID + 1);
     }
     WorkerList.Add(worker);
 }
 /// <summary>
 /// Append worker to department and set thier "department" field with current deparment name.
 /// </summary>
 /// <param name="workers"></param>
 public void AppendWorkers(List <Worker> workers)
 {
     for (int i = 0; i < workers.Count; i++)
     {
         if (WorkerList.Count < 1)
         {
             workers[i].ChangeDepartment(DepartmentName);
             workers[i].ChangeID(0);
             WorkerList.Add(workers[i]);
         }
         else
         {
             workers[i].ChangeDepartment(DepartmentName);
             workers[i].ChangeID(WorkerList[WorkerList.Count - 1].ID + 1);
             WorkerList.Add(workers[i]);
         }
     }
 }
Esempio n. 5
0
    public void AddWorker(Vector2 pos)
    {
        if (TutorialManager.Instance.Active && TutorialManager.Instance.TutorialState == TutorialState.AddWorker)
        {
            TutorialManager.Instance.ExitState();
        }

        GameObject worker = ObjectPooler.Instance.GetFromPool(wc.workerType);

        worker.transform.position = new Vector3(pos.x, worker.transform.position.y, pos.y);
        WorkerFSM workerFSM = worker.GetComponent <WorkerFSM>();

        workerFSM.level  = 0;
        workerFSM.health = 1;

        workers.Add(workerFSM);
        AudioManager.Instance.PlaySound("Add Worker");
    }
Esempio n. 6
0
        private void onLocalConnected(IAsyncResult ar)
        {
            Object[] objs       = ar.AsyncState as Object[];
            Socket   tempSocket = objs[0] as Socket;
            Socket   local      = tempSocket.EndAccept(ar);

            try
            {
                tempSocket.BeginAccept(onLocalConnected, ar.AsyncState);
                Console.WriteLine("In onLocalConnected");
                Socket remote = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                remote.Connect(TargetAddress, TargetPort);

                SocketBridge worker = new SocketBridge(local, remote, BuffSize);// { parent = this };
                worker.Stopped += (ex) => { WorkerList.Remove(worker);  Console.WriteLine(ex == null ? "正常退出" : ex.Message + ex.StackTrace); };
                worker.Start();
                WorkerList.Add(worker);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + ex.StackTrace);
            }
        }
Esempio n. 7
0
    public bool AddWorker(Prole p)
    {
        if (WorkerList.Count >= workersMax)
        {
            return(false);
        }

        population.EmployProle(p);
        WorkerList.Add(p);
        p.JoinWork(this);

        CalculateWorkerEffectiveness();

        //update UI if possible
        Action <Prole, Workplace> act = ProleEmploymentAction;

        if (act != null)
        {
            act.Invoke(p, this);
        }

        return(true);
    }