My extension methods. I hold all of my extension methods here. I made one for changing the main color of your character's skinnedMeshRenderer materials and one for changing them to flash a certain color, cyan in my case. They can flash a color or just become invisible and visible again. It signals invulnerability.
Пример #1
0
    public void DisplayAchievement(string achievement)
    {
        GameObject achievementsObject        = GameObject.Find("Achievements");
        ToastAchievementFillerScript content = achievementsObject.GetComponent <ToastAchievementFillerScript>();
        GameObject prefabValue = GameObject.Instantiate(content.prefabToInstantiate) as GameObject;

        prefabValue.GetComponentInChildren <Text>().text = achievement;
        content.AddFillerObject(prefabValue);
        MyExtensionMethods.InitAudio(ref achievementSound, StringNamesInfo.ACHIEVEMENT_SOUND);
        if (achievementSound && SettingsScript.EffectVolume > 0.01f)
        {
            achievementSound.Play();
        }
    }
        static StackObject *GetValue_3(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Vector3 @v3 = (UnityEngine.Vector3) typeof(UnityEngine.Vector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = MyExtensionMethods.GetValue(@v3);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
        static StackObject *Clear_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Text.StringBuilder @sb = (System.Text.StringBuilder) typeof(System.Text.StringBuilder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            MyExtensionMethods.Clear(@sb);

            return(__ret);
        }
Пример #4
0
 void Start()
 {
     MyExtensionMethods.InitAudio(ref shootSound, StringNamesInfo.FIRE_SOUND);
     MyExtensionMethods.InitAudio(ref deniedSound, StringNamesInfo.DENIED_SOUND);
     if (!whatToControll)
     {
         return;
     }
     #region CACHE_COMPONENTS
     controllGun   = whatToControll.GetComponent <BuildGunScript>().ControllGunSystem;
     controllShoot = whatToControll.GetComponent <BuildGunScript>().ShootSystem;
     #endregion
     Slider rotateController = GameObject.Find(StringNamesInfo.ROTATEGUNCONTROLLER_name).GetComponent <Slider>();
     rotateController.value    = 90.0f;
     rotateController.minValue = controllGun.MinAngle;
     rotateController.maxValue = controllGun.MaxAngle;
     rotateController.onValueChanged.AddListener(delegate { controllGun.RotateGun(rotateController.value); });
     StartCoroutine(LateStart());
 }
Пример #5
0
 void Start()
 {
     MyExtensionMethods.InitAudio(ref restoreAmmoSound, StringNamesInfo.AMMO_SOUND);
 }
Пример #6
0
        // BulkCopy("dbo.T_Benutzer", dt)
        public override bool BulkCopy(string tableSchema, string tableName, System.Data.DataTable dt, bool bWithDelete)
        {
            try
            {
                string sanitizedTableName = this.QuoteObjectWhereNecessary(tableName);

                // Ensure table is empty - and throw on foreign-key
                if (bWithDelete)
                {
                    this.Execute("DELETE FROM " + sanitizedTableName);
                }



                System.Collections.Generic.List <string> lsComputedColumns = GetComputedColumnNames(tableSchema, tableName);


                // http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopyoptions.aspx
                System.Data.SqlClient.SqlBulkCopyOptions bcoOptions = //System.Data.SqlClient.SqlBulkCopyOptions.CheckConstraints |
                                                                      System.Data.SqlClient.SqlBulkCopyOptions.KeepNulls |
                                                                      System.Data.SqlClient.SqlBulkCopyOptions.KeepIdentity;

                // http://stackoverflow.com/questions/6651809/sqlbulkcopy-insert-with-identity-column
                // http://msdn.microsoft.com/en-us/library/ms186335.aspx
                System.Data.SqlClient.SqlBulkCopy BulkCopyInstance = new System.Data.SqlClient.SqlBulkCopy(this.m_ConnectionString.ConnectionString, bcoOptions);
                foreach (System.Data.DataColumn dc in dt.Columns)
                {
                    // The column "foo" cannot be modified because it is either a computed column or...
                    if (MyExtensionMethods.Contains(lsComputedColumns, dc.ColumnName, System.StringComparer.InvariantCultureIgnoreCase))
                    {
                        continue;
                    }

                    BulkCopyInstance.ColumnMappings.Add(dc.ColumnName, "[" + dc.ColumnName.Replace("]", "]]") + "]");
                }
                BulkCopyInstance.DestinationTableName = sanitizedTableName;

                /*
                 * string strSQL = "INSERT INTO " + BulkCopyInstance.DestinationTableName + Environment.NewLine + "(" + Environment.NewLine;
                 *
                 *
                 * for(int i=0; i < dt.Columns.Count; ++i)
                 * {
                 *  if(i==0)
                 *      strSQL += "       [" + dt.Columns[i].ColumnName + "]" + Environment.NewLine;
                 *  else
                 *      strSQL += "      ,[" + dt.Columns[i].ColumnName + "]" + Environment.NewLine;
                 *  //BulkCopyInstance.ColumnMappings.Add(dc.ColumnName, dc.ColumnName);
                 * }
                 * strSQL += ") " + Environment.NewLine + "Values "+ Environment.NewLine + "(" + Environment.NewLine;
                 *
                 * for (int i = 0; i < dt.Columns.Count; ++i)
                 * {
                 *  if (i == 0)
                 *      strSQL += "       @parameter" + i.ToString() + Environment.NewLine;
                 *  else
                 *      strSQL += "      ,@parameter" + i.ToString() + Environment.NewLine;
                 *  //BulkCopyInstance.ColumnMappings.Add(dc.ColumnName, dc.ColumnName);
                 * }
                 *
                 * strSQL += "); ";
                 *
                 * // http://www.codeproject.com/KB/cs/MultipleInsertsIn1dbTrip.aspx#_Toc196622244
                 * System.Data.IDbCommand idbc = this.CreateCommand(strSQL);
                 *
                 * for (int i = 0; i < dt.Rows.Count; ++i)
                 * {
                 *
                 *  for (int j = 0; j < dt.Columns.Count; ++j)
                 *  {
                 *      this.AddParameter(idbc, "parameter" + j.ToString(), dt.Rows[i][j]);
                 *  }
                 *
                 *  //this.Execute(idbc);
                 *  this.ExecuteWithoutTransaction(idbc);
                 *  idbc.Parameters.Clear();
                 * }
                 *
                 * //MsgBox(strSQL);
                 */
                BulkCopyInstance.WriteToServer(dt);
                BulkCopyInstance.Close();
                BulkCopyInstance = null;
            }
            catch (System.Exception ex)
            {
                if (Log("cMS_SQL_specific.BulkCopy", ex, "BulkCopy: Copy dt to " + tableName))
                {
                    throw;
                }
                //COR.Logging.WriteLogFile("FEHLER", "Ausnahme in COR.SQL.MSSQL.BulkCopy");
                //COR.Logging.WriteLogFile("FEHLER", ex.Message);
                //COR.Logging.WriteLogFile("FEHLER", "-----------------------------------------------------------------");
                //COR.Logging.WriteLogFile("FEHLER", ex.StackTrace.ToString());
                //Console.WriteLine(ex.Message.ToString() + Environment.NewLine + ex.StackTrace.ToString()); //MsgBoxStyle.Critical, "FEHLER ...");
                //COR.Logging.WriteLogFile("MELDUNG", "-----------------------------------------------------------------");
            }

            return(false);
        } // End Function BulkCopy
Пример #7
0
 void Awake()
 {
     MyExtensionMethods.InitAudio(ref meteorSoundExplodeInAir, StringNamesInfo.METEOR_IN_AIR_EXPLOSION_SOUND);
     MyExtensionMethods.InitAudio(ref meteorSoundExplodeOnGround, StringNamesInfo.METEOR_ON_GROUND_EXPLOSION_SOUND);
     MyExtensionMethods.InitAudio(ref coinSound, StringNamesInfo.COIN_SOUND);
 }