Example #1
0
        /// <summary>
        /// Integration Constructor
        /// </summary>
        static VSCode()
        {
            if (Enabled)
            {
                UpdateUnityPreferences(true);
                UpdateLaunchFile();
                
                // Add Update Check
                DateTime targetDate = LastUpdate.AddDays(UpdateTime);
                if (DateTime.Now >= targetDate && AutomaticUpdates)
                {
                    CheckForUpdate();
                }

                // Open VS Code automatically when project is loaded
                if (AutoOpenEnabled)
                {
                    CheckForAutoOpen();
                }
                
            }
            
            // Event for when script is reloaded 
            System.AppDomain.CurrentDomain.DomainUnload += System_AppDomain_CurrentDomain_DomainUnload;
        }
Example #2
0
        /// <summary>
        /// Integration Constructor
        /// </summary>
        static VSCode()
        {
            if (Enabled)
            {
                UpdateUnityPreferences(true);

                // Handle Moving To New Folder
                if (MoveToFolderAutomatically)
                {
                    if (CheckFileLocation())
                    {
                        return;
                    }
                }

                // Add Update Check
                DateTime targetDate = LastUpdate.AddDays(UpdateTime);
                if (DateTime.Now >= targetDate)
                {
                    CheckForUpdate();
                }
            }



            //System.AppDomain.CurrentDomain.DomainUnload += System_AppDomain_CurrentDomain_DomainUnload;
        }
        /// <summary>
        /// Integration Constructor
        /// </summary>
        static VSCode()
        {
            if (Enabled)
            {
                UpdateUnityPreferences(true);

                // disable vs code and reset vs community as the default external editor
                EditorPrefs.SetString("kScriptsDefaultApp", EditorPrefs.GetString("VSCode_PreviousApp"));

                // sync will now successfully create or update the solution and project files
                SyncSolution();

                UpdateLaunchFile();

                // Re enable vscode
                EditorPrefs.SetString("kScriptsDefaultApp", CodePath);

                // Add Update Check
                DateTime targetDate = LastUpdate.AddDays(UpdateTime);
                if (DateTime.Now >= targetDate && AutomaticUpdates)
                {
                    CheckForUpdate();
                }
            }

            // Event for when script is reloaded
            System.AppDomain.CurrentDomain.DomainUnload += System_AppDomain_CurrentDomain_DomainUnload;
        }
Example #4
0
        /// <summary>
        /// Integration Constructor
        /// </summary>
        static VSCode()
        {
            if (Enabled)
            {
                UpdateUnityPreferences(true);
                UpdateLaunchFile();

                // Add Update Check
                DateTime targetDate = LastUpdate.AddDays(UpdateTime);
                if (DateTime.Now >= targetDate)
                {
                    CheckForUpdate();
                }
            }

            //System.AppDomain.CurrentDomain.DomainUnload += System_AppDomain_CurrentDomain_DomainUnload;
        }
Example #5
0
        static VSCode()
        {
            if (Enabled)
            {
                UpdateUnityPreferences(true);
                UpdateLaunchFile();

                DateTime targetDate = LastUpdate.AddDays(UpdateTime);
                if (DateTime.Now >= targetDate && AutomaticUpdates)
                {
                    CheckForUpdate();
                }

                if (AutoOpenEnabled)
                {
                    CheckForAutoOpen();
                }
            }

            System.AppDomain.CurrentDomain.DomainUnload += System_AppDomain_CurrentDomain_DomainUnload;
        }
Example #6
0
        public bool Update()
        {
            if (LastUpdate.AddDays(7) < DateTime.Now)
            {
                int revenues = 0;

                for (int i = 0; i < Constructions.Count; i++)
                {
                    if (Constructions[i].Effet == GeoEffet.Revenues)
                    {
                        revenues += Constructions[i].EffetLevel;
                    }
                }
                for (int i = 0; i < Citoyens.Count; i++)
                {
                    if (Citoyens[i].Taxe > 0)
                    {
                        revenues += Citoyens[i].Taxe;
                    }
                    if (Citoyens[i].Salaire > 0)
                    {
                        revenues -= Citoyens[i].Salaire;
                    }
                }
                for (int i = 0; i < Conseillers.Count; i++)
                {
                    if (Conseillers[i].Salaire > 0)
                    {
                        revenues -= Conseillers[i].Salaire;
                    }
                }

                if (revenues + Tresorerie > 0)
                {
                    m_LastUpdate = DateTime.Now;
                    //On paye les salaires et prend les taxes une fois qu'on sait que tout est equilibre.
                    for (int i = 0; i < Citoyens.Count; i++)
                    {
                        if (Citoyens[i].Salaire > 0)
                        {
                            Citoyens[i].SalaireTresorerie += Citoyens[i].Salaire;
                            Tresorerie -= Citoyens[i].Salaire;
                        }
                        if (Citoyens[i].TaxeTresorerie >= Citoyens[i].Taxe)
                        {
                            Tresorerie += Citoyens[i].Taxe;
                            Citoyens[i].TaxeTresorerie -= Citoyens[i].Taxe;
                            Citoyens[i].TaxePayer       = true;
                        }
                        else
                        {
                            Citoyens[i].TaxePayer = false;
                        }
                        if (Citoyens[i].DimeTresorerie >= Citoyens[i].Dime)
                        {
                            TresorerieReligion         += Citoyens[i].Dime;
                            Citoyens[i].DimeTresorerie -= Citoyens[i].Dime;
                            Citoyens[i].DimePayer       = true;
                        }
                        else
                        {
                            Citoyens[i].DimePayer = false;
                        }
                    }
                    return(true);
                }
                else
                {
                    //from.SendMessage("Les couts sont plus grands que vos revenues, balancez le tout pour la mise a jour de la geopolitique !");
                    return(false);
                }
            }
            return(false);
        }