Exemple #1
0
 private void Awake()
 {
     if (settings == null)
     {
         Debug.LogError("please assign a setting object to Electrum before initializing it.");
     }
     if (actionSet == null)
     {
         actionSet = settings.actionSet;
     }
     if (actionSet == null || actionSet.actions.Count == 0)
     {
         Debug.LogWarning("Action set has no action or is not assigned");
     }
     if (singleton == null)
     {
         singleton                   = this;
         affinityTreshold            = settings.affinityTreshold;
         MaxBindingCandidatesWarning = settings.MaxBindingsCandidateWarning;
         MaxBindingCandidatesAbort   = settings.MaxBindingsCandidatesAbort;
         DoNothingAction             = settings.DoNothingAction;
         cast = settings.cast;
     }
     else
     {
         Debug.LogError("Two instances of Electrum currently instancied");
         Destroy(this);
     }
     foreach (var character in cast)
     {
         character.ConstructownModel();
     }
 }
Exemple #2
0
        public void SaveMoney()
        {
            try
            {
                using (SqlConnection con = new SqlConnection(Properties.Settings.Default.DBConnection))
                {
                    string sql = "INSERT INTO tblMoney(Platinum, Gold, Electrum, Silver, Copper) ";
                    sql += "VALUES (" + Platinum.ToString() + ", " + Gold.ToString() + ", " + Electrum.ToString() + ", " + Silver.ToString() + ", " + Copper.ToString() + ")";

                    SqlCommand cmd = new SqlCommand(sql, con);
                    con.Close();
                    cmd.Connection.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();
                }
            }
            catch
            {
            }
        }