Пример #1
0
        public bool CompareEntity(EntityObject otherEntity)
        {
            bool retVal = true;
            foreach (string propName in _usedProperties)
            {
                EntityObjectProperty leftProp = _entity.Properties[propName];
                EntityObjectProperty rightProp = otherEntity.Properties[propName];
                object leftValue = leftProp != null ? leftProp.Value : null;
                object rightValue = rightProp.Value != null ? rightProp.Value : null;
                if (leftValue != null && rightValue != null)
                {
                    if (!leftValue.Equals(rightValue))
                    {
                        Trace.WriteLine(String.Format("Entity {0}[{1}:{2}] != {3}[{1}:{4}]",_entity.MetaClassName, propName, leftProp.Value, otherEntity.MetaClassName, rightProp.Value));
                        retVal = false;
                        break;
                    }
                }
                else if (leftValue != rightValue)
                {
                    Trace.WriteLine(String.Format("Entity {0}[{1}:{2}] != {3}[{1}:{4}]", _entity.MetaClassName, propName, leftProp.Value, otherEntity.MetaClassName, rightProp.Value));
                    retVal = false;
                    break;
                }
            }

            return retVal;
        }
Пример #2
0
        protected override void CopyEntityObjectToMetaObject(EntityObject target, Mediachase.Ibn.Data.Meta.MetaObject metaObject)
        {
            base.CopyEntityObjectToMetaObject(target, metaObject);

            if (metaObject.GetMetaType().Name == AddressEntity.GetAssignedMetaClassName())
                AddressRequestHandler.UpdateAddressName(metaObject);
        }
Пример #3
0
        protected override void CopyEntityObjectToMetaObject(EntityObject target, Mediachase.Ibn.Data.Meta.MetaObject metaObject)
        {
            base.CopyEntityObjectToMetaObject(target, metaObject);

            // OZ 2009-06-04 Duration Fix
            TimeType timeType = (TimeType)(int)metaObject[WorkflowInstanceEntity.FieldPlanFinishTimeType];

            if (timeType == TimeType.Duration &&
                metaObject[WorkflowInstanceEntity.FieldPlanDuration] == null)
            {
                metaObject[WorkflowInstanceEntity.FieldPlanFinishTimeType] = (int)TimeType.NotSet;
                timeType = TimeType.NotSet;
            }
            else if (timeType == TimeType.DateTime &&
                metaObject[WorkflowInstanceEntity.FieldPlanFinishDate] == null)
            {
                metaObject[WorkflowInstanceEntity.FieldPlanFinishTimeType] = (int)TimeType.NotSet;
                timeType = TimeType.NotSet;
            }

            // Recalculate Plan Date
            if (timeType == TimeType.NotSet)
            {
                metaObject[WorkflowInstanceEntity.FieldPlanDuration] = null;
                metaObject[WorkflowInstanceEntity.FieldPlanFinishDate] = null;
            }
            else if (timeType == TimeType.Duration)
            {
                DateTime? actualStartDate = (DateTime?)metaObject[WorkflowInstanceEntity.FieldActualStartDate];
                int duration = (int)metaObject[WorkflowInstanceEntity.FieldPlanDuration];

                if (actualStartDate.HasValue)
                {
                    metaObject[WorkflowInstanceEntity.FieldPlanFinishDate] = actualStartDate.Value.AddMinutes(duration);
                }
                else
                {
                    metaObject[WorkflowInstanceEntity.FieldPlanFinishDate] = null;
                }
            }
            else if (timeType == TimeType.DateTime)
            {
                DateTime? actualStartDate = (DateTime?)metaObject[WorkflowInstanceEntity.FieldActualStartDate];
                DateTime planFinishDate = (DateTime)metaObject[WorkflowInstanceEntity.FieldPlanFinishDate];

                if (actualStartDate.HasValue)
                {
                    metaObject[WorkflowInstanceEntity.FieldPlanDuration] = (int)(planFinishDate - actualStartDate.Value).TotalMinutes;
                }
                else
                {
                    metaObject[WorkflowInstanceEntity.FieldPlanDuration] = null;
                }
            }
            //
        }
Пример #4
0
        private EntityComparer CreateEntityComparer(EntityObject entity)
        {
            EntityComparer retVal = null;
            string[] usedProp;
            if (_entityUsedPropMap.TryGetValue(entity.MetaClassName, out usedProp))
            {
                retVal = new EntityComparer(entity, usedProp);
            }

            return retVal;
        }
Пример #5
0
        /// <summary>
        /// Gets the auto complete comment.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public static string GetAutoCompleteComment(EntityObject entity)
        {
            if (entity == null)
                throw new ArgumentNullException("entity");

            string retVal = GetValue(entity, AssignmentAutoCompleteCommentName) as string;

            if (retVal == null)
                return string.Empty;

            return retVal;
        }
Пример #6
0
        /// <summary>
        /// Gets the auto complete comment.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public static bool GetOwnerReadOnly(EntityObject entity)
        {
            if (entity == null)
                throw new ArgumentNullException("entity");

            bool? retVal = GetValue(entity, OwnerReadOnly) as bool?;

            if (!retVal.HasValue)
                return false;

            return retVal.Value;
        }
Пример #7
0
        /// <summary>
        /// Gets the assignment overdue action.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public static AssignmentOverdueAction GetAssignmentOverdueAction(EntityObject entity)
        {
            if (entity == null)
                throw new ArgumentNullException("entity");

            int? retVal = GetValue(entity, AssignmentOverdueActionName) as int?;

            if (!retVal.HasValue)
                return AssignmentOverdueAction.NoAction;

            return (AssignmentOverdueAction)retVal.Value;
        }
 public override void Run(RoleBase caster, Space space, MagicArgs args)
 {
     double distance = GlobalMethod.GetDistance(args.Position, args.Destination);
     double speed = 2;
     caster.LinearShuttle(args.Destination, distance * speed);
     int count = 0;
     EventHandler timerHandler = null;
     DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(100) };
     timer.Tick += timerHandler = delegate {
         caster.Target = null;
         if (count == args.Number || caster.Action != Actions.Attack) {
             timer.Tick -= timerHandler;
             timer.Stop();
         } else {
             WriteableBitmap writeableBitmap = new WriteableBitmap((int)caster.OverallSize.X, (int)caster.OverallSize.Y);
             writeableBitmap.Render(caster.EquipEntity(EquipTypes.Overall), null);
             writeableBitmap.Invalidate();
             EntityObject chasingShadow = new EntityObject() {
                 RenderTransform = caster.RenderTransform,
                 ImageSource = writeableBitmap,
                 Center = caster.Center,
                 Position = caster.Position,
                 Z = caster.Z - 20
             };
             space.Children.Add(chasingShadow);
             Storyboard storyboard = new Storyboard();
             storyboard.Children.Add(GlobalMethod.CreateDoubleAnimation(chasingShadow,"Opacity",0.9,0,TimeSpan.FromMilliseconds(caster.HeartInterval * 3),null));
             EventHandler handler = null;
             storyboard.Completed += handler = delegate {
                 storyboard.Completed -= handler;
                 storyboard.Stop();
                 space.Children.Remove(chasingShadow);
             };
             storyboard.Begin();
             //每200毫秒伤害一次
             if (count % 2 == 0) {
                 for (int i = space.AllRoles().Count - 1; i >= 0; i--) {
                     RoleBase target = space.AllRoles()[i];
                     if (caster.IsHostileTo(target) && target.InCircle(caster.Position, args.Radius * args.Scale)) {
                         caster.CastingToEffect(target, args);
                     }
                 }
             }
             count++;
         }
     };
     timer.Start();
 }
Пример #9
0
        /// <summary>
        /// Evals the specified source.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="elements">The elements.</param>
        /// <returns></returns>
        public static bool Eval(EntityObject source, FilterElement[] elements)
        {
            if (source == null)
                throw new ArgumentNullException("source");

            if (elements == null)
                return true;

            foreach (FilterElement element in elements)
            {
                if (!Eval(source, element))
                    return false;
            }

            return true;
        }
Пример #10
0
        /// <summary>
        /// Gets the value.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public static object GetValue(EntityObject entity, string key)
        {
            if (entity == null)
                throw new ArgumentNullException("entity");
            if (key == null)
                throw new ArgumentNullException("key");

            if (entity.Properties.Contains(WorkflowInstanceEntity.FieldXSParameters))
            {
                AttributeCollection attr = McXmlSerializer.GetObject<AttributeCollection>((string)entity[WorkflowInstanceEntity.FieldXSParameters]);

                if (attr != null)
                {
                    return attr.GetValue(key);
                }
            }

            return AssignmentOverdueAction.NoAction;
        }
Пример #11
0
 private void initiaTreeItem(EntityObject entity)
 {
     if (entity == null) return;
                 
     Type type = entity.GetType();
     PropertyInfo[] infos = type.GetProperties();
     for (int i = 0; i < infos.Count(); i++)
     {
         PropertyInfo pinfo = infos[i];
         if (pinfo.GetValue(entity, null) != null)
         {
             string strPinfoValue = pinfo.GetValue(entity, null).ToString();
             TreeViewItem item = new TreeViewItem();
             item.DataContext = "itemValue:"+strPinfoValue;
             item.Header = strPinfoValue;
             lookUpTree.Items.Add(item);
         }
     }
 }
        protected override void CopyEntityObjectToMetaObject(EntityObject target, MetaObject metaObject)
        {
            // Base Copy
            base.CopyEntityObjectToMetaObject(target, metaObject);

            // Process not updatable field
            DocumentContentVersionEntity srcVersion = (DocumentContentVersionEntity)target;

            #region Index
            // Only if new object
            if (metaObject.ObjectState == MetaObjectState.Created)
            {
                // Calculate max index
                int maxIndex = 0;
                SqlScript selectMaxIndex = new SqlScript();

                selectMaxIndex.Append("SELECT MAX([Index]) AS [Index] FROM [dbo].[cls_DocumentContentVersion] WHERE [OwnerDocumentId] = @OwnerDocumentId");
                selectMaxIndex.AddParameter("@OwnerDocumentId", (Guid)srcVersion.OwnerDocumentId);

                using (IDataReader reader = SqlHelper.ExecuteReader(SqlContext.Current,
                    CommandType.Text, selectMaxIndex.ToString(), selectMaxIndex.Parameters.ToArray()))
                {
                    if (reader.Read())
                    {
                        object value = reader["Index"];
                        if (value is int)
                        {
                            maxIndex = (int)value;
                        }
                    }
                }

                // update index
                metaObject["Index"] = maxIndex + 1;
            }
            #endregion

            // Update State via Custom Method = UpdateState
        }
Пример #13
0
        private int CustomPageEntitySort(EntityObject x, EntityObject y)
        {
            CustomPageEntity xPage = x as CustomPageEntity;
            CustomPageEntity yPage = y as CustomPageEntity;

            // Global
            if (xPage == null && yPage==null)
                return 0;
            if (xPage == null)
                return 1;
            if (yPage == null)
                return -1;

            // User
            if (xPage.UserId == null && yPage.UserId == null)
            {
                // Profile
                if (xPage.ProfileId == null && yPage.ProfileId == null)
                {
                    // Global
                    if (xPage.Properties.Contains(LocalDiskEntityObjectPlugin.IsLoadDiskEntityPropertyName))
                        return 1;
                    if (yPage.Properties.Contains(LocalDiskEntityObjectPlugin.IsLoadDiskEntityPropertyName))
                        return -1;
                }
                if (xPage.ProfileId == null)
                    return 1;
                if (yPage.ProfileId == null)
                    return -1;
            }

            if (xPage.UserId == null)
                return 1;
            if (yPage.UserId == null)
                return -1;

            return 0;
        }
Пример #14
0
        /// <summary>
        /// Processes the items.
        /// </summary>
        /// <param name="items">The items.</param>
        /// <param name="files">The files.</param>
        private void ProcessItems(EntityObject[] items, List<FileDescriptor> files, string customizationLayer)
        {
            foreach (CustomizationItemEntity item in items)
            {
                string xml = null;
                FileDescriptor file = new FileDescriptor(this);
                file.FileNameWithoutExtension = "@";
                file.CustomizationLayer = customizationLayer;

                Dictionary<string, CustomizationItemArgumentEntity> arguments = NavigationManager.GetCustomizationItemArguments(item.PrimaryKeyId.Value);
                if (item.CommandType == (int)ItemCommandType.Add)
                {
                    xml = BuildXmlForAdd(item.XmlFullId, arguments);
                }
                else if (item.CommandType == (int)ItemCommandType.Update)
                {
                    xml = BuildXmlForUpdate(item.XmlFullId, arguments);
                }
                else if (item.CommandType == (int)ItemCommandType.Remove)
                {
                    xml = BuildXmlForRemove(item.XmlFullId);
                }

                if (!String.IsNullOrEmpty(xml))
                {
                    file.Content = new MemoryStream(Encoding.UTF8.GetBytes(xml));
                    files.Add(file);
                }
            }
        }
Пример #15
0
 public ChangeTrackingRequest(EntityObject target, string recurrenceId)
     : base(ChangeTrackingMethod.METHOD_NAME, target, recurrenceId)
 {
 }
Пример #16
0
 public CalendarDeleteRequest(EntityObject target)
     : base(RequestMethod.Delete, target)
 {
 }
Пример #17
0
 public CalendarDeleteRequest(EntityObject target, string recurrenceId)
     : base(RequestMethod.Delete, target, recurrenceId)
 {
     RecurrenceId = recurrenceId;
 }
Пример #18
0
        /// <summary>
        /// Creates the business process activity info.
        /// </summary>
        /// <param name="businessProcess">The business process.</param>
        /// <param name="scope">The scope.</param>
        /// <param name="parentActivity">The parent activity.</param>
        /// <param name="activityInfoItems">The activity info items.</param>
        private static void CreateBusinessProcessActivityInfo(BusinessProcessInfo businessProcess, WorkflowChangesScope scope, EntityObject[] assignments, CompositeActivity parentActivity, ActivityInfoCollection activityInfoItems)
        {
            foreach (Activity activity in parentActivity.Activities)
            {
                if (activity is CreateAssignmentAndWaitResultActivity)
                {
                    CreateAssignmentAndWaitResultActivity asgActivity = (CreateAssignmentAndWaitResultActivity)activity;
                    PropertyValueCollection properties = asgActivity.AssignmentProperties;

                    ActivityInfo activityInfo = new ActivityInfo();
                    activityInfoItems.Add(activityInfo);

                    activityInfo.Name = activity.Name;
                    activityInfo.Type = ActivityType.Assignment;

                    AssignmentEntity assignment = FindAssignmentByActivityName(assignments, activity.Name);

                    if (assignment != null)
                    {
                        activityInfo.State = (AssignmentState)assignment.State;
                        activityInfo.Subject = assignment.Subject;

                        activityInfo.TimeStatus = (AssignmentTimeStatus?)assignment.TimeStatus;

                        activityInfo.PlanStartDate = assignment.ActualStartDate;
                        activityInfo.PlanFinishDate = assignment.PlanFinishDate;

                        activityInfo.ActualStartDate = assignment.ActualStartDate;
                        activityInfo.ActualFinishDate = assignment.ActualFinishDate;
                        activityInfo.Comment = assignment.Comment;

                        activityInfo.UserId = assignment.UserId;

                        activityInfo.ClosedBy = assignment.ClosedBy;

                        activityInfo.ExecutionResult = (AssignmentExecutionResult?)assignment.ExecutionResult;
                    }
                    else
                    {
                        activityInfo.State = businessProcess.State == BusinessProcessState.Closed?
                            AssignmentState.Closed:
                            AssignmentState.Pending;

                        if (asgActivity.AssignmentProperties.Contains(AssignmentEntity.FieldSubject))
                            activityInfo.Subject = (string)asgActivity.AssignmentProperties[AssignmentEntity.FieldSubject];

                        if (asgActivity.AssignmentProperties.Contains(AssignmentEntity.FieldUserId))
                            activityInfo.UserId = (int?)asgActivity.AssignmentProperties[AssignmentEntity.FieldUserId];

                        // Resolve Plan Time
                        //if (activityInfo.State == AssignmentState.Pending &&
                        //    businessProcess.State == BusinessProcessState.Active &&
                        //    businessProcess.PlanFinishDate.HasValue)
                        //{
                        //    //CalculatePlanFinishDate(businessProcess, parentActivity, activity, activityInfo);
                        //}

                        //if (activityInfo.PlanStartDate.HasValue &&
                        //    activityInfo.PlanStartDate.Value < DateTime.Now)
                        //    activityInfo.TimeStatus = AssignmentTimeStatus.OverStart;

                        //if (activityInfo.PlanFinishDate.HasValue &&
                        //    activityInfo.PlanFinishDate.Value < DateTime.Now)
                        //    activityInfo.TimeStatus = AssignmentTimeStatus.OverDue;
                    }

                    // 2008-07-07 Added Assignment Properties
                    activityInfo.AssignmentProperties.AddRange(asgActivity.AssignmentProperties);
                    //
                }
                else if (activity is BlockActivity)
                {
                    // Create Block Info
                    ActivityInfo blockInfo = new ActivityInfo();
                    activityInfoItems.Add(blockInfo);

                    blockInfo.Name = activity.Name;
                    blockInfo.Type = ActivityType.Block;

                    blockInfo.State = businessProcess.State == BusinessProcessState.Closed ?
                            AssignmentState.Closed :
                            AssignmentState.Pending;

                    CreateBusinessProcessActivityInfo(businessProcess, scope, assignments, (BlockActivity)activity, blockInfo.Activities);

                    if (blockInfo.State == AssignmentState.Pending)
                    {
                        if (blockInfo.Activities.Count > 0)
                        {
                            foreach (ActivityInfo childActivitiInfo in blockInfo.Activities)
                            {
                                if (childActivitiInfo.State == AssignmentState.Active)
                                {
                                    blockInfo.State = AssignmentState.Active;
                                    break;
                                }
                                else if (childActivitiInfo.State == AssignmentState.Closed)
                                {
                                    blockInfo.State = AssignmentState.Closed;
                                }
                            }
                        }
                        else
                        {
                            int blockIndex = activityInfoItems.IndexOf(blockInfo);

                            if(blockIndex==0)
                                blockInfo.State = AssignmentState.Closed;
                            else
                                blockInfo.State = activityInfoItems[blockIndex-1].State==AssignmentState.Active? AssignmentState.Pending:
                                    activityInfoItems[blockIndex - 1].State;
                        }
                    }

                    if (blockInfo.Activities.Count > 0 &&
                        (blockInfo.State == AssignmentState.Active ||
                        blockInfo.State == AssignmentState.Closed))
                    {
                        blockInfo.PlanStartDate = blockInfo.Activities[0].PlanStartDate;
                        blockInfo.PlanFinishDate = blockInfo.Activities[0].PlanFinishDate;
                    }
                }
            }
        }
Пример #19
0
        //private static void CalculatePlanFinishDate(BusinessProcessInfo businessProcess, CompositeActivity parentActivity, Activity activity, ActivityInfo activityInfo)
        //{
        //    if (businessProcess.PlanFinishDate < DateTime.Now)
        //    {
        //        //activityInfo.PlanStartDate = businessProcess.PlanFinishDate;
        //        activityInfo.PlanFinishDate = businessProcess.PlanFinishDate;
        //    }
        //    else
        //    {
        //        // Find Post Assignment Count
        //        int postAssignmentCount = 0;
        //        CompositeActivity parent = parentActivity;
        //        Activity childActivity = activity;
        //        if (parent is BlockActivity)
        //        {
        //            childActivity = parent;
        //            parent = parent.Parent;
        //        }
        //        int activityIndex = parent.Activities.IndexOf(childActivity);
        //        for (int index = activityIndex + 1; index < parent.Activities.Count; index++)
        //        {
        //            if (parent.Activities[index] is CreateAssignmentAndWaitResultActivity ||
        //                (parent.Activities[index] is BlockActivity) && ((BlockActivity)parent.Activities[index]).Activities.Count > 0)
        //            {
        //                postAssignmentCount++;
        //            }
        //        }
        //        // Find Previous ActivityInfo
        //        DateTime now = businessProcess.ActualStartDate.Value;
        //        if (postAssignmentCount == 0)
        //        {
        //            activityInfo.PlanFinishDate = businessProcess.PlanFinishDate;
        //        }
        //        else
        //        {
        //            double avgDurations = (businessProcess.PlanFinishDate.Value - DateTime.Now).TotalMinutes / (postAssignmentCount);
        //            activityInfo.PlanFinishDate = DateTime.Now.AddMinutes(avgDurations);
        //        }
        //    }
        //}
        /// <summary>
        /// Finds the name of the assignment by activity.
        /// </summary>
        /// <param name="assignments">The assignments.</param>
        /// <param name="activityName">Name of the activity.</param>
        /// <returns></returns>
        private static AssignmentEntity FindAssignmentByActivityName(EntityObject[] assignments, string activityName)
        {
            foreach (AssignmentEntity assignment in assignments)
            {
                if (assignment.WorkflowActivityName == activityName)
                    return assignment;
            }

            return null;
        }
Пример #20
0
 public EntityAvatar(EntityObject owner, int avatarID)
 {
     _owner       = owner;
     _avatarTable = CfgAvatar.Instance.GetConfigTable(avatarID);
 }
Пример #21
0
        protected override void CopyEntityObjectToMetaObject(EntityObject target, Mediachase.Ibn.Data.Meta.MetaObject metaObject)
        {
            base.CopyEntityObjectToMetaObject(target, metaObject);

            AddressRequestHandler.UpdateAddressName(metaObject);
        }
Пример #22
0
 public PrimaryKeyId Create(EntityObject target)
 {
     throw new NotImplementedException();
 }
Пример #23
0
        /// <summary>
        /// 次のエフェクトを設定します。
        /// </summary>
        public void AddEntity(EntityObject effect, TimeSpan? duration = null)
        {
            if (this.prevBg == null || this.nextBg == null)
            {
                return;
            }

            // 同じエフェクトは表示しません。
            if ((!this.prevBg.Children.Any() && effect == null) ||
                ( this.prevBg.Children.Any() && effect != null &&
                 this.prevBg.Name == effect.Name))
            {
                return;
            }

            //this.nextBg.BeginAnimation(EffectObject.OpacityProperty, null);
            //this.prevBg.BeginAnimation(EffectObject.OpacityProperty, null);

            this.nextBg.Opacity = 0.0;
            this.nextBg.Name = (effect != null ? effect.Name : string.Empty);

            this.nextBg.Children.Clear();
            if (effect != null)
            {
                this.nextBg.Children.Add(effect);
            }

            StartTransition(duration);
        }
Пример #24
0
 /// <summary>   Converts the given object. </summary>
 ///
 /// <remarks>   AM Kozhevnikov, 05.02.2018. </remarks>
 ///
 /// <typeparam name="TResult">  Type of the result. </typeparam>
 /// <param name="obj">  The object. </param>
 ///
 /// <returns>   A TResult. </returns>
 public TResult Convert <TResult>(EntityObject obj) where TResult : class
 {
     ConsoleHelper.Send("Convert", $"Type={obj.GetType()}");
     return(default(TResult));
 }
Пример #25
0
 private void ProcessCollection(ControlCollection _coll, EntityObject _obj)
 {
     foreach (Control c in _coll)
     {
         ProcessControl(c, _obj);
         if (c.Controls.Count > 0)
             ProcessCollection(c.Controls, _obj);
     }
 }
Пример #26
0
        //===========================================================================

        public void EnterFrame(int frameIndex)
        {
            if (!isRunning)
            {
                return;
            }

            if (frameIndex < 0)
            {
                context.currentFrameIndex++;
            }
            else
            {
                context.currentFrameIndex = frameIndex;
            }

            EntityFactory.ClearReleasedObjects();

            for (int i = 0; i < playerList.Count; ++i)
            {
                playerList[i].EnterFrame(frameIndex);
            }


            List <uint> listDiePlayerId = new List <uint>();

            for (int i = 0; i < playerList.Count; i++)
            {
                SnakePlayer player = playerList[i];

                if (player.TryHitBound(context))
                {
                    listDiePlayerId.Add(player.Id);
                    ReleasePlayerAt(i);
                    i--;

                    continue;
                }

                if (player.TryHitEnemies(playerList))
                {
                    listDiePlayerId.Add(player.Id);
                    ReleasePlayerAt(i);
                    i--;
                    continue;
                }

                for (int j = 0; j < foodList.Count; j++)
                {
                    EntityObject food = foodList[j];
                    if (player.TryEatFood(food))
                    {
                        RemoveFoodAt(j);
                        j--;
                    }
                }
            }

            if (gameMap != null)
            {
                gameMap.EnterFrame(frameIndex);
            }

            if (onPlayerDie != null)
            {
                for (int i = 0; i < listDiePlayerId.Count; ++i)
                {
                    onPlayerDie(listDiePlayerId[i]);
                }
            }
        }
 public InternalObjectBuilder(ObjectBuilder parent, string internalObjectFieldName)
 {
     this._currentFields = new List <EntityField>();
     this._parent        = parent;
     this._entityObject  = new EntityObject(internalObjectFieldName);
 }
Пример #28
0
 public FoundationBudget(EntityObject budgetEntity) => BudgetEntity = budgetEntity;
Пример #29
0
 public void Update(EntityObject target)
 {
     throw new NotImplementedException();
 }
Пример #30
0
 /// <summary>
 /// 执行解析
 /// </summary>
 /// <param name="expression"></param>
 /// <param name="prefix">字段前缀</param>
 /// <param name="providerOption"></param>
 public SelectExpression(LambdaExpression expression, string prefix, IProviderOption providerOption) : base(providerOption)
 {
     this._sqlCmd        = new StringBuilder(100);
     this.Param          = new DynamicParameters();
     this.providerOption = providerOption;
     //当前定义的查询返回对象
     this.entity = EntityCache.QueryEntity(expression.Body.Type);
     //字段数组
     string[] fieldArr;
     //判断是不是实体类
     if (expression.Body is MemberInitExpression)
     {
         var           bingings  = ((MemberInitExpression)expression.Body).Bindings;
         List <string> fieldList = new List <string>();
         foreach (var bind in bingings)
         {
             if (bind is MemberAssignment)
             {
                 //必须存在实体类中
                 if (entity.FieldPairs.Any(x => x.Key.Equals(bind.Member.Name)))
                 {
                     var assignment = (bind as MemberAssignment);
                     //判断是列表还是不是系统函数
                     if (assignment.Expression.Type.FullName.Contains("System.Collections.Generic.List") ||
                         ExpressionExtension.IsAnyBaseEntity(assignment.Expression.Type))
                     {
                         providerOption.NavigationList.Add(new NavigationMemberAssign()
                         {
                             MemberAssign     = assignment,
                             MemberAssignName = bind.Member.Name
                         });
                     }
                     else
                     {
                         fieldList.Add(entity.FieldPairs[bind.Member.Name]);
                     }
                 }
             }
         }
         fieldArr = fieldList.ToArray();
     }
     else//匿名类(暂时不支持子导航属性查询)
     {
         if (entity.Properties.Length == 0)
         {
             fieldArr = new string[] { "field1" };
         }
         else
         {
             fieldArr = entity.Properties.Select(x => x.Name).ToArray();
         }
     }
     Visit(expression);
     if (!expression.Body.NodeType.Equals(ExpressionType.MemberAccess))
     {
         //查询指定字段
         if (base.FieldList.Any())
         {
             //开始拼接成查询字段
             for (var i = 0; i < fieldArr.Length; i++)
             {
                 if (i < base.FieldList.Count)
                 {
                     if (_sqlCmd.Length != 0)
                     {
                         _sqlCmd.Append(",");
                     }
                     _sqlCmd.Append(base.FieldList[i] + " as " + fieldArr[i]);
                     //记录隐射对象
                     providerOption.MappingList.Add(base.FieldList[i], fieldArr[i]);
                 }
             }
         }
         else
         {
             _sqlCmd.Append(base.SpliceField);
         }
     }
     else
     {
         //单个字段返回
         if (base.FieldList.Any())
         {
             _sqlCmd.Append(base.FieldList[0]);
         }
         else
         {
             _sqlCmd.Append(base.SpliceField);
         }
     }
     this.Param.AddDynamicParams(base.Param);
 }
Пример #31
0
 /// <summary>
 /// 显示追影(停止动作时不显示)
 /// </summary>
 /// <param name="role">所修饰角色</param>
 /// <param name="equipType">所参照的装备</param>
 /// <param name="color">颜色</param>
 /// <param name="coefficient">系数</param>
 public void ShowChasingShadow(RoleBase role, EquipTypes equipType, Color color, double coefficient)
 {
     if (role.Action != Actions.Stop) {
         ObjectBase equip = role.EquipEntity(equipType);
         if (!equip.IsVisible) { return; }
         WriteableBitmap writeableBitmap = new WriteableBitmap((int)role.OverallSize.X, (int)role.OverallSize.Y);
         writeableBitmap.Render(equip, null);
         writeableBitmap.Invalidate();
         Rectangle rectangle = new Rectangle() { Width = role.OverallSize.X, Height = role.OverallSize.Y, Fill = new SolidColorBrush(color) };
         rectangle.OpacityMask = new ImageBrush() { ImageSource = writeableBitmap };
         writeableBitmap = new WriteableBitmap((int)role.OverallSize.X, (int)role.OverallSize.Y);
         writeableBitmap.Render(rectangle, null);
         writeableBitmap.Invalidate();
         EntityObject chasingShadow = new EntityObject() {
             RenderTransform = role.RenderTransform,
             ImageSource = writeableBitmap,
             Center = role.Center,
             Position = role.Position,
             Z = role.Z - 20
         };
         space.Children.Add(chasingShadow);
         Storyboard storyboard = new Storyboard();
         storyboard.Children.Add(GlobalMethod.CreateDoubleAnimation(chasingShadow,"Opacity",0.7,0, TimeSpan.FromMilliseconds(role.HeartInterval * coefficient),null));
         EventHandler handler = null;
         storyboard.Completed += handler = delegate {
             storyboard.Completed -= handler;
             storyboard.Stop();
             space.Children.Remove(chasingShadow);
         };
         storyboard.Begin();
     }
 }
Пример #32
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            paused = !paused;
        }

        if (character == null || !character.isPlayer)
        {
            character = ObjectManager.playerCharacter;
        }
        else
        {
            if (character.IsMoving)
            {
                turnTimer -= Time.deltaTime;
                if (turnTimer <= 0 && !paused)
                {
                    ObjectManager.TakeTurn();
                    turnTimer = TurnDuration;
                }
            }
            else
            {
                turnTimer = 0;

                bool leftClick  = Input.GetMouseButtonDown(0);
                bool rightClick = Input.GetMouseButtonDown(1);

                if (leftClick || rightClick)
                {
                    if (interactionsMenu != null && !RectTransformUtility.RectangleContainsScreenPoint(interactionsMenu.GetComponent <RectTransform>(), Input.mousePosition))
                    {
                        ClearInteractionMenu();
                    }
                    else if (!EventSystem.current.IsPointerOverGameObject())
                    {
                        RaycastHit[] hits = Physics.RaycastAll(Camera.ScreenPointToRay(Input.mousePosition))
                                            .Where(h => {
                            EntityObject entityObject = h.transform.GetComponent <EntityObject>();
                            return(entityObject != null && entityObject.Entity.seen);
                        }).ToArray();
                        if (hits.Length > 0)
                        {
                            RaycastHit   hit          = hits[0];
                            Entity       entity       = hit.transform.GetComponent <EntityObject>().Entity;
                            Interactable interactable = entity as Interactable;
                            if (interactable == null)
                            {
                                if (leftClick)
                                {
                                    character.RequestPathToPosition(NodeGrid.GetCoordFromWorldPos(hit.point + 0.05f * hit.normal));
                                }
                            }
                            else
                            {
                                if (rightClick)
                                {
                                    DisplayInteractable(interactable);
                                }
                                else
                                {
                                    interactable.MoveTo(character);
                                }
                            }
                        }
                    }
                }

                if (Input.GetKeyDown(KeyCode.Keypad5))
                {
                    character.StopPath();
                    ObjectManager.TakeTurn();
                }

                if (Input.GetKeyDown(KeyCode.Keypad1))
                {
                    MoveTowards(Coord.Back + Coord.Left);
                }

                if (Input.GetKeyDown(KeyCode.Keypad2) || Input.GetKeyDown(KeyCode.DownArrow))
                {
                    MoveTowards(Coord.Back);
                }

                if (Input.GetKeyDown(KeyCode.Keypad3))
                {
                    MoveTowards(Coord.Back + Coord.Right);
                }

                if (Input.GetKeyDown(KeyCode.Keypad4) || Input.GetKeyDown(KeyCode.LeftArrow))
                {
                    MoveTowards(Coord.Left);
                }

                if (Input.GetKeyDown(KeyCode.Keypad6) || Input.GetKeyDown(KeyCode.RightArrow))
                {
                    MoveTowards(Coord.Right);
                }

                if (Input.GetKeyDown(KeyCode.Keypad7))
                {
                    MoveTowards(Coord.Forward + Coord.Left);
                }

                if (Input.GetKeyDown(KeyCode.Keypad8) || Input.GetKeyDown(KeyCode.UpArrow))
                {
                    MoveTowards(Coord.Forward);
                }

                if (Input.GetKeyDown(KeyCode.Keypad9))
                {
                    MoveTowards(Coord.Forward + Coord.Right);
                }
            }
        }
    }
Пример #33
0
        private void ProcessControl(Control c, EntityObject _obj)
        {
            IEditControl editControl = c as IEditControl;
            if (editControl != null)
            {
                string fieldName = editControl.FieldName;

                #region MyRegion
                string ownFieldName = fieldName;
                string aggrFieldName = String.Empty;
                string aggrClassName = String.Empty;
                MetaField ownField = null;
                MetaField aggrField = null;
                MetaClass ownClass = MetaDataWrapper.GetMetaClassByName(_obj.MetaClassName);
                if (ownFieldName.Contains("."))
                {
                    string[] mas = ownFieldName.Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries);
                    if (mas.Length > 1)
                    {
                        ownFieldName = mas[0];
                        aggrFieldName = mas[1];

                        ownField = MetaDataWrapper.GetMetaFieldByName(ownClass, ownFieldName);
                        aggrClassName = ownField.Attributes.GetValue<string>(McDataTypeAttribute.AggregationMetaClassName);
                        aggrField = MetaDataWrapper.GetMetaFieldByName(aggrClassName, aggrFieldName);
                    }
                }
                if (ownField == null)
                {
                    ownField = ownClass.Fields[ownFieldName];
                    if (ownField == null)
                        ownField = ownClass.CardOwner.Fields[ownFieldName];
                }
                #endregion

                object eValue = editControl.Value;

                bool makeChange = true;

                MetaField field = (aggrField == null) ? ownField : aggrField;
                if (!field.IsNullable && eValue == null)
                    makeChange = false;

                if (makeChange)
                {
                    if (aggrField == null)
                        _obj[ownFieldName] = eValue;
                    else
                    {
                        EntityObject aggrObj = null;
                        if (_obj[ownFieldName] != null)
                            aggrObj = (EntityObject)_obj[ownFieldName];
                        else
                            aggrObj = BusinessManager.InitializeEntity(DocumentContentVersionEntity.GetAssignedMetaClassName());
                        aggrObj[aggrFieldName] = eValue;
                    }
                }
            }
        }
Пример #34
0
        /// <summary>
        /// Renders the list entity object description.
        /// </summary>
        /// <param name="listMetaClass">The list meta class.</param>
        /// <param name="item">The item.</param>
        /// <returns></returns>
        private string RenderListEntityObjectDescription(MetaClass listMetaClass, EntityObject item)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<table cellpadding='5'>");
            foreach (string fieldName in this.CurrentProfile.FieldSet)
            {
                if (listMetaClass.Fields.Contains(fieldName))
                {
                    BaseEntityType ctrl = (BaseEntityType)GetColumn(this.Page, listMetaClass.Fields[fieldName]);
                    ctrl.DataItem = item;
                    ctrl.FieldName = fieldName;
                    ctrl.DataBind();
                    StringBuilder sb2 = new StringBuilder();
                    StringWriter tw = new StringWriter(sb2);
                    HtmlTextWriter hw = new HtmlTextWriter(tw);
                    ctrl.RenderControl(hw);

                    if (item.Properties.Contains(fieldName))
                        sb.AppendFormat("<tr><td><b>{0}:</b></td><td>{1}</td></tr>", listMetaClass.Fields[fieldName].FriendlyName,
                            sb2.ToString());
                }
            }
            sb.Append("</table>");
            //sb.Append("TODO: Description Here");

            return sb.ToString();
        }
Пример #35
0
 public ChangeTrackingRequest(EntityObject target)
     : base(ChangeTrackingMethod.METHOD_NAME, target)
 {
 }
Пример #36
0
 /// <summary>
 /// 添加影子
 /// </summary>
 /// <param name="id">序号</param>
 /// <param name="shadowType">类型</param>
 public void AddShadow(long id, ShadowTypes shadowType)
 {
     EntityObject shadow = new EntityObject() { ID = id };
     if (shadowType == ShadowTypes.Simple) { shadow.Source = GlobalMethod.GetImage("UI/Shadow.png", UriType.Project); }
     shadow.Center = new Point(shadow.Source.PixelWidth / 2, shadow.Source.PixelHeight / 2);
     shadowList.Add(shadow);
     shadowRoot.Children.Add(shadow);
 }
Пример #37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ResumeAssignmentRequest"/> class.
 /// </summary>
 /// <param name="entity">The entity.</param>
 public ResumeAssignmentRequest(EntityObject entity)
     : base(AssignmentRequestMethod.Resume, entity)
 {
 }
Пример #38
0
        private void ProcessControl(Control c, EntityObject _obj)
        {
            IEditControl editControl = c as IEditControl;

            if (editControl != null)
            {
                string fieldName = editControl.FieldName;

                #region MyRegion
                string    ownFieldName  = fieldName;
                string    aggrFieldName = String.Empty;
                string    aggrClassName = String.Empty;
                MetaField ownField      = null;
                MetaField aggrField     = null;
                MetaClass ownClass      = MetaDataWrapper.GetMetaClassByName(_obj.MetaClassName);
                if (ownFieldName.Contains("."))
                {
                    string[] mas = ownFieldName.Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries);
                    if (mas.Length > 1)
                    {
                        ownFieldName  = mas[0];
                        aggrFieldName = mas[1];

                        ownField      = MetaDataWrapper.GetMetaFieldByName(ownClass, ownFieldName);
                        aggrClassName = ownField.Attributes.GetValue <string>(McDataTypeAttribute.AggregationMetaClassName);
                        aggrField     = MetaDataWrapper.GetMetaFieldByName(aggrClassName, aggrFieldName);
                    }
                }
                if (ownField == null)
                {
                    ownField = ownClass.Fields[ownFieldName];
                    if (ownField == null)
                    {
                        ownField = ownClass.CardOwner.Fields[ownFieldName];
                    }
                }
                #endregion

                object eValue = editControl.Value;

                bool makeChange = true;

                MetaField field = (aggrField == null) ? ownField : aggrField;
                if (!field.IsNullable && eValue == null)
                {
                    makeChange = false;
                }

                if (makeChange)
                {
                    if (aggrField == null)
                    {
                        _obj[ownFieldName] = eValue;
                    }
                    else
                    {
                        EntityObject aggrObj = null;
                        if (_obj[ownFieldName] != null)
                        {
                            aggrObj = (EntityObject)_obj[ownFieldName];
                        }
                        else
                        {
                            aggrObj = BusinessManager.InitializeEntity(aggrClassName);
                        }
                        aggrObj[aggrFieldName] = eValue;
                    }
                }
            }

            //BaseServiceEditControl bsc = c as BaseServiceEditControl;
            //if (bsc != null)
            //{
            //    bsc.Save(_obj);
            //}
        }