コード例 #1
0
 private void UpdateBusyComponents(UiComponent changedUIComponents, bool isBusy)
 {
     if ((changedUIComponents & UiComponent.ALL_SERIAL_DEVICES) == UiComponent.ALL_SERIAL_DEVICES)
     {
         UpdateIsAllSupportedSerialDevicesEnabled();
     }
     if ((changedUIComponents & UiComponent.ALL_BLE_DEVICES) == UiComponent.ALL_BLE_DEVICES)
     {
         UpdateIsAllSupportedBleDevicesEnabled();
     }
     if ((changedUIComponents & UiComponent.POSITION_CONTROLLER) == UiComponent.POSITION_CONTROLLER)
     {
         this.positionControllerDeviceModel.OnBusyChanged(isBusy);
     }
     if ((changedUIComponents & UiComponent.WIRELESS_LINE_SENSOR) == UiComponent.WIRELESS_LINE_SENSOR)
     {
         this.wirelessLineSensorDeviceModel.OnBusyChanged(isBusy);
     }
     if ((changedUIComponents & UiComponent.ALL_SERIAL_DEVICES) == UiComponent.ALL_SERIAL_DEVICES ||
         (changedUIComponents & UiComponent.POSITION_CONTROLLER) == UiComponent.POSITION_CONTROLLER)
     {
         SerialDeviceToggleConnectionCommand.UpdateCanExecute();
     }
     if ((changedUIComponents & UiComponent.ALL_BLE_DEVICES) == UiComponent.ALL_BLE_DEVICES ||
         (changedUIComponents & UiComponent.WIRELESS_LINE_SENSOR) == UiComponent.WIRELESS_LINE_SENSOR)
     {
         BleDeviceToggleScanningCommand.UpdateCanExecute();
         BleDeviceToggleConnectionCommand.UpdateCanExecute();
     }
     if ((changedUIComponents & UiComponent.POSITION_CONTROLLER) == UiComponent.POSITION_CONTROLLER ||
         (changedUIComponents & UiComponent.WIRELESS_LINE_SENSOR) == UiComponent.WIRELESS_LINE_SENSOR)
     {
         CollectDataCommand.UpdateCanExecute();
     }
 }
コード例 #2
0
        /// <returns>returns previously busy components</returns>
        public UiComponent SetBusy(UiComponent uiComponent, bool isBusy)
        {
            UiComponent oldBusyComponents = this.busyUIComponents;
            UiComponent changedUIComponents;

            if (isBusy)
            {
                // this.busyUIComponents     0011
                // uiComponent               0101
                // changedUIComponents       0100
                // new this.busyUIComponents 0111

                changedUIComponents    = ~this.busyUIComponents & uiComponent;
                this.busyUIComponents |= uiComponent;
            }
            else
            {
                // this.busyUIComponents     0011
                // uiComponent               0101
                // changedUIComponents       0001
                // new this.busyUIComponents 0010

                changedUIComponents    = this.busyUIComponents & uiComponent;
                this.busyUIComponents &= ~uiComponent;
            }

            UpdateBusyComponents(changedUIComponents, isBusy);

            return(oldBusyComponents);
        }
コード例 #3
0
ファイル: SkiUiScene.cs プロジェクト: daltonks/SkiEngine
 public void OnTouch(SkiTouch touch)
 {
     if (touch.InContact)
     {
         UiComponent.HideNativeEntry();
     }
     _scene.OnTouch(touch);
 }
コード例 #4
0
        public void ResetBusy(UiComponent busyComponents)
        {
            UiComponent newBusyUIComponents    = (~this.busyUIComponents) & busyComponents;
            UiComponent newNotBusyUIComponents = this.busyUIComponents & (~busyComponents);

            this.busyUIComponents = busyComponents;
            UpdateBusyComponents(newBusyUIComponents, true);
            UpdateBusyComponents(newNotBusyUIComponents, false);
        }
コード例 #5
0
ファイル: PositionLayout.cs プロジェクト: ndech/Alpha
 public PositionLayout(UiComponent parent, UniScalar width, UniScalar height, HorizontalAlignment horizontalAlignment,
                       VerticalAlignment verticalAlignment, Padding padding = null) : base(parent)
 {
     _width  = width;
     _height = height;
     _horizontalAlignment = horizontalAlignment;
     _verticalAlignment   = verticalAlignment;
     _padding             = padding ?? new Padding(0);
 }
コード例 #6
0
ファイル: PositionLayout.cs プロジェクト: ndech/Alpha
 public PositionLayout(UiComponent parent, UniScalar width, UniScalar height, HorizontalAlignment horizontalAlignment,
     VerticalAlignment verticalAlignment, Padding padding = null)
     : base(parent)
 {
     _width = width;
     _height = height;
     _horizontalAlignment = horizontalAlignment;
     _verticalAlignment = verticalAlignment;
     _padding = padding ?? new Padding(0);
 }
コード例 #7
0
 private void ApplyStyle <T>(Style <T> style, UiComponent component, string type)
     where T : Control
 {
     if (component.Parent != null)
     {
         ApplyStyle(style, component.Parent, type);
     }
     if (_styles[type].ContainsKey(component.Id))
     {
         style.Apply(_styles[type][component.Id]);
     }
 }
コード例 #8
0
ファイル: SearchAttribute.cs プロジェクト: payamad/Core
        /// <summary>
        ///
        /// </summary>
        /// <remarks></remarks>
        /// <seealso cref=""/>
        /// <param name="value"></param>
        /// <returns></returns>
        public static string GetUIComponentAsString(UiComponent value)
        {
            switch (value)
            {
            case UiComponent.Item: return("item");

            case UiComponent.List: return("list");

            case UiComponent.Range: return("range");

            default: return("item");
            }
        }
コード例 #9
0
        private void Awake()
        {
            // Load the level
            service = new LevelService();
            service.LoadLevel("Level1");

            // Grab all enemies
            enemies = service.LevelData.Entities.Where(p => p.Type == EntityType.Enemy).ToArray();

            ui = GameObject.Find("Canvas").GetComponent <UiComponent>();

            //initialize gameplay
            gameObject.AddComponent <GameManager>().Initialize(service, ui);
        }
コード例 #10
0
ファイル: Screen.cs プロジェクト: ndech/Alpha
        public virtual bool MouseScrolled(int delta)
        {
            UiComponent currentComponent = HoveredControl;

            while (currentComponent != null && currentComponent != this)
            {
                if (currentComponent.OnMouseScrolled(delta))
                {
                    return(true);
                }
                currentComponent = currentComponent.Parent;
            }
            return(OnMouseScrolled(delta));
        }
コード例 #11
0
        public void Initialize(LevelService levelService, UiComponent ui)
        {
            this.Service = levelService;

            this.Ui = ui;

            m_skillManager.Initialize(this);

            StateManager.Initialize(this);

            Ui.RetryButton.onClick.AddListener(Retry);
            Ui.NextLevelButton.onClick.AddListener(NextLevel);

            InitializeMatch();
        }
コード例 #12
0
ファイル: MainMenuState.cs プロジェクト: Sidneys1/HeartOfGold
        public MainMenuState(FiniteStateMachine <GameState> stateMachine, MainGame game) : base(stateMachine, game)
        {
            _sb = Game.SpriteBatch;

            _content = new ContentEngine {
                Game = Game
            };
            _content.RequestTexture("logo", "Sprites/hog_128");
            _content.RequestTexture("map", "Sprites/map_background");
            _content.RequestTexture("clouds", "Sprites/map_clouds");
            _content.RequestFont("title", "Fonts/title");
            _content.RequestFont("menu", "Fonts/menu");

            _ui = new UiComponent(Game);
        }
コード例 #13
0
        public override void Execute(MainModel parameter)
        {
            if (parameter.CollectDataCommandTitle == MainModel.TITLE_COLLECT_DATA)
            {
                parameter.CollectDataCommandTitle = MainModel.TITLE_STOP_COLLECTING_DATA;

                UiComponent previousBusyComponents = parameter.SetBusy(UiComponent.POSITION_CONTROLLER | UiComponent.WIRELESS_LINE_SENSOR, true);

                this.cancellationTokenSource = new CancellationTokenSource();

                PropertyChangedEventHandler emergencyStoppedHandler = (s, e) => {
                    if (e.PropertyName == nameof(parameter.PositionControllerDeviceModel.IsEmergencyStopped) &&
                        parameter.PositionControllerDeviceModel.IsEmergencyStopped)
                    {
                        this.cancellationTokenSource.Cancel();
                    }
                };

                parameter.PositionControllerDeviceModel.PropertyChanged += emergencyStoppedHandler;

                int    numberOfSamples             = parameter.NumberOfSamples;
                string resultFilePathPrefix        = parameter.FilePathPrefix;
                uint   dataCollectionPositionDelta = (uint)(parameter.StepSize / PositionController.DISTANCE_PER_TICK_MM + 0.5);

                Task.Run(() => this.dataCollector.CollectData(dataCollectionPositionDelta,
                                                              numberOfSamples,
                                                              resultFilePathPrefix,
                                                              this.cancellationTokenSource.Token))
                .ContinueWith(t =>
                {
                    try
                    {
                        parameter.ResetBusy(previousBusyComponents);
                        parameter.CollectDataCommandTitle = MainModel.TITLE_COLLECT_DATA;
                    }
                    finally
                    {
                        parameter.PositionControllerDeviceModel.PropertyChanged -= emergencyStoppedHandler;
                    }
                },
                              TaskScheduler.FromCurrentSynchronizationContext() /* make sure we continue on UI thread */);
            }
            else
            {
                this.cancellationTokenSource.Cancel();
            }
        }
コード例 #14
0
ファイル: GameController.cs プロジェクト: mengtest/BallJump
 // Use this for initialization
 private void Start()
 {
     CreateTerrain();
     CreateJewels();
     Text[] cnvsChildren = Cnvs.GetComponentsInChildren <Text>();
     m_ScoreText    = cnvsChildren[0];
     m_InfoText     = cnvsChildren[1];
     m_TimerText    = cnvsChildren[2];
     m_UiComponents = GameObject.FindGameObjectsWithTag("UI");
     foreach (GameObject UiComponent in m_UiComponents)
     {
         UiComponent.SetActive(false);
     }
     Cursor.visible           = false;
     m_GameFinishedFirstFrame = true;
     m_IsGameFinished         = false;
     m_InfoText.text          = "";
     SetTexts();
 }
コード例 #15
0
ファイル: GameController.cs プロジェクト: mengtest/BallJump
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         if (Mathf.FloorToInt(Time.timeScale) == 0)
         {
             Time.timeScale  = 1;
             m_InfoText.text = "";
             foreach (GameObject UiComponent in m_UiComponents)
             {
                 UiComponent.SetActive(false);
             }
         }
         else
         {
             Time.timeScale  = 0;
             m_InfoText.text = "Paused";
             foreach (GameObject UiComponent in m_UiComponents)
             {
                 UiComponent.SetActive(true);
             }
         }
     }
     if (m_IsGameFinished && m_GameFinishedFirstFrame)
     {
         GetComponent <AudioSource>().Play();
         m_GameFinishedFirstFrame = false;
     }
     if (m_IsGameFinished)
     {
         m_UiComponents[1].SetActive(true);
     }
     if ((m_IsGameFinished || Mathf.FloorToInt(Time.timeScale) == 0) && Input.GetKeyDown(KeyCode.Return))
     {
         SceneManager.LoadScene("MainScene");
         m_IsGameFinished = false;
         Time.timeScale   = 1;
         m_InfoText.text  = "";
     }
     SetTexts();
 }
コード例 #16
0
ファイル: ImageElement.cs プロジェクト: Sidneys1/HeartOfGold
 public ImageElement(UiComponent uiComponent, Texture2D texture) : base(uiComponent)
 {
     _texture = texture;
 }
コード例 #17
0
 public ElementAssert(UiComponent component, By selector)
 {
     _component = component;
     _selector = selector;
 }
コード例 #18
0
ファイル: UiPanel.cs プロジェクト: Chikanut/PR
 private void Awake()
 {
     TransitionTime = _uiComponents.Max(c => c.TransitionTime);
     _componentWithLongestTransition = _uiComponents.First(c => c.TransitionTime == TransitionTime);
 }
コード例 #19
0
ファイル: UiElement.cs プロジェクト: Sidneys1/HeartOfGold
 protected UiElement(UiComponent uiComponent)
 {
     UiComponent = uiComponent;
 }
コード例 #20
0
        public override SmartDeviceConfig GenerateConfig(SmartDeviceConfig conf)
        {
            #region ComponentDefinitions

            var EquipmentView = new UiComponent
            {
                Type = ConfigConstants.Components.TextView,
                Id   = "equipment",
                Name = "Equipment"
            };
            var TextView = new UiComponent
            {
                Type = ConfigConstants.Components.TextView,
                Id   = "text",
                Name = "Text"
            };
            var ActualView = new UiComponent
            {
                Type = ConfigConstants.Components.TextView,
                Id   = "actual_value",
                Name = "Actual Value"
            };
            var SetPValue = new UiComponent
            {
                Type = ConfigConstants.Components.TextView,
                Id   = "temperature_setp",
                Name = "Set Point Value"
            };
            var HHView = new UiComponent
            {
                Type = ConfigConstants.Components.TextView,
                Id   = "temperature_HH",
                Name = "Upper Error Value"
            };
            var HView = new UiComponent
            {
                Type = ConfigConstants.Components.TextView,
                Id   = "temperature_H",
                Name = "Upper Warn Value"
            };
            var LView = new UiComponent
            {
                Type = ConfigConstants.Components.TextView,
                Id   = "temperature_L",
                Name = "Lower Warn Value"
            };
            var LLView = new UiComponent
            {
                Type = ConfigConstants.Components.TextView,
                Id   = "temperature_LL",
                Name = "Lower Error Value"
            };
            var DateView = new UiComponent
            {
                Type = ConfigConstants.Components.DateView,
                Id   = "time",
                Name = "Time"
            };
            var AcceptDeclineButton = new UiComponent
            {
                Type = ConfigConstants.Components.DoubleButton,
                Id   = "submit",
                Name = "Accept",
                AdditionalProperties =
                {
                    { "Value",            "Accept"  },
                    { "OnClickPrimary",   "SendJob" },
                    { "TextSecondary",    "Decline" },
                    { "ValueSecondary",   "Decline" },
                    { "OnClickSecondary", "SendJob" },
                    { "Primary",          true      }
                }
            };
            #endregion

            #region UIs
            var uiLayouts = new List <UiLayout>()
            {
                new UiLayout
                {
                    Id       = JobLimitViolation,
                    Title    = "Limit Violation",
                    Type     = ConfigConstants.Views.JobView,
                    Elements = new []
                    {
                        EquipmentView,
                        TextView,
                        DateView,
                        ActualView,
                        HHView,
                        HView,
                        SetPValue,
                        LView,
                        LLView,
                        AcceptDeclineButton
                    }
                },
            };
            conf.Uis = uiLayouts;
            #endregion

            #region Groups

            conf.DeviceGroups = new[]
            {
                new DeviceGroup
                {
                    GroupName   = GroupValueMonitoring,
                    VisibleTabs = new[] { Tabs.Dashboard },
                }
            };

            #endregion

            #region Users

            //Generate Users
            var users = new List <User>();
            for (var i = 0; i < 2; i++)
            {
                users.Add(new User
                {
                    Username = $"user{i + 1}",
                    FullName = $"User {i + 1}",
                    Groups   = new[] { DefaultConfig.GroupChat, GroupValueMonitoring },
                    Devices  = new[] { new SmartDevice
                                       {
                                           DeviceName   = "A",
                                           DeviceFamily = DeviceFamily.Phone,
                                           DeviceType   = DeviceType.Android,
                                           DeviceGroups = new [] { Uc5LiveData.GroupLiveData }
                                       },
                                       new SmartDevice
                                       {
                                           DeviceName   = "B",
                                           DeviceFamily = DeviceFamily.Watch,
                                           DeviceType   = DeviceType.Android,
                                           DeviceGroups = null
                                       }, }
                });
            }
            conf.Users = users;

            #endregion

            return(conf);
        }
コード例 #21
0
ファイル: Layout.cs プロジェクト: ndech/Alpha
 public Layout(UiComponent parent)
 {
     ParentComponent = parent;
 }
コード例 #22
0
ファイル: Layout.cs プロジェクト: ndech/Alpha
 public Layout(UiComponent parent)
 {
     ParentComponent = parent;
 }
コード例 #23
0
 public UiComponent SetBusy(UiComponent uiComponent, bool isBusy)
 {
     return(this.mainModel.SetBusy(uiComponent, isBusy));
 }
コード例 #24
0
 public ElementAssert(UiComponent component, By selector)
 {
     _component = component;
     _selector  = selector;
 }
コード例 #25
0
ファイル: SearchAttribute.cs プロジェクト: BEXIS2/Core
 /// <summary>
 /// 
 /// </summary>
 /// <remarks></remarks>
 /// <seealso cref=""/>
 /// <param name="value"></param>
 /// <returns></returns>
 public static string GetUIComponentAsString(UiComponent value)
 {
     switch (value)
     {
         case UiComponent.Item: return "item";
         case UiComponent.List: return "list";
         case UiComponent.Range: return "range";
         default: return "item";
     }
 }
コード例 #26
0
        public override SmartDeviceConfig GenerateConfig(SmartDeviceConfig conf)
        {
            //Generate Actions
            var ReportToolBreakageAction = new UiAction
            {
                Id     = "ReportToolBreakage",
                Type   = Components.GenericAction,
                Name   = "Report tool breakage",
                JobKey = "ToolBreakage",
                Tab    = Tabs.Actions,
                AdditionalProperties = { { "Image", AppDrawables.broken.ToString() } }
            };

            conf.Actions = new[] { ReportToolBreakageAction };

            //Generate Groups
            var WorkerGroup = new DeviceGroup
            {
                GroupName   = "Operators",
                VisibleTabs = new[] { Tabs.Dashboard },
                Dashboard   = new DashboardTabConfig {
                    Actions = new [] { ReportToolBreakageAction.Id }
                }
            };
            var LogisticGroup = new DeviceGroup
            {
                GroupName   = "Logistics",
                VisibleTabs = new[] { Tabs.Dashboard }
            };
            var MaintenanceGroup = new DeviceGroup
            {
                GroupName   = "Maintenance",
                VisibleTabs = new[] { Tabs.Dashboard }
            };

            conf.DeviceGroups = new[] { WorkerGroup, LogisticGroup, MaintenanceGroup };

            //Define UI-Elements
            var SendCancelDoubleButton = new UiComponent
            {
                Type = Components.DoubleButton,
                Id   = "submit",
                Name = "Senden",
                AdditionalProperties =
                {
                    { "TextSecondary",    "Abbrechen" },
                    { "OnClickPrimary",   "SendJob"   },
                    { "OnClickSecondary", "RemoveJob" },
                    { "Primary",          true        }
                }
            };

            //Generate UI-Layouts
            conf.Uis = new List <UiLayout>
            {
                new UiLayout()
                {
                    Id       = "ChatSendMessage",
                    Title    = "Nachricht senden",
                    Type     = Views.JobView,
                    Elements = new List <UiComponent>
                    {
                        new UiComponent
                        {
                            Type = Components.Spinner,
                            Id   = "subject",
                            Name = "Senden an"
                        },
                        new UiComponent
                        {
                            Type = Components.TextInput,
                            Id   = "text",
                            Name = "Message"
                        },
                        new UiComponent
                        {
                            Type = Components.DoubleButton,
                            Id   = "submit",
                            Name = "Bearbeiten",
                            AdditionalProperties =
                            {
                                { "TextSecondary",    "Abbrechen" },
                                { "OnClickPrimary",   "SendJob"   },
                                { "OnClickSecondary", "RemoveJob" },
                                { "Primary",          true        }
                            }
                        },
                    },
                    AdditionalProperties = { { "OnBackPressed", "RemoveJob" } }
                },
                new UiLayout()
                {
                    Id       = "ToolBreakage",
                    Title    = "Report tool breakage",
                    Type     = Views.JobView,
                    Elements = new List <UiComponent>
                    {
                        new UiComponent
                        {
                            Type = Components.Spinner,
                            Id   = "subject",
                            Name = "Maschine / Location"
                        },
                        new UiComponent
                        {
                            Type = Components.TextInput,
                            Id   = "text",
                            Name = "Article / Number"
                        },
                        new UiComponent
                        {
                            Type = Components.TextInput,
                            Id   = "description",
                            Name = "Description",
                            AdditionalProperties = { { "InputType", "multiline" } }
                        },
                        new UiComponent
                        {
                            Type = Components.Switch,
                            Id   = "helpRequested",
                            Name = "Needs assessment from Maintenance Team?"
                        },
                        new UiComponent
                        {
                            Type = Components.NumberInput,
                            Id   = "timeoffset",
                            Name = "Tool is disasselbled in ...",
                            AdditionalProperties =
                            {
                                { "Interval",          5 },
                                { "Count",            25 },
                                { "Suffix",   " Minutes" }
                            }
                        },
                        new UiComponent
                        {
                            Type = Components.Button,
                            Id   = "submit",
                            Name = "Bestätigen",
                            AdditionalProperties =
                            {
                                { "OnClick", "SendJob" },
                                { "Primary", true      }
                            }
                        },
                        SendCancelDoubleButton
                    }
                }
                //TODO: Add all remaining UIs
            };

            //Generate Users
            var users = new List <User>();

            for (var i = 0; i < 4; i++)
            {
                users.Add(new User
                {
                    Username = $"operator{i}",
                    FullName = $"Operator {i}",
                    Groups   = new[] { WorkerGroup.GroupName },
                    Devices  = new [] { new SmartDevice
                                        {
                                            DeviceName   = "A",
                                            DeviceFamily = DeviceFamily.Phone,
                                            DeviceType   = DeviceType.Android,
                                            DeviceGroups = new [] { DefaultConfig.GroupChat }
                                        },
                                        new SmartDevice
                                        {
                                            DeviceName   = "B",
                                            DeviceFamily = DeviceFamily.Watch,
                                            DeviceType   = DeviceType.Android,
                                            DeviceGroups = null
                                        }, }
                });
            }
            for (var i = 0; i < 4; i++)
            {
                users.Add(new User
                {
                    Username = $"log{i}",
                    FullName = $"Logistician {i}",
                    Groups   = new[] { WorkerGroup.GroupName },
                    Devices  = new[] { new SmartDevice
                                       {
                                           DeviceName   = "A",
                                           DeviceFamily = DeviceFamily.Phone,
                                           DeviceType   = DeviceType.Android,
                                           DeviceGroups = new [] { DefaultConfig.GroupChat }
                                       },
                                       new SmartDevice
                                       {
                                           DeviceName   = "B",
                                           DeviceFamily = DeviceFamily.Watch,
                                           DeviceType   = DeviceType.Android,
                                           DeviceGroups = null
                                       }, }
                });
            }
            for (var i = 0; i < 4; i++)
            {
                users.Add(new User
                {
                    Username = $"maintenance{i}",
                    FullName = $"Maintainer {i}",
                    Groups   = new[] { WorkerGroup.GroupName },
                    Devices  = new[] { new SmartDevice
                                       {
                                           DeviceName   = "A",
                                           DeviceFamily = DeviceFamily.Phone,
                                           DeviceType   = DeviceType.Android,
                                           DeviceGroups = new [] { DefaultConfig.GroupChat }
                                       },
                                       new SmartDevice
                                       {
                                           DeviceName   = "B",
                                           DeviceFamily = DeviceFamily.Watch,
                                           DeviceType   = DeviceType.Android,
                                           DeviceGroups = null
                                       }, }
                });
            }
            conf.Users = users;

            return(conf);
        }
コード例 #27
0
 public TextElement(UiComponent uiComponent, SpriteFont font) : base(uiComponent)
 {
     _font = font;
 }