private static void StartBuild(int playerCount)
    {
        FlowSettings settings = ScriptableObject.CreateInstance <FlowSettings>();
        BuildTarget  target   = BuildTarget.StandaloneWindows64;

        EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, target);

        string             server        = GetScenePath(settings.TEST_SCENE_SERVER);
        BuildPlayerOptions serverOptions = new BuildPlayerOptions();

        serverOptions.scenes           = new[] { server };
        serverOptions.target           = target;
        serverOptions.locationPathName = "Build/server/server.exe";
        serverOptions.options          = BuildOptions.EnableHeadlessMode | BuildOptions.AutoRunPlayer;

        BuildPipeline.BuildPlayer(serverOptions);

        for (int i = 1; i <= playerCount; i++)
        {
            string             client        = GetScenePath(settings.TEST_SCENE_CLIENT);
            BuildPlayerOptions clientOptions = new BuildPlayerOptions();
            clientOptions.scenes           = new[] { client };
            clientOptions.target           = target;
            clientOptions.locationPathName = "Build/clients/client" + i.ToString() + "/client.exe";
            clientOptions.options          = BuildOptions.AutoRunPlayer;

            BuildPipeline.BuildPlayer(clientOptions);
        }
    }
 public ModulesFactory(IOptions <FlowSettings> settings, ILoggerFactory loggerFactory, IListener listener, IAnnouncer announcer)
 {
     this.listener      = listener;
     this.announcer     = announcer;
     this.settings      = settings.Value;
     this.loggerFactory = loggerFactory;
 }
Esempio n. 3
0
        private void UpdateViewOnNext(FlowSettings flowSettings)
        {
            if (forwardRepopulateStack.Count == 0)
            {
                return;
            }

            ViewFieldsListPair pair = forwardRepopulateStack.Pop();

            if (pair == null)
            {
                return;
            }

            DoUpdate(flowSettings.ScreenSettings.View);
            void DoUpdate(ViewBase view)
            {
                if (!pair.View.Equals(view))
                {
                    forwardRepopulateStack.Clear();
                    return;
                }

                view.UpdateFields(pair.Fields);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// setup necessary stuff for the client
 /// </summary>
 void Setup()
 {
     settings             = FlowSettings;
     FlowActions.settings = settings;
     FlowActions.isClient = true;
     flowActions          = gameObject.AddComponent <FlowActions>();
     IsEnabled            = true;
 }
Esempio n. 5
0
        private void FlowSettingsChanged(FlowSettings flowSettings)
        {
            flowSettings.FlowDataCache.NavigationBar.MenuItems
            .ForEach(item => item.Active = item.InitialModule == flowSettings.FlowDataCache.NavigationBar.CurrentModule);

            ChangePage(flowSettings.ScreenSettings.CreatePage());

            UpdateNavigationMenu(flowSettings);
        }
Esempio n. 6
0
        public async Task RunFlow(NewFlowRequest request)
        {
            DateTime     dt           = DateTime.Now;
            FlowSettings flowSettings = await this.FlowManager.NewFlowStart(request);

            DateTime dt2 = DateTime.Now;

            appLogger.LogMessage(nameof(ScopedFlowManagerService), $"RunFlow (milliseconds) = {(dt2 - dt).TotalMilliseconds}");
        }
Esempio n. 7
0
        public async Task Start()
        {
            DateTime     dt           = DateTime.Now;
            FlowSettings flowSettings = await this.FlowManager.Start("home");

            DateTime dt2 = DateTime.Now;

            appLogger.LogMessage(nameof(ScopedFlowManagerService), $"Start (milliseconds) = {(dt2 - dt).TotalMilliseconds}");

            uiNotificationService.NotifyFlowSettingsChanged(flowSettings);
        }
Esempio n. 8
0
        public async Task Next(CommandButtonRequest request)
        {
            DateTime     dt           = DateTime.Now;
            FlowSettings flowSettings = await this.FlowManager.Next(request);

            DateTime dt2 = DateTime.Now;

            appLogger.LogMessage(nameof(ScopedFlowManagerService), $"Next (milliseconds) = {(dt2 - dt).TotalMilliseconds}");

            uiNotificationService.NotifyFlowSettingsChanged(flowSettings);
        }
Esempio n. 9
0
        /// <summary>
        /// Sets up rudimentary stuff for the server
        /// </summary>
        void Setup()
        {
            settings             = FlowSettings;
            FlowActions.settings = FlowSettings;
            flowActions          = gameObject.AddComponent <FlowActions>();


            // setup unity to run on the defined tickrate
            Time.fixedDeltaTime         = 1f / settings.TICK_RATE;
            QualitySettings.vSyncCount  = 0;
            Application.targetFrameRate = settings.TICK_RATE;
        }
Esempio n. 10
0
        private FlowSettings UpdateFlowSettings(FlowSettings flowSettings, NavigationType navigationType = NavigationType.Next)
        {
            this.FlowDataCache          = flowSettings.FlowDataCache;
            this.ScreenSettings         = flowSettings.ScreenSettings;
            flowSettings.NavigationType = navigationType;

            if (flowSettings.ScreenSettings.ViewType != ViewType.Exception)
            {
                Task.Run(async() => await flowStateRepository.SaveFlowState(flowSettings.FlowState)); //just fire and forget
            }
            return(flowSettings);
        }
Esempio n. 11
0
        private void FlowSettingsChanged(FlowSettings flowSettings)
        {
            flowSettings.NavigationBar.MenuItems
            .ForEach(item => item.Active = item.InitialModule == flowSettings.NavigationBar.CurrentModule);

            /*To Remove*/
            if (flowSettings.ScreenSettings == null)
            {
                return;
            }

            ChangePage(flowSettings.ScreenSettings.CreatePage());

            UpdateNavigationMenu(flowSettings);
        }
Esempio n. 12
0
        private void UpdateViewOnPrevious(FlowSettings flowSettings)
        {
            ViewFieldsListPair pair = previousRepopulateStack.Pop();

            if (pair == null)
            {
                return;
            }

            DoUpdate(flowSettings.ScreenSettings.View);
            void DoUpdate(ViewBase view)
            {
                if (pair.View.GetType() != view.GetType())
                {
                    return;
                }

                view.UpdateFields(pair.Fields);
            }
        }
        private void UpdateNavigationMenuOnNext(FlowSettings flowSettings)
        {
            if (ViewModel.MenuItems.Count == 0)
            {
                ViewModel.MenuItems = new ObservableCollection <MenuItem>(flowSettings.FlowDataCache.DialogList);
            }
            else
            {
                for (int i = 0; i < ViewModel.MenuItems.Count; i++)
                {
                    if (ViewModel.MenuItems[i].Equals(flowSettings.FlowDataCache.DialogList[i]))
                    {
                        continue;
                    }

                    ViewModel.MenuItems[i] = flowSettings.FlowDataCache.DialogList[i];
                }

                ViewModel.MenuItems.Add(flowSettings.FlowDataCache.DialogList.Last());
            }
        }
        private void UpdateNavigationMenu(FlowSettings flowSettings)
        {
            //ViewModel.MenuItems.Clear();
            navView.MenuItems.Clear();
            navView.SelectedItem = null;
            //Need to manually clear the navigation view because
            //of unpredictable behaviour in the Top Nav.  The left nav worked fine without clearing.

            if (flowSettings.NavigationType == NavigationType.Start)
            {
                UpdateNavigationMenuOnStart(flowSettings);
            }

            if (flowSettings.NavigationType == NavigationType.Next)
            {
                UpdateNavigationMenuOnNext(flowSettings);
            }

            if (flowSettings.NavigationType == NavigationType.Previous)
            {
                UpdateNavigationMenuOnPrevious(flowSettings);
            }
        }
        private void UpdateNavigationMenuOnPrevious(FlowSettings flowSettings)
        {
            if (ViewModel.MenuItems.Count == 0)//should never happen beacuse the Resume navigation type is Next
            {
                ViewModel.MenuItems = new ObservableCollection <MenuItem>(flowSettings.FlowDataCache.DialogList);
            }
            else
            {
                ViewModel.MenuItems
                .Skip(flowSettings.FlowDataCache.DialogList.Count)
                .ToList()
                .ForEach(m => ViewModel.MenuItems.Remove(m));

                for (int i = 0; i < flowSettings.FlowDataCache.DialogList.Count; i++)
                {
                    if (ViewModel.MenuItems[i].Equals(flowSettings.FlowDataCache.DialogList[i]))
                    {
                        continue;
                    }

                    ViewModel.MenuItems[i] = flowSettings.FlowDataCache.DialogList[i];
                }
            }
        }
        private void FlowSettingsChanged(FlowSettings flowSettings)
        {
            if (flowSettings.ScreenSettings.ViewType != ViewType.Exception)
            {
                int stage = -1;
                flowSettings.FlowDataCache.DialogList.ForEach(item =>
                {
                    item.Stage = ++stage;
                    item.Last  = item.Equals(flowSettings.FlowDataCache.DialogList.Last());
                    if (item.Text.Length > 20)
                    {
                        item.Text = string.Concat(item.Text.Substring(0, 20), "...");
                    }
                });

                UpdateNavigationMenu(flowSettings);
                ViewModel.BackButtonEnabled = ViewModel.MenuItems?.Count > 1;
            }

            if (flowSettings.NavigationType == NavigationType.Next || flowSettings.NavigationType == NavigationType.Start)
            {
                if (flowSettings.ScreenSettings.ViewType == ViewType.Exception)
                {
                    SetExceptionDialog(flowSettings.ScreenSettings);
                }
                else
                {
                    SetNextDialog(flowSettings.ScreenSettings);
                }
            }

            if (flowSettings.NavigationType == NavigationType.Previous)
            {
                SetPreviousDialog(flowSettings.ScreenSettings);
            }
        }
Esempio n. 17
0
 public FlowService(IOptions <FlowSettings> flowSettings)
 {
     this.flowSettings = flowSettings.Value;
 }
Esempio n. 18
0
        public async Task Next(RequestBase request)
        {
            FlowSettings flowSettings = await Task.Run(() => this.FlowManager.Next(request));

            this.FlowSettings.OnNext(UpdateFlowSettings(flowSettings, NavigationType.Next));
        }
Esempio n. 19
0
 protected SourceBlockBase(BlockHeader header, FlowSettings settings, LinkRouterBase <T> router) : base(header, settings)
 {
     Router   = router;
     Children = new List <ITargetBlock <T> >();
 }
Esempio n. 20
0
 private FlowSettings DoGet(FlowSettings settings, Action <FlowSettings> updateView)
 {
     updateView(settings);
     settings.FlowState = new FlowState(this.previousDataStack, this.previousRepopulateStack, this.forwardRepopulateStack);
     return(settings);
 }
Esempio n. 21
0
 private void UpdateNavigationMenu(FlowSettings flowSettings)
 => ViewModel.MenuItems = new ObservableCollection <NavigationMenuItemDescriptor>(flowSettings.FlowDataCache.NavigationBar.MenuItems);
Esempio n. 22
0
 protected BlockBase(BlockHeader header, FlowSettings settings)
 {
     Header       = header;
     FlowSettings = settings;
 }
Esempio n. 23
0
 public void NotifyFlowSettingsChanged(FlowSettings flowSettings)
 {
     this.FlowSettings = flowSettings;
     this.FlowSettingsSubject.OnNext(flowSettings);
 }
 private void UpdateNavigationMenuOnStart(FlowSettings flowSettings)
 {
     ViewModel.MenuItems.Clear();
     ViewModel.MenuItems = new ObservableCollection <MenuItem>(flowSettings.FlowDataCache.DialogList);
 }