public void changeResources(EObjectState stateAction) { if (stateAction == EObjectState.DESTROY) { MonoBehaviour.Destroy(controller.gameObject); return; } currentState = stateAction; float timeFrame = (float)getValueFromDatabase(EAnimationDataType.TIME_FRAME); string resourcePath = getValueFromDatabase(EAnimationDataType.RESOURCE_PATH).ToString().Trim(); EventDelegate callback = null; switch (stateAction) { case EObjectState.RUN: animationFrames.createAnimation(EObjectState.RUN, "Image/Object/" + resourcePath, timeFrame, false); break; case EObjectState.EXPLOSION: animationFrames.createAnimation(EObjectState.EXPLOSION, "Image/Explosion/" + resourcePath, timeFrame, false); callback = new EventDelegate(((ObjectStateExplosion)controller.listState[EObjectState.EXPLOSION]).destroy); break; } }
/// <summary> /// 设置当前OBJECTS的状态 /// </summary> /// <param name="p_State"></param> public virtual void SetObjectState(EObjectState p_State) { foreach (_COBJECTS item in this.Parent.StrustObject.ObjectList.Values) { item.Property.SetObjectState(p_State); } }
/// <summary> /// 对象中状态为p_State1修改为p_State2 /// </summary> /// <param name="p_State1"></param> /// <param name="p_State2"></param> public override void ChangeObjectState(EObjectState p_State1, EObjectState p_State2) { if (this.Parent.ObjectState == p_State1) { this.Parent.ObjectState = p_State2; } }
/// <summary> /// 对象中状态为p_State1修改为p_State2 /// </summary> /// <param name="p_State1"></param> /// <param name="p_State2"></param> public virtual void ChangeObjectState(EObjectState p_State1, EObjectState p_State2) { foreach (_COBJECTS item in this.Parent.StrustObject.ObjectList.Values) { item.Property.ChangeObjectState(p_State1, p_State2); } }
private CartItem(int productId, int quantity, decimal displayedPrice, string cartCookie) { CartCookie = cartCookie; ProductId = productId; CurrentPrice = displayedPrice; Quantity = quantity; SelectedDateTime = DateTime.UtcNow; State = EObjectState.Added; }
private CartItem(int productId, int quantity, decimal displayedPrice, int cartId) { ProductId = productId; Quantity = quantity; CurrentPrice = displayedPrice; CartId = cartId; SelectedDateTime = DateTime.UtcNow; State = EObjectState.Added; }
/// <summary> /// 设置当前OBJECTS的状态 /// </summary> /// <param name="p_State"></param> public override void SetObjectState(EObjectState p_State) { ///设置自己的状态 this.Parent.ObjectState = p_State; foreach (_COBJECTS item in this.Parent.StrustObject.ObjectList.Values) { item.Property.SetObjectState(p_State); } }
/// <summary> /// 对象中状态为p_State1修改为p_State2 /// </summary> /// <param name="p_State1"></param> /// <param name="p_State2"></param> public override void ChangeObjectState(EObjectState p_State1, EObjectState p_State2) { if (this.Parent.ObjectState == p_State1) { this.Parent.ObjectState = p_State2; } foreach (_COBJECTS item in this.Parent.StrustObject.ObjectList.Values) { item.Property.ChangeObjectState(p_State1, p_State2); } }
public void UpdateQuantity(int newQuantity) { if (newQuantity < 0) { throw new ArgumentException("Quantity cannot be less than zero"); } if (Quantity != newQuantity) { Quantity = newQuantity; State = EObjectState.Modified; } }
public CGPhysicsObject(CGThrowableObject o, Vector3 d, float p, WorldSetter ws) { WorldSetter.ECubeArea ae = ws.GetCubeAreaEnum(o.transform.position); this.ePreviousArea = ae; this.eCurrentArea = ae; this.eTargetArea = WorldSetter.ECubeArea.NONE; this.eObjectState = EObjectState.OBJECT_LAUNCH_TRIGGER; this.throwableObject = o; this.objectRigidBody = this.throwableObject.GetComponent <Rigidbody>(); this.launchDirection = d; this.launchPower = p; this.isAreaChanged = false; }
public static EntityState ConvertState(EObjectState state) { switch (state) { case EObjectState.Added: return EntityState.Added; case EObjectState.Modified: return EntityState.Modified; case EObjectState.Deleted: return EntityState.Deleted; case EObjectState.Processed: return EntityState.Unchanged; default: return EntityState.Unchanged; } }
private EntityState ConvertState(EObjectState state) { switch (state) { case EObjectState.Added: return(EntityState.Added); case EObjectState.Modified: return(EntityState.Modified); case EObjectState.Deleted: return(EntityState.Deleted); default: return(EntityState.Unchanged); } }
ObjectState getClassObject(EObjectState type) { ObjectState s = null; switch (type) { case EObjectState.RUN: s = new ObjectStateRun(); break; case EObjectState.DESTROY: s = new ObjectStateDestroy(); break; case EObjectState.EXPLOSION: s = new ObjectStateExplosion(); break; } return(s); }
public void initalize(string id) { this.ID = id; ObjectGameData skillData = ReadDatabase.Instance.ObjectInfo[ID.ToUpper()]; foreach (string key in skillData.States.Keys) { EObjectState state = (EObjectState)Extensions.GetEnum(EObjectState.RUN.GetType(), key.ToUpper()); listState.Add(state, getClassObject(state)); } //first element var enumerator = listState.Keys.GetEnumerator(); enumerator.MoveNext(); FSM.Configure(this, listState[enumerator.Current]); stateAction = enumerator.Current; runResources(); }
/// <summary> /// Carica le proprietà standard dell'oggetto /// </summary> /// <param name="dr"></param> internal void FillObjectFromReader(IDataReader dr, bool includeAll) { Property oProp; //Loop tra proprietà for (int k = 0; k < this.mClassSchema.Properties.Count; k++) { oProp = this.mClassSchema.Properties[k]; //Salta le proprietà non incluse nel caricamento if (oProp.IsSqlSelectExcluded && !includeAll) { continue; } //Richiama il caricamento della singola proprietà oProp.SetValueFromReader(this, dr); } //Imposta stato oggetto caricato this.mDataSchema.ObjectState = EObjectState.Loaded; }
public void changeResources(EObjectState stateAction) { if(stateAction == EObjectState.DESTROY) { MonoBehaviour.Destroy(controller.gameObject); return; } currentState = stateAction; float timeFrame = (float)getValueFromDatabase(EAnimationDataType.TIME_FRAME); string resourcePath = getValueFromDatabase(EAnimationDataType.RESOURCE_PATH).ToString().Trim(); EventDelegate callback = null; switch (stateAction) { case EObjectState.RUN: animationFrames.createAnimation(EObjectState.RUN, "Image/Object/" + resourcePath, timeFrame, false); break; case EObjectState.EXPLOSION: animationFrames.createAnimation(EObjectState.EXPLOSION, "Image/Explosion/" + resourcePath, timeFrame, false); callback = new EventDelegate(((ObjectStateExplosion)controller.listState[EObjectState.EXPLOSION]).destroy); break; } }
/// <summary> /// Perform database delete /// </summary> private void performDbDelete() { //Appoggio IDataBase db = this.Slot.DbGet(this.mClassSchema); try { //Imposta QUERY db.SQL = string.Concat(@"DELETE FROM ", this.Slot.DbPrefixGetTableName(this.mClassSchema.TableDef), this.mClassSchema.PrimaryKey.SQL_Where_Clause); var oKeyValues = this.mClassSchema.PrimaryKey.FillKeyQueryWhereParams(db, this); //Esegue int ret = db.ExecQuery(); //Controlla esito per verificare situazioni anomale if (ret == 0) { //Nessuna Cancellazione throw new ObjectException(Resources.ObjectMessages.Deleted_NoRecord, this.GetType().Name, this.mClassSchema.PrimaryKey.Name, ObjectHelper.ObjectEnumerableToString(oKeyValues)); } else if (ret > 1) { //Cancellazioni Multiple throw new ObjectException(Resources.ObjectMessages.Deleted_MultipleRecords, this.GetType().Name, this.mClassSchema.PrimaryKey.Name, ObjectHelper.ObjectEnumerableToString(oKeyValues)); } //Imposta stato eliminato this.mDataSchema.ObjectState = EObjectState.Deleted; } finally { //Resetta db per evitare eventuali parametri impostati //e mai utilizzati db.Reset(); } }
/// <summary> /// Esegue la insert sul DB /// </summary> private ESaveResult performDbInsert() { //Appoggio IDataBase db = this.Slot.DbGet(this.mClassSchema); List <DbParameter> oDbParams = new List <DbParameter>(this.mClassSchema.Properties.Count); Property oProp; var sTableFullName = this.Slot.DbPrefixGetTableName(this.mClassSchema.TableDef); try { //Inserisce campi for (int iPropIndex = 0; iPropIndex < this.mClassSchema.Properties.Count; iPropIndex++) { oProp = this.mClassSchema.Properties[iPropIndex]; //In generale e' necessario impostare tutti i campi come non modificati this.mDataSchema.SetFlags(oProp.PropertyIndex, DataFlags.Changed, false); //Esclusione esplicita if (oProp.ExcludeInsert || oProp.IsAutomatic) { continue; } //Imposta campi object oValue = oProp.GetValueForDb(this); //Imposta valore oDbParams.Add(db.CreateParameter(oProp.Column.ParamName, oValue, oProp.Column.DbType)); //Aggiorna this.mDataSchema.SetFlags(oProp.PropertyIndex, DataFlags.Loaded, true); } //Imposta SQL base var sbSql = new StringBuilder(@"INSERT INTO ", this.mClassSchema.TableDef.SQL_Insert.Length + 300); sbSql.Append(sTableFullName); sbSql.Append(@" "); sbSql.Append(string.Intern(this.mClassSchema.TableDef.SQL_Insert)); //In base al tipo di esecuzione if (this.mClassSchema.MustReload) { sbSql.Append(@";"); sbSql.Append(this.mClassSchema.TableDef.SQL_Select_Reload); sbSql.Append(sTableFullName); //Se autoinc imposta solo il nome della funzione if (this.mClassSchema.AutoIncPk) { sbSql.Append(@" WHERE "); sbSql.Append(this.mClassSchema.PrimaryKey.Properties[0].Column.Name); sbSql.Append(@"="); sbSql.Append(db.LastAutoIdFunction); } else { sbSql.Append(this.mClassSchema.PrimaryKey.SQL_Where_Clause); for (int i = 0; i < this.mClassSchema.PrimaryKey.Properties.Count; i++) { oDbParams.Add(db.CreateParameter(this.mClassSchema.PrimaryKey.Properties[i].Column.GetKeyParamName(), this.mClassSchema.PrimaryKey.Properties[i].GetValueForDb(this))); } } //Risolve db.SQL = sbSql.ToString(); db.AddParameters(oDbParams); using (DbDataReader dr = db.ExecReader()) { //Controllo if (!dr.Read()) { throw new ObjectException(Resources.ObjectMessages.New_NoRecord, this.GetType().Name); } //Aggiorna proprieta' for (int i = 0; i < this.mClassSchema.AutoProperties.Count; i++) { this.mClassSchema.AutoProperties[i].SetValueFromReader(this, dr); } } } else { //Imposta db ed esegue db.SQL = sbSql.ToString(); db.AddParameters(oDbParams); //Controlla esito per verificare situazioni anomale if (db.ExecQuery() == 0) { //Nessun Inserimento throw new ObjectException(Resources.ObjectMessages.New_NoRecord, this.GetType().Name); } } //Imposta stato caricato comunque this.mDataSchema.ObjectState = EObjectState.Loaded; } finally { //Resetta db per evitare eventuali parametri impostati //e mai utilizzati db.Reset(); } return(ESaveResult.SaveDone); }
/// <summary> /// 设置当前OBJECTS的状态 /// </summary> /// <param name="p_State"></param> public override void SetObjectState(EObjectState p_State) { this.Parent.ObjectState = p_State; }