예제 #1
0
 public void Draw(SpriteBatch sb, Vector2 vector)
 {
     if (!ifDisappear)
     {
         if (timer <= 0 || dead)
         {
             Sprite.Draw(sb, new Vector2(Position.X - vector.X, Position.Y - vector.Y));
         }
         else
         {
             if (flasher % Utility.MarioFlashSpeed == 0)
             {
                 Sprite.Draw(sb, new Vector2(Position.X - vector.X, Position.Y - vector.Y));
             }
         }
     }
     else
     {
         resetTimer++;
         if (resetTimer++ == Utility.timer_check_mario_class)
         {
             ICommand reset = new CommandReset(Mygame);
             reset.Execute();
         }
     }
 }
예제 #2
0
        public void Update()
        {
            mario.Sprite.Update();
            ICommand reset = new CommandReset(mario.Mygame);

            reset.Execute();
        }
예제 #3
0
 public void Update()
 {
     timer--;
     mario.Sprite.Update();
     Sound.Instance.StopTheme();
     if (timer == 0)
     {
         ICommand reset = new CommandReset(mario.Mygame);
         reset.Execute();
     }
 }
예제 #4
0
        public void Init()
        {
            CommandClickField = new CommandClickField(this);
            CommandReset      = new CommandReset(this);
            TTTManager        = new TTTManager();

            Coll          = TTTManager.InitCollToBlank();
            CollVisual    = TTTManager.InitCollVisualToBlank();
            currentPlayer = false;
            LastWinner    = null;
            TTTManager.SetCollVisual(Coll, CollVisual);
        }
예제 #5
0
 private void RegisterForMessages()
 {
     Messenger.Default.Register <NotificationMessage>(this, message =>
     {
         if (message.Notification == Commands.AddItem)
         {
             if (CommandAdd.CanExecute(null))
             {
                 CommandAdd.Execute(null);
             }
         }
         else if (message.Notification == Commands.EditItem)
         {
             if (CommandEdit.CanExecute(null))
             {
                 CommandEdit.Execute(null);
             }
         }
         if (message.Notification == Commands.ResetItem)
         {
             if (CommandReset.CanExecute(null))
             {
                 CommandReset.Execute(null);
             }
         }
         else if (message.Notification == Commands.DeleteItem)
         {
             if (CommandDelete.CanExecute(null))
             {
                 CommandDelete.Execute(null);
             }
         }
         else if (message.Notification == Commands.ResetAll)
         {
             if (CommandResetAll.CanExecute(null))
             {
                 CommandResetAll.Execute(null);
             }
         }
     });
     Messenger.Default.Register <NotificationMessage <ItemModel> >(this, message =>
     {
         if (message.Notification == Notifications.NotifyItemSelected)
         {
             RaisePropertyChanged("IsItemSelected");
             RaiseCanExecuteChanged(CommandEdit);
             RaiseCanExecuteChanged(CommandReset);
             RaiseCanExecuteChanged(CommandDelete);
         }
     });
 }
예제 #6
0
        /// <summary>
        /// 复位
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_Reset_Click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;

            if (Self != null)
            {
                //var carStatus = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.carStatus.ToString());
                //if (carStatus.Value != CarStatus.idle.GetIndexString())
                //{
                //    MessageBox.Show("小车状态不是空闲,不能设置!");
                //    return;
                //}
                var wcsResetCommand = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsResetCommand.ToString());
                if (wcsResetCommand != null)
                {
                    wcsResetCommand.Value = "1";
                    var temp = CommandReset?.Invoke(Self);
                    if (temp == null)
                    {
                        MessageBox.Show($"未处理{button.Content}事件");
                    }
                    else
                    {
                        if (temp.Success)
                        {
                            //MessageBox.Show("取货错误处理成功");
                        }
                        else
                        {
                            MessageBox.Show($"{button.Content}操作失败:{temp.Msg}");
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("操作失败,通信中断,请重试!");
            }
        }
예제 #7
0
        /// <summary>
        /// 赋值属性
        /// </summary>
        /// <param name="deviceEntity"></param>
        /// <param name="props"></param>
        /// <param name="address"></param>
        public void SetProps(IEnumerable <Equipment> equipments)
        {
            Self = equipments.FirstOrDefault(t => t.Code == ControlName);
            if (Self == null)
            {
                //feeder = null;
                return;
            }

            //if (Self.Code == "car1")
            //{
            //    feeder = equipments.FirstOrDefault(x => x.Code == "Feeder2");
            //}
            //else
            //{
            //    feeder = equipments.FirstOrDefault(x => x.Code == "Feeder1");
            //}

            try
            {
                #region 监控文本赋值

                var hasPallet = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.hasPallet.ToString()).Value;
                if (hasPallet != null)
                {
                    lab_hasPallet.Foreground = Brushes.Blue;
                    switch (hasPallet)
                    {
                    case "0":
                        lab_hasPallet.Content = "初始";
                        break;

                    case "1":
                        lab_hasPallet.Content = "无货";
                        break;

                    case "2":
                        lab_hasPallet.Content = "有货";
                        break;

                    default:
                        lab_hasPallet.Content    = "未获取或不识别";
                        lab_hasPallet.Foreground = Brushes.Red;
                        break;
                    }
                }

                var carNo = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.carNo.ToString()).Value;
                if (!string.IsNullOrEmpty(carNo))
                {
                    lab_carNo.Foreground = Brushes.Blue;
                    lab_carNo.Content    = carNo;
                }

                var row = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.row.ToString()).Value;
                if (row != null)
                {
                    lab_Row.Foreground = Brushes.Blue;
                    lab_Row.Content    = row;
                }
                var TaskHeaderID = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.TaskHeaderID.ToString()).Value;
                if (TaskHeaderID != null)
                {
                    lab_taskHeaderId.Foreground = Brushes.Blue;
                    lab_taskHeaderId.Content    = TaskHeaderID;
                }
                var TaskCarId = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.TaskCarId.ToString()).Value;
                if (TaskCarId != null)
                {
                    lab_taskCarId.Foreground = Brushes.Blue;
                    lab_taskCarId.Content    = TaskCarId;
                }



                //显示任务类型
                var actionType = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.actionType.ToString()).Value;
                if (this.carActionTypeList.ContainsKey(actionType))
                {
                    lab_actionType.Content = this.carActionTypeList[actionType];
                }
                //显示设备状态
                var carStatus = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.carStatus.ToString()).Value;
                if (this.carStatusList.ContainsKey(carStatus))
                {
                    lab_carStatus.Content = this.carStatusList[carStatus];
                }
                //显示控制模式
                var controlMode = Self.EquipmentProps.FirstOrDefault(t => t.EquipmentTypeTemplateCode == CarMonitorProps.controlMode.ToString()).Value;
                if (this.controlModeList.ContainsKey(controlMode))
                {
                    lab_controlMode.Content = this.controlModeList[controlMode];
                }

                //错误信息显示
                var tempProps = Self.EquipmentProps.FindAll(t => t.EquipmentTypeTemplate.IsMonitor == true);
                foreach (var item in tempProps)
                {
                    if (item.Value != item.EquipmentTypeTemplate.MonitorCompareValue)
                    {
                        AddAlarm("报警:" + item.EquipmentTypeTemplate.Name + " 信息:" + item.EquipmentTypeTemplate.MonitorFailure, 2);
                    }
                    else
                    {
                        RemoveAlarm("报警:" + item.EquipmentTypeTemplate.Name + " 信息:" + item.EquipmentTypeTemplate.MonitorFailure);
                    }
                }

                #endregion

                #region 清除WCS写入的DB块

                //清除【行列层】设置

                var wcsActionType = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsActionType.ToString());
                if (wcsActionType.Value == CarActionType.ResetLocation.GetIndexString())
                {
                    var wcsRow = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.row.ToString());
                    if (wcsRow.Value != "0")
                    {
                        var wcsSwitch = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsSwitch.ToString());
                        wcsSwitch.Value     = "0";
                        wcsActionType.Value = CarActionType.Init.GetIndexString();
                        wcsRow.Value        = "0";
                        CommandUpdateLocation?.Invoke(Self);
                    }
                }
                //清除【位置】设置
                if (wcsActionType.Value == CarActionType.ResetPosition.GetIndexString())
                {
                    var wcsPosition = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == "wcsPosition");
                    if (wcsPosition.Value != "0")
                    {
                        var wcsSwitch = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsSwitch.ToString());
                        wcsSwitch.Value     = "0";
                        wcsActionType.Value = CarActionType.Init.GetIndexString();
                        wcsPosition.Value   = "0";
                        CommandSetPosition?.Invoke(Self);
                    }
                }

                //清除【复位】设置
                var wcsResetCommand = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsResetCommand.ToString());
                if (wcsResetCommand.Value != "0")
                {
                    wcsResetCommand.Value = "0";
                    CommandReset?.Invoke(Self);
                }
                //清除【删除任务】设置
                var wcsDeleteCommand = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsDeleteCommand.ToString());
                if (wcsDeleteCommand.Value != "0")
                {
                    wcsDeleteCommand.Value = "0";
                    CommandDelete?.Invoke(Self);
                }
                //清除【切换模式】设置
                var wcsControlMode = Self.EquipmentProps.Find(t => t.EquipmentTypeTemplateCode == CarMonitorProps.wcsControlMode.ToString());
                if (wcsControlMode.Value != "0")
                {
                    wcsControlMode.Value = "0";
                    CommandControlMode?.Invoke(Self);
                }
                #endregion
            }
            catch (Exception ex)
            {
                Logger.Log($"小车监控界面异常:{ex.Message}", LogLevel.Exception);
            }
        }