Exemplo n.º 1
0
 private static void Postfix(ExistingJobDebt jobDebt)
 {
     if (NetworkManager.IsClient() && SingletonBehaviour <NetworkTrainManager> .Exists && SingletonBehaviour <NetworkTrainManager> .Instance.IsSynced && SingletonBehaviour <NetworkDebtManager> .Exists && !SingletonBehaviour <NetworkDebtManager> .Instance.IsChangeByNetwork)
     {
         SingletonBehaviour <NetworkDebtManager> .Instance.OnJobDeptPaid(jobDebt.ID, false);
     }
 }
Exemplo n.º 2
0
    private void OnJobDeptPaidMessage(Message message)
    {
        using (DarkRiftReader reader = message.GetReader())
        {
            Main.Log($"[CLIENT] < DEBT_JOB_PAID");

            while (reader.Position < reader.Length)
            {
                IsChangeByNetwork = true;
                DebtPaid data = reader.ReadSerializable <DebtPaid>();
                if (data.isDestroyed)
                {
                    StagedJobDebt debt = SingletonBehaviour <JobDebtController> .Instance.stagedJobsDebts.FirstOrDefault(t => t.ID == data.Id);

                    if (debt != null)
                    {
                        debt.Pay();
                    }
                }
                else
                {
                    ExistingJobDebt debt = SingletonBehaviour <JobDebtController> .Instance.existingTrackedJobs.FirstOrDefault(t => t.ID == data.Id);

                    if (debt != null)
                    {
                        debt.Pay();
                    }
                }
                IsChangeByNetwork = false;
            }
        }
    }