Пример #1
0
 public static bool IsTheSame(ActionData a , ActionData b)
 {
     return a.gameObjectsNames == b.gameObjectsNames
       && a.gameObjects == b.gameObjects
       && a.strings == b.strings
       && a.strings == b.strings;
 }
Пример #2
0
 public override void Process(ActionData actionData)
 {
     var priceTag = actionData.GetAsString("PriceTag");
     var departmentName = actionData.GetAsString("DepartmentName");
     _departmentService.UpdatePriceTag(departmentName, priceTag);
     _methodQueue.Queue("ResetCache", () => Helper.ResetCache(_triggerService, _applicationState));
 }
Пример #3
0
 public override void Process(ActionData actionData)
 {
     var entityId = actionData.GetDataValueAsInt("EntityId");
     var entityName = actionData.GetAsString("EntityName");
     var fieldName = actionData.GetAsString("FieldName");
     var value = actionData.GetAsString("FieldValue");
     if (entityId > 0)
     {
         _entityServiceClient.UpdateEntityData(entityId, fieldName, value);
     }
     else if (!string.IsNullOrEmpty(entityName))
     {
         var entityTypeName = actionData.GetAsString("EntityTypeName");
         var entityType = _cacheService.GetEntityTypeByName(entityTypeName);
         if (entityType != null)
         {
             _entityServiceClient.UpdateEntityData(entityType, entityName, fieldName, value);
         }
     }
     else
     {
         var ticket = actionData.GetDataValue<Ticket>("Ticket");
         if (ticket != null)
         {
             var entityTypeName = actionData.GetAsString("EntityTypeName");
             foreach (var ticketEntity in ticket.TicketEntities)
             {
                 var entityType = _cacheService.GetEntityTypeById(ticketEntity.EntityTypeId);
                 if (string.IsNullOrEmpty(entityTypeName.Trim()) || entityType.Name == entityTypeName)
                     _entityServiceClient.UpdateEntityData(ticketEntity.EntityId, fieldName, value);
             }
         }
     }
 }
Пример #4
0
 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     var orderTagName = actionData.GetAsString("OrderTagName");
     if (ticket != null && !string.IsNullOrEmpty(orderTagName))
     {
         var orderTagValue = actionData.GetAsString("OrderTagValue");
         if (ticket.Orders.Any(y => y.OrderTagExists(z => z.TagName == orderTagName && z.TagValue == orderTagValue)))
         {
             var tid = ticket.Id;
             EventServiceFactory.EventService.PublishEvent(EventTopicNames.CloseTicketRequested, true);
             ticket = _ticketService.OpenTicket(tid);
             var orders = ticket.Orders.Where(y => y.OrderTagExists(z => z.TagName == orderTagName && z.TagValue == orderTagValue)).ToArray();
             var commitResult = _ticketService.MoveOrders(ticket, orders, 0);
             if (string.IsNullOrEmpty(commitResult.ErrorMessage) && commitResult.TicketId > 0)
             {
                 ExtensionMethods.PublishIdEvent(commitResult.TicketId, EventTopicNames.DisplayTicket);
             }
             else
             {
                 ExtensionMethods.PublishIdEvent(tid, EventTopicNames.DisplayTicket);
             }
         }
     }
 }
Пример #5
0
 public override void Process(ActionData actionData)
 {
     var entityTypeName = actionData.GetAsString("EntityTypeName");
     var entityName = actionData.GetAsString("EntityName");
     var createAccount = actionData.GetAsBoolean("CreateAccount");
     var customData = actionData.GetAsString("CustomData");
     if (!string.IsNullOrEmpty(entityTypeName) && !string.IsNullOrEmpty(entityName))
     {
         var entityType = _cacheService.GetEntityTypeByName(entityTypeName);
         var entity = _entityService.CreateEntity(entityType.Id, entityName);
         if (customData.Contains(":"))
         {
             foreach (var parts in customData.Split('#').Select(data => data.Split('=')))
                 entity.SetCustomData(parts[0], parts[1]);
         }
         if (createAccount)
         {
             var accountName = entityType.GenerateAccountName(entity);
             var accountId = _accountService.CreateAccount(entityType.AccountTypeId, accountName);
             entity.AccountId = accountId;
             actionData.DataObject.AccountName = accountName;
         }
         _entityService.SaveEntity(entity);
         actionData.DataObject.EntityName = entity.Name;
     }
 }
Пример #6
0
        public override void Process(ActionData actionData)
        {
            var fileName = actionData.GetAsString("FileName");
            var arguments = actionData.GetAsString("Arguments");
            if (!string.IsNullOrEmpty(fileName))
            {
                var psi = new ProcessStartInfo(fileName, arguments);
                var isHidden = actionData.GetAsBoolean("IsHidden");
                if (isHidden) psi.WindowStyle = ProcessWindowStyle.Hidden;

                var useShellExecute = actionData.GetAsBoolean("UseShellExecute");
                if (useShellExecute) psi.UseShellExecute = true;

                var workingDirectory = actionData.GetAsString("WorkingDirectory");
                if (!string.IsNullOrEmpty(workingDirectory))
                    psi.WorkingDirectory = workingDirectory;
                try
                {
                    System.Diagnostics.Process.Start(psi);
                }
                catch (Exception e)
                {
                    _logService.LogError(e, string.Format("Start Process action [{0}] generated an error. See log file for details.", actionData.Action.Name));
                }
            }
        }
Пример #7
0
 public void NotifyEvent(string eventName, object dataParameter, int terminalId, int departmentId, int userRoleId, int ticketTypeId, Action<ActionData> dataAction)
 {
     var dataObject = dataParameter.ToDynamic();
     _settingService.ClearSettingCache();
     var rules = _cacheService.GetAppRules(eventName, terminalId, departmentId, userRoleId, ticketTypeId);
     foreach (var rule in rules.Where(x => string.IsNullOrEmpty(x.EventConstraints) || SatisfiesConditions(x, dataObject)))
     {
         if (!CanExecuteRule(rule, dataObject)) continue;
         foreach (var actionContainer in rule.Actions.OrderBy(x => x.SortOrder).Where(x => CanExecuteAction(x, dataObject)))
         {
             var container = actionContainer;
             var action = _cacheService.GetActions().Single(x => x.Id == container.AppActionId);
             var clonedAction = ObjectCloner.Clone(action);
             var containerParameterValues = container.ParameterValues ?? "";
             _settingService.ClearSettingCache();
             clonedAction.Parameter = _settingService.ReplaceSettingValues(clonedAction.Parameter);
             containerParameterValues = _settingService.ReplaceSettingValues(containerParameterValues);
             containerParameterValues = ReplaceParameterValues(containerParameterValues, dataObject);
             clonedAction.Parameter = _expressionService.ReplaceExpressionValues(clonedAction.Parameter, dataObject);
             containerParameterValues = _expressionService.ReplaceExpressionValues(containerParameterValues, dataObject);
             var data = new ActionData { Action = clonedAction, DataObject = dataObject, ParameterValues = containerParameterValues };
             dataAction.Invoke(data);
         }
     }
 }
Пример #8
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue<Ticket>("Ticket");
            var orders = Helper.GetOrders(actionData, ticket);
            if (orders.Any())
            {
                var tagName = actionData.GetAsString("OrderTagName");
                var orderTag = _cacheService.GetOrderTagGroupByName(tagName);

                if (orderTag != null)
                {
                    var tagValue = actionData.GetAsString("OrderTagValue");
                    var oldTagValue = actionData.GetAsString("OldOrderTagValue");
                    var tagNote = actionData.GetAsString("OrderTagNote");
                    var orderTagValue = orderTag.OrderTags.SingleOrDefault(y => y.Name == tagValue);

                    if (orderTagValue != null)
                    {
                        if (!string.IsNullOrEmpty(actionData.GetAsString("OrderTagPrice")))
                        {
                            var price = actionData.GetAsDecimal("OrderTagPrice");
                            orderTagValue.Price = price;
                        }

                        if (!string.IsNullOrEmpty(oldTagValue))
                            orders = orders.Where(o => o.OrderTagExists(y => y.OrderTagGroupId == orderTag.Id && y.TagValue == oldTagValue)).ToList();
                        if (actionData.Action.ActionType == ActionNames.TagOrder)
                            _ticketService.TagOrders(ticket, orders, orderTag, orderTagValue, tagNote);
                        if (actionData.Action.ActionType == ActionNames.UntagOrder)
                            _ticketService.UntagOrders(ticket, orders, orderTag, orderTagValue);
                    }
                }
            }
        }
Пример #9
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue<Ticket>("Ticket");
            var orders = Helper.GetOrders(actionData, ticket);
            if (orders.Any())
            {
                foreach (var order in orders)
                {
                    if (!string.IsNullOrEmpty(actionData.GetAsString("Quantity")))
                        order.Quantity = actionData.GetAsDecimal("Quantity");
                    if (!string.IsNullOrEmpty(actionData.GetAsString("Price")))
                        order.UpdatePrice(actionData.GetAsDecimal("Price"), "");
                    if (!string.IsNullOrEmpty(actionData.GetAsString("IncreaseInventory")))
                        order.IncreaseInventory = actionData.GetAsBoolean("IncreaseInventory");
                    if (!string.IsNullOrEmpty(actionData.GetAsString("DecreaseInventory")))
                        order.DecreaseInventory = actionData.GetAsBoolean("DecreaseInventory");
                    if (!string.IsNullOrEmpty(actionData.GetAsString("Locked")))
                        order.Locked = actionData.GetAsBoolean("Locked");
                    if (!string.IsNullOrEmpty(actionData.GetAsString("CalculatePrice")))
                        order.CalculatePrice = actionData.GetAsBoolean("CalculatePrice");
                    if (!string.IsNullOrEmpty(actionData.GetAsString("AccountTransactionType")))
                        _ticketService.ChangeOrdersAccountTransactionTypeId(ticket, new List<Order> { order },
                                                                           _cacheService.GetAccountTransactionTypeIdByName
                                                                               (actionData.GetAsString("AccountTransactionType")));

                    if (!string.IsNullOrEmpty(actionData.GetAsString("PortionName")) || !string.IsNullOrEmpty(actionData.GetAsString("PriceTag")))
                    {
                        var portionName = actionData.GetAsString("PortionName");
                        var priceTag = actionData.GetAsString("PriceTag");
                        _ticketService.UpdateOrderPrice(order, portionName, priceTag);
                    }
                }
            }
        }
Пример #10
0
        public static IList<Order> GetOrders(ActionData x, Ticket ticket)
        {
            IList<Order> orders = new List<Order>();
            var selectedOrder = x.GetDataValue<Order>("Order");

            if (selectedOrder != null && ticket != null && selectedOrder.SelectedQuantity > 0 &&
                selectedOrder.SelectedQuantity != selectedOrder.Quantity)
            {
                selectedOrder = ticket.ExtractSelectedOrder(selectedOrder);
                x.DataObject.Order = selectedOrder;
            }

            if (selectedOrder == null)
            {
                if (ticket != null)
                {
                    orders = ticket.Orders.Any(y => y.IsSelected)
                                 ? ticket.ExtractSelectedOrders().ToList()
                                 : ticket.Orders;
                    x.DataObject.Order = null;
                }
            }
            else orders.Add(selectedOrder);
            return orders;
        }
Пример #11
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue<Ticket>("Ticket");

            if (ticket != null)
            {
                var menuItemName = actionData.GetAsString("MenuItemName");
                var menuItem = _cacheService.GetMenuItem(y => y.Name == menuItemName);
                var portionName = actionData.GetAsString("PortionName");
                var quantity = actionData.GetAsDecimal("Quantity");
                var tag = actionData.GetAsString("Tag");
                var orderStateName = actionData.GetAsString("OrderStateName");
                var orderState = actionData.GetAsString("OrderState");

                var osv = orderState.Contains("=") ? orderState : orderStateName + "=" + orderState;
                var order = _ticketService.AddOrder(ticket, menuItem.Id, quantity, portionName, osv);

                if (!string.IsNullOrEmpty(actionData.GetAsString("Price")))
                    order.UpdatePrice(actionData.GetAsDecimal("Price"), "");
                if (!string.IsNullOrEmpty(actionData.GetAsString("IncreaseInventory")))
                    order.IncreaseInventory = actionData.GetAsBoolean("IncreaseInventory");
                if (!string.IsNullOrEmpty(actionData.GetAsString("DecreaseInventory")))
                    order.DecreaseInventory = actionData.GetAsBoolean("DecreaseInventory");
                if (!string.IsNullOrEmpty(actionData.GetAsString("Locked")))
                    order.Locked = actionData.GetAsBoolean("Locked");
                if (!string.IsNullOrEmpty(actionData.GetAsString("CalculatePrice")))
                    order.CalculatePrice = actionData.GetAsBoolean("CalculatePrice");

                if (order != null) order.Tag = tag;
                actionData.DataObject.Order = order;
                order.PublishEvent(EventTopicNames.OrderAdded);
            }
        }
Пример #12
0
 public override void Process(ActionData actionData)
 {
     var ticketId = actionData.GetAsInteger("TicketId");
     var ticket = _ticketService.OpenTicket(ticketId);
     actionData.DataObject.Ticket = ticket;
     ticket.PublishEvent(EventTopicNames.SetSelectedTicket);
 }
Пример #13
0
 public override void Process(ActionData actionData)
 {
     var entityId = actionData.GetDataValueAsInt("EntityId");
     var entityTypeId = actionData.GetDataValueAsInt("EntityTypeId");
     var stateName = actionData.GetAsString("EntityStateName");
     var state = actionData.GetAsString("EntityState");
     var quantityExp = actionData.GetAsString("QuantityExp");
     if (state != null)
     {
         if (entityId > 0 && entityTypeId > 0)
         {
             _entityServiceClient.UpdateEntityState(entityId, entityTypeId, stateName, state, quantityExp);
         }
         else
         {
             var ticket = actionData.GetDataValue<Ticket>("Ticket");
             if (ticket != null)
             {
                 var entityTypeName = actionData.GetAsString("EntityTypeName");
                 foreach (var ticketEntity in ticket.TicketEntities)
                 {
                     var entityType = _cacheService.GetEntityTypeById(ticketEntity.EntityTypeId);
                     if (string.IsNullOrEmpty(entityTypeName.Trim()) || entityType.Name == entityTypeName)
                         _entityServiceClient.UpdateEntityState(ticketEntity.EntityId, ticketEntity.EntityTypeId, stateName, state, quantityExp);
                 }
             }
         }
     }
 }
Пример #14
0
 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     if (ticket != null && ticket != Ticket.Empty && CanCloseTicket(ticket))
     {
         EventServiceFactory.EventService.PublishEvent(EventTopicNames.CloseTicketRequested, true);
     }
 }
Пример #15
0
 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     if (ticket != null)
     {
         CommonEventPublisher.EnqueueTicketEvent(EventTopicNames.SelectAutomationCommand);
     }
 }
Пример #16
0
 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     if (ticket != null && ticket.Orders.Count > 0)
     {
         actionData.DataObject.Order = ticket.Orders.Last();
     }
 }
Пример #17
0
 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     if (ticket != null)
     {
         ticket.RequestLock();
     }
 }
Пример #18
0
 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     if (ticket != null)
     {
         ticket.PublishEvent(EventTopicNames.DisplayTicketLog);
     }
 }
Пример #19
0
 public override void Process(ActionData actionData)
 {
     var script = actionData.GetAsString("ScriptName");
     if (!string.IsNullOrEmpty(script))
     {
         _expressionService.EvalCommand(script, "", actionData.DataObject, true);
     }
 }
Пример #20
0
 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     if (ticket != null && ticket != Ticket.Empty && _ticketService.CanSettleTicket(ticket))
     {
         ticket.PublishEvent(EventTopicNames.MakePayment);
     }
 }
Пример #21
0
 public override void Process(ActionData actionData)
 {
     var ticket = actionData.GetDataValue<Ticket>("Ticket");
     if (ticket != null)
     {
         ticket.StopActiveTimers();
     }
 }
Пример #22
0
 /// <summary>
 /// 游戏结束
 /// </summary>
 public void gameEnd()
 {
     gameBegin = false;
     beginTime = 0;
     lastUpdateViewStatus = null;
     //lastActionViewStatus = null;
     actionData = null;
 }
Пример #23
0
 /// <summary>
 /// Execute the action.
 /// </summary>
 /// <param name="obj">The object executing the action.</param>
 public override void Execute(GameObject obj, ActionData data = new ActionData())
 {
     if (moveOther) {
         obj.transform.position = pos;
     } else {
         gameObject.transform.position = pos;
     }
 }
Пример #24
0
        public SystemAction(ActionType type, ActionData actionData)
            : base(Enums.ActionTypeId.SystemAction)
        {
            _actionData = actionData;
            _type = type;

            Details.Add(type.ToString());
            Details.Add(_actionData.TargetVar); //1
        }
Пример #25
0
 public override void Process(ActionData actionData)
 {
     var screenName = actionData.GetAsString("AccountScreenName");
     var screen = _cacheService.GetAccountScreens().FirstOrDefault(x => x.Name == screenName);
     if (screen != null)
     {
         _reportServiceClient.PrintAccountScreen(screen);
     }
 }
Пример #26
0
 public ActionData(ActionData actionData)
 {
     this.type = actionData.type;
     this.damage = actionData.damage;
     this.executeTime = actionData.executeTime;
     this.actionTime = actionData.actionTime;
     this.isFromPlayer = actionData.isFromPlayer;
     this.typeChosen = actionData.typeChosen;
 }
Пример #27
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue<Ticket>("Ticket");
            if ((ticket == null || ticket == Ticket.Empty) && actionData.GetAsBoolean("CanCreateTicket") && !_applicationState.IsLocked)
            {
                ticket = _ticketService.OpenTicket(0);
                actionData.DataObject.Ticket = ticket;
                ticket.PublishEvent(EventTopicNames.SetSelectedTicket);
            }

            if (ticket != null)
            {
                var entityTypeName = actionData.GetAsString("EntityTypeName");
                var entityName = actionData.GetAsString("EntityName");
                var customDataSearchValue = actionData.GetAsString("EntitySearchValue");
                var entityType = _cacheService.GetEntityTypeByName(entityTypeName);
                if (entityType != null)
                {
                    if (string.IsNullOrEmpty(entityName) && string.IsNullOrEmpty(customDataSearchValue))
                    {
                        CommonEventPublisher.PublishEntityOperation(Entity.GetNullEntity(entityType.Id), EventTopicNames.SelectEntity, EventTopicNames.EntitySelected);
                        return;
                    }

                    Entity entity = null;
                    if (!string.IsNullOrEmpty(customDataSearchValue))
                    {

                        var entities = _entityService.SearchEntities(entityType,
                                                                    customDataSearchValue,
                                                                    null);
                        if (entities.Count == 1)
                        {
                            entity = entities.First();
                        }
                    }

                    if (entity == null)
                    {
                        entity = _cacheService.GetEntityByName(entityTypeName, entityName);
                    }

                    if (entity == null && string.IsNullOrEmpty(entityName) && string.IsNullOrEmpty(customDataSearchValue))
                    {
                        entity = Entity.GetNullEntity(entityType.Id);
                    }

                    if (entity != null)
                    {
                        _ticketService.UpdateEntity(ticket, entity);
                        actionData.DataObject.EntityName = entity.Name;
                        actionData.DataObject.EntityId = entity.Id;
                        actionData.DataObject.CustomData = entity.CustomData;
                    }
                }
            }
        }
Пример #28
0
 protected static List<CASAGSAvailabilityFlags> GetSettings(ActionData data)
 {
     SeasonSettings.ActionDataSetting settings = Retuner.SeasonSettings.GetSettings(data, false);
     if (settings != null)
     {
         List<CASAGSAvailabilityFlags> result;
         if (settings.GetTargetAgeSpecies(out result)) return result;
     }
     return Retuner.AgeSpeciesToList(data.TargetAgeSpeciesAllowed);
 }
Пример #29
0
        public MessageAction(ActionType type, ActionData actionData)
            : base(Enums.ActionTypeId.MessageBox)
        {
            _actionData = actionData;
            _type = type;

            Details.Add(type.ToString());
            Details.Add(_actionData.Message); //1
            Details.Add(_actionData.TimeOut); //2
        }
Пример #30
0
        public LabelAction(ActionType type, ActionData actionData)
            : base(Enums.ActionTypeId.Lable)
        {
            _actionData = actionData;
            _type = type;

            Details.Add(type.ToString());
            Details.Add(_actionData.LableName);
            Details.Add(_actionData.Loops);
        }
 // standardized what happens on confirm action
 public ActionResult Received(String actionGuid)
 {
     using (var e = new EntityContext())
     {
         var data      = ActionData.GetAction <DataModel>(Guid.Parse(actionGuid), e);
         var model     = data.Item1;
         var actionRow = data.Item2;
         if (model == null || actionRow == null || actionRow.Investigator_Name == null)
         {
             return(View(ResetPasswordErrorView));
         }
         model.Guid = actionGuid;
         //e.Web_Action_Data.Remove(actionRow);
         //e.SaveChanges();
         return(View(ReceivedView, model));
     }
 }
Пример #32
0
 public FsmState(FsmState source)
 {
     fsm          = source.Fsm;
     name         = source.Name;
     description  = source.description;
     colorIndex   = source.colorIndex;
     position     = new Rect(source.position);
     hideUnused   = source.hideUnused;
     isBreakpoint = source.isBreakpoint;
     isSequence   = source.isSequence;
     transitions  = new FsmTransition[source.transitions.Length];
     for (int i = 0; i < source.Transitions.Length; i++)
     {
         transitions[i] = new FsmTransition(source.Transitions[i]);
     }
     actionData = source.actionData.Copy();
 }
Пример #33
0
    // this function is called when the EnemyUnit needs to know what it's going to do
    // it evaluates its possibleActions, selects the best one, and asks it to create ActionData to store
    public void NewActionData()
    {
        if (possibleActions.Count != 0)
        {
            // get data about the board-state, possible options, etc
            if (GetImmobilizedDuration() > 0 || GetDisabledDuration() > 0)
            {
                MoveableTiles = new Dictionary <Vector2Int, Direction>();
                MoveableTiles.Add(GetMapPosition(), Direction.NO_DIR);
            }
            else
            {
                MoveableTiles = FindMoveableTiles(MapController.instance.weightedMap);
            }

            foreach (AbilityOption option in possibleAbilities)
            {
                option.EvaluateAffectableTiles();
            }

            EnemyAction bestAction          = null;
            float       highestSignificance = 0.0f;

            // for each possible action:
            foreach (EnemyAction action in possibleActions)
            {
                // evaluate its significance level
                action.Evaluate();

                // check if it currently has the highest significance
                if (action.GetSignificance() > highestSignificance)
                {
                    bestAction          = action;
                    highestSignificance = action.GetSignificance();
                }
            }

            plannedActionData = bestAction.GetActionData();

            // This useful Debug statement will print to the console the details of what this Unit committed to doing
            Debug.Log(this.GetName() + " at Starting Position " + this.GetMapPosition()
                      + " has committed to moving to " + plannedActionData.GetEndingPosition() + " and using "
                      + this.AvailableAbilities[plannedActionData.GetAbilityIndex()] + " in direction "
                      + plannedActionData.GetAbilityDirection());
        }
    }
    public void removeAction(string actionId)
    {
        ActionData fd = null;

        foreach (ActionData d in actionsData)
        {
            if (d.actionId == actionId)
            {
                fd = d;
            }
        }
        if (fd != null)
        {
            actionsData.Remove(fd);
        }
        writeDatabase();
    }
Пример #35
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue <Ticket>("Ticket");

            if (ticket != null)
            {
                var menuItemName   = actionData.GetAsString("MenuItemName");
                var menuItem       = _cacheService.GetMenuItem(y => y.Name == menuItemName);
                var portionName    = actionData.GetAsString("PortionName");
                var quantity       = actionData.GetAsDecimal("Quantity");
                var tag            = actionData.GetAsString("Tag");
                var orderStateName = actionData.GetAsString("OrderStateName");
                var orderState     = actionData.GetAsString("OrderState");

                var osv   = orderState.Contains("=") ? orderState : orderStateName + "=" + orderState;
                var order = _ticketService.AddOrder(ticket, menuItem.Id, quantity, portionName, osv);

                if (!string.IsNullOrEmpty(actionData.GetAsString("Price")))
                {
                    order.UpdatePrice(actionData.GetAsDecimal("Price"), "");
                }
                if (!string.IsNullOrEmpty(actionData.GetAsString("IncreaseInventory")))
                {
                    order.IncreaseInventory = actionData.GetAsBoolean("IncreaseInventory");
                }
                if (!string.IsNullOrEmpty(actionData.GetAsString("DecreaseInventory")))
                {
                    order.DecreaseInventory = actionData.GetAsBoolean("DecreaseInventory");
                }
                if (!string.IsNullOrEmpty(actionData.GetAsString("Locked")))
                {
                    order.Locked = actionData.GetAsBoolean("Locked");
                }
                if (!string.IsNullOrEmpty(actionData.GetAsString("CalculatePrice")))
                {
                    order.CalculatePrice = actionData.GetAsBoolean("CalculatePrice");
                }

                if (order != null)
                {
                    order.Tag = tag;
                }
                actionData.DataObject.Order = order;
                order.PublishEvent(EventTopicNames.OrderAdded);
            }
        }
        public override void Process(ActionData actionData)
        {
            var entityId     = actionData.GetDataValueAsInt("EntityId");
            var entityTypeId = actionData.GetDataValueAsInt("EntityTypeId");
            var stateName    = actionData.GetAsString("EntityStateName");
            var state        = actionData.GetAsString("EntityState");
            var quantityExp  = actionData.GetAsString("QuantityExp");
            var entityName   = actionData.GetAsString("EntityName");

            if (state != null)
            {
                if (!string.IsNullOrWhiteSpace(entityName))
                {
                    if (entityTypeId == 0)
                    {
                        var entityTypeName = actionData.GetAsString("EntityTypeName");
                        var entityType     = _cacheService.GetEntityTypeByName(entityTypeName);
                        if (entityType != null)
                        {
                            entityTypeId = entityType.Id;
                        }
                    }
                    _entityServiceClient.UpdateEntityState(entityName, entityTypeId, stateName, state, quantityExp);
                }
                else if (entityId > 0 && entityTypeId > 0)
                {
                    _entityServiceClient.UpdateEntityState(entityId, entityTypeId, stateName, state, quantityExp);
                }
                else
                {
                    var ticket = actionData.GetDataValue <Ticket>("Ticket");
                    if (ticket != null)
                    {
                        var entityTypeName = actionData.GetAsString("EntityTypeName");
                        foreach (var ticketEntity in ticket.TicketEntities)
                        {
                            var entityType = _cacheService.GetEntityTypeById(ticketEntity.EntityTypeId);
                            if (string.IsNullOrEmpty(entityTypeName.Trim()) || entityType.Name == entityTypeName)
                            {
                                _entityServiceClient.UpdateEntityState(ticketEntity.EntityId, ticketEntity.EntityTypeId, stateName, state, quantityExp);
                            }
                        }
                    }
                }
            }
        }
Пример #37
0
            public async sealed override Task ActionOff(ActionData action, SocketReaction reaction)
            {
                var tally = (await action.GetTallyData(reaction.UserId)).Select(x => GetEmote(x)).ToArray();

                if (tally.Length == 0)
                {
                    Console.WriteLine("What th e f uck"); // Pretty sure this is also invalid
                    return;
                }
                if (tally.Contains(reaction.Emote))
                {
                    await Task.WhenAll(
                        ToggleOff(tally, reaction.Channel, reaction.Message.IsSpecified ? reaction.Message.Value : (IUserMessage)(await reaction.Channel.GetMessageAsync(reaction.MessageId)), reaction.UserId, reaction.Emote),
                        action.RemoveTally(reaction.UserId, reaction.Emote.ToString() ?? throw new ArgumentNullException("Reaction emote has null name and it hurts the soul."))
                        );
                } // Seraphina removed the reaction otherwise so it's all good?
            }
Пример #38
0
 private void ActionProcess(ActionData aData)
 {
     while (aData != null)
     {
         ActionData NextData = aData.NextData;
         if (aData.Type == E_ActionType.AT_Skill)
         {
             int SkillId = aData.HurtValue;
             PlaySkillAction(aData.SrcNode, SkillId, aData);
         }
         else
         {
             ActionListController.Instance.PlayNodeAction(aData.SrcNode, aData);
         }
         aData = NextData;
     }
 }
        private void RecvData(byte[] receiveData)
        {
            disconnected = false;

            string recvStr = Encoding.UTF8.GetString(receiveData);

            recvStr = recvStr.TrimEnd('\0');
            if (string.IsNullOrEmpty(recvStr))
            {
                return;
            }
            textBoxReceive.AppendText($"{recvStr}\r\n");

            Dictionary <string, object> dataRecvDic = JsonUtils.Instance.JsonToDictionary(recvStr) as Dictionary <string, object>;

            if (dataRecvDic != null && dataRecvDic.ContainsKey("action"))
            {
                if (dataRecvDic != null && dataRecvDic.ContainsKey("action"))
                {
                    string action = dataRecvDic["action"].ToString();

                    IEnumerable <WebSocketProtocolData> protocols = WebSocketManager.Instance.ProtocolDatas.Where(data => { return(data.Protocol == action); });
                    WebSocketProtocolData protocol = protocols.FirstOrDefault();
                    if (protocols != null)
                    {
                        // 获取当前程序集
                        Assembly assembly = Assembly.GetExecutingAssembly();
                        //dynamic obj = assembly.CreateInstance("类的完全限定名(即包括命名空间)");
                        dynamic obj = assembly.CreateInstance($"SoftLiu_VSMainMenuTools.SocketClient.WebSocketData.Data.{protocol.Type}");
                        if (obj is ActionData)
                        {
                            ActionData data = obj as ActionData;
                            data.Init(recvStr);
                        }
                        else
                        {
                            Console.WriteLine($"WebSocketProtocolData CreateInstance is null, action: {action}, type: {protocol.Type}");
                        }
                    }
                    else
                    {
                        Console.WriteLine($"WebSocketProtocolData is null, action: {action}");
                    }
                }
            }
        }
Пример #40
0
    private void DoRemainingAction(INode aNode)
    {
        if (ActionList.ContainsKey(aNode))
        {
            ActionData aData = ActionList[aNode];
            ActionProcess(aData);
            ActionList.Remove(aNode);
        }

        /*map<INode*, ActionData*>::iterator itor = ActionList.find(aNode);
         * if (itor == ActionList.end()) return;
         * ActionData* aData = itor->second;
         * if (_CurItor == itor)
         *  _CurItor++;
         * ActionList.erase(itor);
         * ActionProcess(aNode, aData);*/
    }
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue <Ticket>("Ticket");

            if (ticket != null)
            {
                var calculationTypeName = actionData.GetAsString("CalculationType");
                var calculationType     = _cacheService.GetCalculationTypeByName(calculationTypeName);
                if (calculationType != null)
                {
                    var amount = actionData.GetAsDecimal("Amount");
                    ticket.AddCalculation(calculationType, amount);
                    _ticketService.RecalculateTicket(ticket);
                    EventServiceFactory.EventService.PublishEvent(EventTopicNames.RegenerateSelectedTicket);
                }
            }
        }
Пример #42
0
            public async sealed override Task ActionOn(ActionData action, SocketReaction reaction)
            {
                var tally = (await action.GetTallyData(reaction.UserId)).Select(x => GetEmote(x)).ToArray();

                if (!await ToggleOn(tally, reaction))
                {
                    if (!((reaction.Message.IsSpecified ? reaction.Message.Value : await reaction.Channel.GetMessageAsync(reaction.MessageId)) is IUserMessage message))
                    {
                        Console.WriteLine("Can't do toggle actions on non-user messages");
                        return;
                    }
                    await message.RemoveReactionAsync(reaction.Emote, reaction.User.IsSpecified?reaction.User.Value : await reaction.Channel.GetUserAsync(reaction.UserId));

                    return;
                }
                await action.AddTally(reaction.UserId, reaction.Emote.ToString() ?? throw new ArgumentNullException("Reaction emote has null name somehow. Asshole emote."));
            }
Пример #43
0
            protected override void QueueActions()
            {
                Assert.AreEqual("Action", this.ParameterSetName, "The resolved parameter set name is incorrect.");

                foreach (string token in this.Action)
                {
                    var data = new ActionData()
                    {
                        CommandLine = null != this.Properties && 0 < this.Properties.Length ? string.Join(" ", this.Properties) : null,
                        Action      = token,
                        Weight      = 100,
                    };

                    this.QueueCount++;
                    this.Actions.Enqueue(data);
                }
            }
Пример #44
0
        public override void Process(ActionData actionData)
        {
            var ticket = actionData.GetDataValue <Ticket>("Ticket");
            var pjName = actionData.GetAsString("PrintJobName");

            if (!string.IsNullOrEmpty(pjName))
            {
                var j = _cacheService.GetPrintJobByName(pjName);
                if (j != null)
                {
                    var copies      = actionData.GetAsInteger("Copies");
                    var printTicket = actionData.GetAsBoolean("PrintTicket", true);
                    var priority    = actionData.GetAsBoolean("HighPriority");
                    if (ticket != null && printTicket)
                    {
                        var orderTagName    = actionData.GetAsString("OrderTagName");
                        var orderTagValue   = actionData.GetAsString("OrderTagValue");
                        var orderStateName  = actionData.GetAsString("OrderStateName");
                        var orderState      = actionData.GetAsString("OrderState");
                        var orderStateValue = actionData.GetAsString("OrderStateValue");

                        Expression <Func <Order, bool> > expression = ex => true;
                        if (!string.IsNullOrWhiteSpace(orderTagName))
                        {
                            expression =
                                ex => ex.OrderTagExists(y => y.TagName == orderTagName && y.TagValue == orderTagValue);
                        }
                        if (!string.IsNullOrWhiteSpace(orderStateName))
                        {
                            expression = expression.And(ex => ex.IsInState(orderStateName, orderState));
                            if (!string.IsNullOrWhiteSpace(orderStateValue))
                            {
                                expression = expression.And(ex => ex.IsAnyStateValue(orderStateValue));
                            }
                        }
                        _ticketService.UpdateTicketNumber(ticket, _applicationState.CurrentTicketType.TicketNumerator);
                        ExecuteByCopies(copies, () => _printerService.PrintTicket(ticket, j, expression.Compile(), priority));
                    }
                    else
                    {
                        ExecuteByCopies(copies, () => _printerService.ExecutePrintJob(j, priority));
                    }
                }
            }
        }
Пример #45
0
        public static List <SocialInteractionCandidate> Get(Sim actor, Sim target, ShortTermContextTypes category, LongTermRelationshipTypes group, bool isActive, ActiveTopic topic, bool isAutonomous, ref string msg)
        {
            Dictionary <LongTermRelationshipTypes, Dictionary <bool, List <string> > > dictionary;
            List <SocialInteractionCandidate> list = new List <SocialInteractionCandidate>();

            if (ActionAvailabilityData.sStcInteractions.TryGetValue(category, out dictionary))
            {
                Dictionary <bool, List <string> > dictionary2;
                List <string> list2;
                bool          flag = dictionary.TryGetValue(group, out dictionary2);
                if (!flag)
                {
                    group = LongTermRelationshipTypes.Default;
                    flag  = dictionary.TryGetValue(group, out dictionary2);
                }
                if (!flag || !dictionary2.TryGetValue(isActive, out list2))
                {
                    msg += Common.NewLine + "Get Fail 1 " + category;
                    return(list);
                }

                msg += Common.NewLine + "Get Found " + category + " " + list2.Count;

                foreach (string str in list2)
                {
                    ActionData data = ActionData.Get(str);
                    GreyedOutTooltipCallback greyedOutTooltipCallback = null;

                    InteractionTestResult result = data.Test(actor, target, isAutonomous, topic, ref greyedOutTooltipCallback);

                    msg += Common.NewLine + " " + str + " " + result;

                    if ((IUtil.IsPass(result) || (greyedOutTooltipCallback != null)) || Sims3.Gameplay.UI.PieMenu.PieMenuShowFailureReason)
                    {
                        list.Add(new SocialInteractionCandidate(str, data.GetParentMenu(actor, target), topic));
                    }
                }
            }
            else
            {
                msg += Common.NewLine + "Get Fail 2 " + category;
            }

            return(list);
        }
Пример #46
0
        public ActionResult Send(string idsStr, bool proceedIgnoredStatus, string[] ignoredStatus, bool stageOnly, bool localize = false)
        {
            int[] ids = null;
            ignoredStatus = ignoredStatus ?? Enumerable.Empty <string>().ToArray();

            ids = idsStr
                  .Split(new[] { ' ', ';', ',', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
                  .Select(int.Parse)
                  .Distinct()
                  .ToArray();

            ViewBag.IgnoredStatus = ignoredStatus;
            ViewBag.Localize      = localize;

            int    userId   = _userProvider.GetUserId();
            string userName = _userProvider.GetUserName();

            var parameters = new Dictionary <string, string>();

            if (!proceedIgnoredStatus)
            {
                parameters.Add("IgnoredStatus", string.Join(",", ignoredStatus));
            }

            if (stageOnly)
            {
                parameters.Add("skipPublishing", true.ToString());
                parameters.Add("skipLive", true.ToString());
            }

            parameters.Add("Localize", localize.ToString());

            string taskData = ActionData.Serialize(new ActionData
            {
                ActionContext = new A.ActionContext()
                {
                    ContentItemIds = ids, ContentId = 288, Parameters = parameters, UserId = userId, UserName = userName
                }
            });

            var taskKey = typeof(SendProductAction).Name;
            int taskId  = _taskService.AddTask(taskKey, taskData, userId, userName, TaskStrings.PartialSend);

            return(Json(new { taskId }));
        }
Пример #47
0
        /// <summary>
        /// Renders the combat stats and description of an action.
        /// </summary>
        /// <param name="action">The action to display.</param>
        /// <param name="data">The data corresponding to the action to display.</param>
        /// <returns>A list of string that contains the action description.</returns>
        private List <string> RenderActionDescription(IDisplayAction action, ActionData data)
        {
            int maxLength   = 30;
            int maxHeight   = 12;
            var description = new List <string>();
            var reducedStr  = action.GetDescription().GetStringAsList(maxLength - 2);

            for (int i = 0; i < reducedStr.Count(); i++)
            {
                string st = "";
                st = reducedStr.ElementAt(i);
                description.Add("║ " + st + new string(' ', maxLength - st.Count() - 2));
            }
            description.Add("║ " + new string(' ', maxLength - 2));
            string str = "";

            // Display all values that are not 0 or null in the view model
            foreach (var item in data.GetDisplayableValues())
            {
                if (item.Value != null)
                {
                    if (item.Value is IEnumerable <string> )
                    {
                        foreach (var stringVal in item.Value as IEnumerable <string> )
                        {
                            str = $"Applies {stringVal}";
                            description.Add("║ " + str + new string(' ', maxLength - str.Count() - 2));
                        }
                    }
                    else
                    {
                        str = $"{item.Key} : {item.Value}";
                        description.Add("║ " + str + new string(' ', maxLength - str.Count() - 2));
                    }
                }
            }
            int currentCount = description.Count();

            // Adds empty lines if the description count is less than the max height.
            for (int i = 0; i < maxHeight - currentCount; i++)
            {
                description.Add("║ " + new string(' ', maxLength - 2));
            }
            return(description);
        }
Пример #48
0
 public void CreateActionEffect(ActionData Data)
 {
     foreach (ActionEffectData data in Data.EffectData)
     {
         if (data == null)
         {
             continue;
         }
         if (data.AlliedText != "")
         {
             InstantiateActionEffect(AlliedActionEmitter, data.AlliedText);
         }
         if (data.EnemyText != "")
         {
             InstantiateActionEffect(EnemyActionEmitter, data.EnemyText);
         }
     }
 }
Пример #49
0
        public override void Process(ActionData actionData)
        {
            var filePath = actionData.GetAsString("FilePath");
            var text     = actionData.GetAsString("Text");

            try
            {
                if (!File.Exists(filePath))
                {
                    File.Create(filePath);
                }
                File.AppendAllText(filePath, text + Environment.NewLine);
            }
            catch (Exception e)
            {
                _logService.LogError(e);
            }
        }
Пример #50
0
        public ReadFileActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.ReadFile);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.ReadFile;
            inputData        = new ReadFileActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.ReadFile);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入本地文件路径",
                Title       = "文件路径",
                IsStretch   = true,
                BindingName = nameof(ReadFileActionInputModel.FilePath)
            });
        }
Пример #51
0
    public void SetUp(IActionGUI action)
    {
        this.gameObject.SetActive(true);
        iActionGUI = action;

        actionData = iActionGUI.ActionData;
        if (actionData == null)
        {
            Logger.LogWarningFormat("UIAction {0}: action data is null!", Category.UIAction, iActionGUI);
            return;
        }

        IconFront.SetCatalogue(actionData.Sprites, 0, NetWork: false);
        if (actionData.Backgrounds.Count > 0)
        {
            IconBackground.SetCatalogue(actionData.Backgrounds, 0, NetWork: false);
        }
    }
Пример #52
0
        public OpenURLActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.OpenURL);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.OpenURL;
            inputData        = new OpenURLActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.OpenURL);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入网页链接",
                Title       = "链接",
                IsStretch   = true,
                BindingName = nameof(OpenURLActionInputModel.URL)
            });
        }
Пример #53
0
        public AActionItem RetainAction(ActionData actionData)
        {
            if (m_ActionPoolDic.TryGetValue(actionData.Id, out IActionPool pool))
            {
                return(pool.GetAction());
            }
            else
            {
                pool = ActionPool.Creater(actionData.Id);
                if (pool != null)
                {
                    m_ActionPoolDic.Add(actionData.Id, pool);
                    return(pool.GetAction());
                }
            }

            return(null);
        }
Пример #54
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            string name = row.GetString("Name");

            if (string.IsNullOrEmpty(name))
            {
                BooterLogger.AddError("Name missing");
                return;
            }

            if (ActionData.Get(name) == null)
            {
                BooterLogger.AddError("ActionData missing: " + name);
                return;
            }

            Add(ParseKey(row), new SeasonSettings.ActionDataSetting(name, row));
        }
Пример #55
0
    public void SetActions(List <ActionData> actions)
    {
        foreach (Transform child in transform)
        {
            Destroy(child.gameObject);
        }

        for (int i = 0; i < actions.Count; i++)
        {
            Vector3        pos  = new Vector3(0, (i * _itemHeight) + _offset, 0);
            ActionListItem item = GameObject.Instantiate <ActionListItem>(_itemPrefab, Vector3.zero, Quaternion.identity, transform);
            item.transform.localPosition = pos;

            ActionData act = actions[i];
            item.SetData(act.Text, act.Time, act.Fuel, act.Resources);
            item.Selected += () => ActionSelected?.Invoke(act);
        }
    }
        public SoundPlayActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.SoundPlay);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.SoundPlay;
            inputData        = new SoundPlayActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.SoundPlay);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入音频文件路径,支持mp3、wav",
                Title       = "音频文件路径",
                IsStretch   = true,
                BindingName = nameof(SoundPlayActionInputModel.Path)
            });
        }
Пример #57
0
        public override void Process(ActionData actionData)
        {
            string asString = actionData.GetAsString("FileToRestore");

            if (!string.IsNullOrEmpty(asString))
            {
                try
                {
                    BackupItem backupItem = new BackupItem(asString);
                    this._backupHelper.RestoreBackup(backupItem.DatabaseType, DatabaseToolsSettings.Settings.DatabaseName, backupItem.FilePath, true);
                }
                catch (Exception exception1)
                {
                    Exception exception = exception1;
                    MessageBox.Show(exception.Message, "Database Backup Module", MessageBoxButton.OK, MessageBoxImage.Hand);
                }
            }
        }
Пример #58
0
        public void Play(I playerID, params Vector3Int[] pos)
        {
            var data = new ActionData()
            {
                turn = turn++, playerID = playerID, pos = pos
            };

            _Play(ref data);
            recentActions.AddLast(data);
            if (recentActions.Count > MAX_STEP)
            {
                if (recentActions.First.Value.turn == undoneActions.Last?.Value.turn)
                {
                    undoneActions.RemoveLast();
                }
                recentActions.RemoveFirst();
            }
        }
        public override void Process(ActionData actionData)
        {
            var ticketTypeName = actionData.GetAsString("TicketTypeName");
            var ticketType     = _cacheService.GetTicketTypes().SingleOrDefault(y => y.Name == ticketTypeName);

            if (ticketType != null)
            {
                _applicationState.TempTicketType = ticketType;
            }
            else if (_applicationState.SelectedEntityScreen != null && _applicationState.SelectedEntityScreen.TicketTypeId != 0)
            {
                _applicationState.TempTicketType = _cacheService.GetTicketTypeById(_applicationState.SelectedEntityScreen.TicketTypeId);
            }
            else
            {
                _applicationState.TempTicketType = _cacheService.GetTicketTypeById(_applicationState.CurrentDepartment.TicketTypeId);
            }
        }
Пример #60
0
        public SnippingActionBuilder()
        {
            actionItem       = ActionData.GetCreateActionItemModel(UI.Types.ActionType.Snipping);
            action           = new Core.Action.Models.ActionModel();
            action.Action    = Core.Action.Types.ActionType.Snipping;
            inputData        = new SnippingActionInputModel();
            inputModels      = new List <ActionInputModel>();
            actionResultKeys = ActionData.GetActionResults(UI.Types.ActionType.Snipping);

            inputModels.Add(new ActionInputModel()
            {
                InputType   = Types.InputType.Text,
                Placeholder = "请输入保存路径",
                Title       = "截图保存路径",
                IsStretch   = true,
                BindingName = nameof(SnippingActionInputModel.SavePath)
            });
        }