コード例 #1
0
        public override Task <DiagnosticResult> Examine(SharedState history)
        {
            if (!history.TryGetEnvironmentVariable("DOTNET_SDK_VERSION", out var sdkVersion))
            {
                sdkVersion = SdkVersion;
            }

            var workloadManager = new DotNetWorkloadManager(SdkRoot, sdkVersion, NuGetPackageSources);

            //var installedWorkloads = workloadManager.GetInstalledWorkloads();

            // This is a bit of a hack where we manually check the sdk-manifests/{SDK_VERSION}/* folders
            // for installed workloads, and then go manually parse the manifest json
            // as well as look for a .nuspec file from the extracted nupkg when it was installed
            // the nuspec file contains the version we actually care about for now since the manifest json
            // has a long number which is meaningless right now and will eventually be changed to a string
            // when that happens we can use the actual resolver's method to get installed workload info
            var installedPackageWorkloads = workloadManager.GetInstalledWorkloads();

            var missingWorkloads = new List <Manifest.DotNetWorkload>();

            foreach (var rp in RequiredWorkloads)
            {
                if (!NuGetVersion.TryParse(rp.Version, out var rpVersion))
                {
                    rpVersion = new NuGetVersion(0, 0, 0);
                }

                // TODO: Eventually check actual workload resolver api for installed workloads and
                // compare the manifest version once it has a string in it
                if (!installedPackageWorkloads.Any(ip => ip.id.Equals(rp.Id, StringComparison.OrdinalIgnoreCase) && NuGetVersion.TryParse(ip.version, out var ipVersion) && ipVersion == rpVersion))
                {
                    ReportStatus($"{rp.Id} ({rp.PackageId} : {rp.Version}) not installed.", Status.Error);
                    missingWorkloads.Add(rp);
                }
コード例 #2
0
        protected override void RunTest(Action <RuntimeConfig> runtimeConfigCustomizer, string testAssemblyName, string appAsmVersion, string appFileVersion, string frameworkWins)
        {
            var app = SharedState.CreateTestFrameworkReferenceApp(b => b
                                                                  .WithPackage(TestVersionsPackage, "1.0.0", lib => lib
                                                                               .WithAssemblyGroup(null, g => g
                                                                                                  .WithAsset(testAssemblyName + ".dll", rf => rf
                                                                                                             .WithVersion(appAsmVersion, appFileVersion)))));

            if (runtimeConfigCustomizer is not null)
            {
                var runtimeConfig = new RuntimeConfig(app.RuntimeConfigJson);
                runtimeConfigCustomizer(runtimeConfig);
                runtimeConfig.Save();
            }

            string expectedBaseLocation = frameworkWins switch
            {
                MicrosoftNETCoreApp => SharedState.DotNetWithNetCoreApp.GreatestVersionSharedFxPath,
                HighWare => Path.Combine(SharedState.DotNetWithNetCoreApp.BinPath, "shared", HighWare, "1.1.1"),
                _ => app.Location,
            };
            string expectedTestAssemblyPath = Path.Combine(expectedBaseLocation, testAssemblyName + ".dll");

            SharedState.DotNetWithNetCoreApp.Exec(app.AppDll)
            .EnableTracingAndCaptureOutputs()
            .Execute()
            .Should().Pass()
            .And.HaveResolvedAssembly(expectedTestAssemblyPath);
        }
コード例 #3
0
        public override async Task <DiagnosticResult> Examine(SharedState history)
        {
            var vsinfo = await GetWindowsInfo();

            var sentinelFiles = new List <string>();

            foreach (var vi in vsinfo)
            {
                if (vi.Version.IsCompatible(MinimumVersion, ExactVersion))
                {
                    ReportStatus($"{vi.Version} - {vi.Path}", Status.Ok);

                    var sentinel = Path.Combine(vi.Path, "MSBuild\\Current\\Bin\\SdkResolvers\\Microsoft.DotNet.MSBuildSdkResolver\\EnableWorkloadResolver.sentinel");
                    sentinelFiles.Add(sentinel);
                }
                else
                {
                    ReportStatus($"{vi.Version}", null);
                }
            }

            if (sentinelFiles.Any())
            {
                history.ContributeState(this, "sentinel_files", sentinelFiles.ToArray());
            }

            if (vsinfo.Any(vs => vs.Version.IsCompatible(MinimumVersion, ExactVersion)))
            {
                return(DiagnosticResult.Ok(this));
            }

            return(new DiagnosticResult(Status.Error, this));
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var colorName = (string)value;
            var colorCode = SharedState.GetColor(colorName);

            return(colorCode);
        }
コード例 #5
0
 public FeetToMeterViewModel(IConvertService converter, SharedState sharedState)
 {
     _converter   = converter;
     _feet        = sharedState.Feet;
     _meter       = sharedState.Meter;
     _sharedState = sharedState;
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: riesvriend/CortexFusion
        public static void ConfigureSharedServices(IServiceCollection services)
        {
            services.AddBlazorise().AddBootstrapProviders().AddFontAwesomeIcons();

            // Default delay for update delayers
            services.AddSingleton(c => new UpdateDelayer.Options()
            {
                DelayDuration = TimeSpan.FromSeconds(0.1),
            });

            // Extensions
            services.AddFusion(fusion => {
                fusion.AddLiveClock();
            });

            // https://jspuij.github.io/Cortex.Net.Docs/pages/sharedstate.html
            services.AddCortexService <ISharedState>(sp => {
                // create an instance using the configuration
                var sharedState = new SharedState(new CortexConfiguration()
                {
                    // enforce that state mutation always happens inside an action.
                    EnforceActions         = EnforceAction.Always,
                    AutoscheduleActions    = true,
                    SynchronizationContext = SynchronizationContext.Current,
                });
                // spy event handler should be in the object itself to prevent mem-leak as there is no dispose
                //sharedState.SpyEvent += SharedState_SpyEvent;
                return(sharedState);
            });

            // This method registers services marked with any of ServiceAttributeBase descendants, including:
            // [Service], [ComputeService], [RestEaseReplicaService], [LiveStateUpdater]
            services.UseAttributeScanner().AddServicesFrom(Assembly.GetExecutingAssembly());
        }
コード例 #7
0
 public Informer(HFTLog log, SharedState sharedState, string url, string domain)
 {
     sharedState_ = sharedState;
     log_         = log;
     url_         = url;
     domain_      = domain;
 }
コード例 #8
0
 void Update()
 {
     woodTxt.text   = levelManager.wood.ToString();
     moneyTxt.text  = levelManager.money.ToString();
     ironTxt.text   = levelManager.coal.ToString();
     creditTxt.text = SharedState.GetJsonText("credit") + ": \n" + levelManager.loan.ToString();
 }
コード例 #9
0
        /// <summary>
        /// Makes sure that the observable is initialized against the shared state and any other objects along the tree.
        /// </summary>
        /// <typeparam name="T">The type to return.</typeparam>
        /// <param name="sharedState">The shared state to attach to.</param>
        /// <param name="initializerFunction">The initializer function.</param>
        /// <returns>The observable you wannt.</returns>
        public static T Observable <T>(this ISharedState sharedState, Func <T> initializerFunction)
        {
            if (sharedState is null)
            {
                throw new ArgumentNullException(nameof(sharedState));
            }

            if (initializerFunction is null)
            {
                throw new ArgumentNullException(nameof(initializerFunction));
            }

            try
            {
                SharedState.SetAsyncLocalState(sharedState);
                var result = initializerFunction();
                if (((IReactiveObject)result).SharedState != sharedState)
                {
                    // shared state should have been assigned.
                    throw new ArgumentOutOfRangeException(nameof(initializerFunction));
                }

                return(result);
            }
            finally
            {
                SharedState.SetAsyncLocalState(null);
            }
        }
コード例 #10
0
 /// <summary>
 /// Creates a new Log.
 /// </summary>
 /// <param name="name">The Logs name.</param>
 /// <param name="stateHolder">The Logs state value holder that may be shared with other Logs.</param>
 /// <param name="output">It will be initially connected to the specified outputs.</param>
 public Log(string name, SharedState stateHolder, params ILogOutput[] output)
 {
     this.state  = stateHolder;
     this.name   = name;
     this.prefix = "[" + name + "] ";
     this.strOut = new List <ILogOutput>(output);
 }
コード例 #11
0
 private DekiScriptExpressionEvaluationState(DekiScriptEnv env, DekiScriptRuntime runtime, XmlNamespaceManager namespaces, DekiScriptOutputBuffer buffer, SharedState sharedState) {
     this.Env = env;
     this.Namespaces = namespaces;
     this.Buffer = buffer;
     this.Runtime = runtime;
     _sharedState = sharedState;
 }
コード例 #12
0
        public override IEnumerable <Checkup> Contribute(Manifest.Manifest manifest, SharedState sharedState)
        {
            var sdks = manifest?.Check?.DotNet?.Sdks;

            if (sdks?.Any() ?? false)
            {
                foreach (var sdk in sdks)
                {
                    var workloads = sdk?.Workloads?.ToArray() ?? Array.Empty <DotNetWorkload>();
                    var packs     = sdk?.Packs?.ToArray() ?? Array.Empty <DotNetSdkPack>();
                    var pkgSrcs   = sdk?.PackageSources?.ToArray() ?? Array.Empty <string>();

                    string sdkVersion;
                    if (!sharedState.TryGetEnvironmentVariable("DOTNET_SDK_VERSION", out sdkVersion))
                    {
                        sdkVersion = sdk.Version;
                    }

                    if (sdk.Workloads?.Any() ?? false)
                    {
                        yield return(new DotNetWorkloadsCheckup(sharedState, sdkVersion, workloads, pkgSrcs));
                    }

                    // Always generate a packs check even if no packs, since the workloads may dynamically
                    // discover packs required and register them with the SharedState
                    yield return(new DotNetPacksCheckup(sharedState, sdkVersion, packs, pkgSrcs));
                }
            }
        }
コード例 #13
0
        static Log()
        {
            SharedState state = new SharedState();

            data      = new DataLogOutput();
            logGame   = new Log("Game", state, data);
            logCore   = new Log("Core", state, data);
            logEditor = new Log("Edit", state, data);

            bool hasConsole = true;

            try
            {
                int doesThisThrow = Console.WindowHeight;
            }
            catch (Exception)
            {
                hasConsole = false;
            }
            if (System.Diagnostics.Debugger.IsAttached || hasConsole)
            {
                logGame.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkGray));
                logCore.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkBlue));
                logEditor.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkMagenta));
            }
        }
コード例 #14
0
        public override async Task Implement(SharedState sharedState, System.Threading.CancellationToken cancellationToken)
        {
            await base.Implement(sharedState, cancellationToken);

            ReportStatus($"Installing {Title ?? Url.ToString()}...");

            var boots = new Boots.Core.Bootstrapper
            {
                Url    = Url.ToString(),
                Logger = System.IO.TextWriter.Null
            };

            try
            {
                await boots.Install(cancellationToken);

                ReportStatus($"Installed {Title ?? Url.ToString()}.");
            }
            catch (Exception ex)
            {
                Util.Exception(ex);
                ReportStatus($":warning: Installation failed for {Title ?? Url.ToString()}.");
                throw;
            }
        }
コード例 #15
0
        public override Task <DiagnosticResult> Examine(SharedState history)
        {
            // Info here: https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#online-only-deployment
            string WebView2RegistryKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}";

            var webView2VersionObject = Microsoft.Win32.Registry.GetValue(
                keyName: WebView2RegistryKey,
                valueName: "pv",
                defaultValue: null);

            var webView2Version = webView2VersionObject as string;

            var isWebView2Installed = !string.IsNullOrEmpty(webView2Version);

            if (isWebView2Installed)
            {
                ReportStatus($"Found Edge WebView2 version {webView2Version}", Status.Ok);
                return(Task.FromResult(DiagnosticResult.Ok(this)));
            }

            return(Task.FromResult(new DiagnosticResult(
                                       Status.Error,
                                       this,
                                       new Suggestion($"Download Edge WebView2 from https://developer.microsoft.com/microsoft-edge/webview2/"))));
        }
コード例 #16
0
ファイル: Log.cs プロジェクト: SirePi/duality
 /// <summary>
 /// Creates a new Log.
 /// </summary>
 /// <param name="name">The Logs name.</param>
 /// <param name="stateHolder">The Logs state value holder that may be shared with other Logs.</param>
 /// <param name="output">It will be initially connected to the specified outputs.</param>
 public Log(string name, SharedState stateHolder, params ILogOutput[] output)
 {
     this.state = stateHolder;
     this.name = name;
     this.prefix = "[" + name + "] ";
     this.strOut = new List<ILogOutput>(output);
 }
コード例 #17
0
 public Request(SharedState shared, int source, int dest, int tag)
 {
     this.shared = shared;
     this.source = source;
     this.dest   = dest;
     this.tag    = tag;
 }
コード例 #18
0
                public override QsExpressionKind <TypedExpression, Identifier, ResolvedType> OnIdentifier(Identifier sym, QsNullable <ImmutableArray <ResolvedType> > tArgs)
                {
                    if (sym is Identifier.GlobalCallable global)
                    {
                        ImmutableConcretion applicableParams = SharedState.CurrentParamTypes
                                                               .Where(kvp => kvp.Key.Item1.Equals(global.Item))
                                                               .ToImmutableDictionary(kvp => kvp.Key, kvp => kvp.Value);

                        // Create a new identifier
                        sym   = SharedState.GetConcreteIdentifier(global, applicableParams);
                        tArgs = QsNullable <ImmutableArray <ResolvedType> > .Null;

                        // Remove Type Params used from the CurrentParamTypes
                        foreach (var key in applicableParams.Keys)
                        {
                            SharedState.CurrentParamTypes.Remove(key);
                        }
                    }
                    else if (sym is Identifier.LocalVariable && tArgs.IsValue && tArgs.Item.Any())
                    {
                        throw new ArgumentException($"Local variables cannot have type arguments.");
                    }

                    return(base.OnIdentifier(sym, tArgs));
                }
コード例 #19
0
        /// <summary>
        /// Initializes a Manager that stores Databases in the given directory.
        /// </summary>
        /// <param name="directoryFile"><see cref="System.IO.DirectoryInfo"/> object for initializing the Manager object.</param>
        /// <param name="options">Option flags for initialization.</param>
        /// <exception cref="T:System.IO.DirectoryNotFoundException">Thrown when there is an error while accessing or creating the given directory.</exception>
        public Manager(DirectoryInfo directoryFile, ManagerOptions options)
        {
            Log.I(TAG, "Starting Manager version: " + VersionString);

            this.directoryFile = directoryFile;
            this.options       = options ?? DefaultOptions;
            this.databases     = new Dictionary <string, Database>();
            this.replications  = new List <Replication>();

            //create the directory, but don't fail if it already exists
            if (!directoryFile.Exists)
            {
                directoryFile.Create();
                directoryFile.Refresh();
                if (!directoryFile.Exists)
                {
                    throw new  DirectoryNotFoundException("Unable to create directory " + directoryFile);
                }
            }

            UpgradeOldDatabaseFiles(directoryFile);

            #if __IOS__
            Foundation.NSString protection;
            switch (options.FileProtection & Foundation.NSDataWritingOptions.FileProtectionMask)
            {
            case Foundation.NSDataWritingOptions.FileProtectionNone:
                protection = Foundation.NSFileManager.FileProtectionNone;
                break;

            case Foundation.NSDataWritingOptions.FileProtectionComplete:
                protection = Foundation.NSFileManager.FileProtectionComplete;
                break;

            case Foundation.NSDataWritingOptions.FileProtectionCompleteUntilFirstUserAuthentication:
                protection = Foundation.NSFileManager.FileProtectionCompleteUntilFirstUserAuthentication;
                break;

            default:
                protection = Foundation.NSFileManager.FileProtectionCompleteUnlessOpen;
                break;
            }

            var attributes = new Foundation.NSDictionary(Foundation.NSFileManager.FileProtectionKey, protection);
            Foundation.NSError error;
            Foundation.NSFileManager.DefaultManager.SetAttributes(attributes, directoryFile.FullName, out error);
            #endif

            var scheduler = options.CallbackScheduler;
            CapturedContext = new TaskFactory(scheduler);
            workExecutor    = new TaskFactory(new SingleTaskThreadpoolScheduler());
            Log.D(TAG, "New Manager uses a scheduler with a max concurrency level of {0}".Fmt(workExecutor.Scheduler.MaximumConcurrencyLevel));

            this.NetworkReachabilityManager = new NetworkReachabilityManager();

            SharedCookieStore = new CookieStore(this.directoryFile.FullName);
            StorageType       = "SQLite";
            Shared            = new SharedState();
        }
コード例 #20
0
        private async void OnResuming(object sender, object e)
        {
            await SharedState.LogAsync("Scannit: RESUMING!");

            await SharedState.SetAsync(SharedState.IsApplicationInForeground, true);

            await Scanner.StartScanner();
        }
コード例 #21
0
ファイル: Log.cs プロジェクト: resonantworks/duality
        static Log()
        {
            SharedState state = new SharedState();

            logGame   = new Log("Game", state);
            logCore   = new Log("Core", state);
            logEditor = new Log("Edit", state);
        }
コード例 #22
0
 private DekiScriptExpressionEvaluationState(DekiScriptEnv env, DekiScriptRuntime runtime, XmlNamespaceManager namespaces, DekiScriptOutputBuffer buffer, SharedState sharedState)
 {
     this.Env        = env;
     this.Namespaces = namespaces;
     this.Buffer     = buffer;
     this.Runtime    = runtime;
     _sharedState    = sharedState;
 }
コード例 #23
0
        private async void TaskInstance_Canceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason)
        {
            await SharedState.LogAsync($"BackgroundScanner ({sender.InstanceId}): Background task cancelled. Reason: {reason}");

            _taskInstance.Canceled -= TaskInstance_Canceled;
            _taskInstance.Progress  = 0;
            _deferral.Complete();
        }
コード例 #24
0
 void EndScene()
 {
     if (currentLevel == lastLevel)
     {
         SharedState.GameComplete();
     }
     transition.DisplayTransitionAndGotoNextScene();
 }
コード例 #25
0
 public ReceiveRequest(SharedState shared, int source, int dest, int tag, Action <T> action)
 {
     this.shared = shared;
     this.source = source;
     this.dest   = dest;
     this.tag    = tag;
     this.action = action;
 }
コード例 #26
0
ファイル: Log.cs プロジェクト: Andrea/duality-withsvn-history
		static Log()
		{
			SharedState state = new SharedState();
			data = new DataLogOutput();
			logGame = new Log("Game", state, new ConsoleLogOutput(ConsoleColor.DarkGray), data);
			logCore = new Log("Core", state, new ConsoleLogOutput(ConsoleColor.DarkBlue), data);
			logEditor = new Log("Edit", state, new ConsoleLogOutput(ConsoleColor.DarkMagenta), data);
		}
コード例 #27
0
ファイル: Log.cs プロジェクト: SirePi/duality
        static Log()
        {
            SharedState state = new SharedState();

            logGame   = new Log("Game", state);
            logCore   = new Log("Core", state);
            logEditor = new Log("Edit", state);
        }
コード例 #28
0
ファイル: RenderSystem.cs プロジェクト: geirsagberg/ecs-fun
 public RenderSystem(SharedState sharedState, SpriteBatch spriteBatch, Sprites sprites) : base(Aspect.All(
                                                                                                   typeof(EntityInfo),
                                                                                                   typeof(Transform2)))
 {
     this.sharedState = sharedState;
     this.spriteBatch = spriteBatch;
     this.sprites     = sprites;
 }
コード例 #29
0
        public override Task <DiagnosticResult> Examine(SharedState history)
        {
            var xamJdks = new List <OpenJdkInfo>();

            try
            {
                var xamSdkInfo = new AndroidSdkInfo((traceLevel, msg) => Util.Log(msg), null, null, null);

                if (!string.IsNullOrEmpty(xamSdkInfo.JavaSdkPath))
                {
                    SearchDirectoryForJdks(xamJdks, xamSdkInfo.JavaSdkPath);
                }
            }
            catch (Exception ex)
            {
                Util.Exception(ex);
            }

            var jdks = xamJdks.Concat(FindJdks())
                       .GroupBy(j => j.Directory.FullName)
                       .Select(g => g.First());

            var ok = false;

            foreach (var jdk in jdks)
            {
                if ((jdk.JavaC.FullName.Contains("microsoft", StringComparison.OrdinalIgnoreCase) || jdk.JavaC.FullName.Contains("openjdk", StringComparison.OrdinalIgnoreCase)) &&
                    jdk.Version.IsCompatible(Version, RequireExact ? Version : null))
                {
                    ok = true;
                    ReportStatus($"{jdk.Version} ({jdk.Directory})", Status.Ok);
                    history.SetEnvironmentVariable("JAVA_HOME", jdk.Directory.FullName);

                    // Try and set the global env var on windows if it's not set
                    if (Util.IsWindows && string.IsNullOrEmpty(Environment.GetEnvironmentVariable("JAVA_HOME")))
                    {
                        try
                        {
                            Environment.SetEnvironmentVariable("JAVA_HOME", jdk.Directory.FullName, EnvironmentVariableTarget.Machine);
                            ReportStatus($"Set Environment Variable: JAVA_HOME={jdk.Directory.FullName}", Status.Ok);
                        } catch { }
                    }
                }
                else
                {
                    ReportStatus($"{jdk.Version} ({jdk.Directory.FullName})", null);
                }
            }

            if (ok)
            {
                return(Task.FromResult(DiagnosticResult.Ok(this)));
            }

            return(Task.FromResult(new DiagnosticResult(Status.Error, this,
                                                        new Suggestion("Install OpenJDK11",
                                                                       new BootsSolution(Manifest?.Check?.OpenJdk?.Url, "Download and Install Microsoft OpenJDK 11")))));
        }
コード例 #30
0
ファイル: Log.cs プロジェクト: Scottyaim/duality
		static Log()
		{
			SharedState state = new SharedState();
			data = new DataLogOutput();

			logGame		= new Log("Game", state, data);
			logCore		= new Log("Core", state, data);
			logEditor	= new Log("Edit", state, data);
		}
コード例 #31
0
ファイル: ProjectileSwitch.cs プロジェクト: qwook/hungry
 protected ProjectileSwitch(RenderSet render_set, double x, double y,
                        ActionEventHandler state_changed,
                        SharedState<SwitchState> state,
                        SharedState<double> latch_expiration,
                        Stopwatch latch_timer, double latch_time)
     : base(render_set, x, y, state_changed, state, latch_expiration, latch_timer, latch_time, Texture.Get("sprite_projectile_switch"))
 {
     Theta = 0.0;
 }
コード例 #32
0
        public DotNetWorkloadsCheckup(SharedState sharedState, string sdkVersion, Manifest.DotNetWorkload[] requiredWorkloads, params string[] nugetPackageSources) : base()
        {
            var dotnet = new DotNetSdk(sharedState);

            SdkRoot             = dotnet.DotNetSdkLocation.FullName;
            SdkVersion          = sdkVersion;
            RequiredWorkloads   = requiredWorkloads;
            NuGetPackageSources = nugetPackageSources;
        }
コード例 #33
0
        public DotNetPacksCheckup(SharedState sharedState, string sdkVersion, Manifest.DotNetSdkPack[] requiredPacks, params string[] nugetPackageSources) : base()
        {
            var dn = new DotNetSdk(sharedState);

            SdkRoot             = dn.DotNetSdkLocation.FullName;
            SdkVersion          = sdkVersion;
            RequiredPacks       = requiredPacks;
            NuGetPackageSources = nugetPackageSources;
        }
コード例 #34
0
        private Services CreateAllSharedState(BouncyShooterOptions options)
        {
            var ss = new SharedState
            {
                ActorTypesCount = options.ActorTypesCount,
                BulletSpeed     = options.BulletSpeed,
                FireTimeout     = 1f / options.RateOfFire,
                ActorsCount     = options.ActorsCount,
                ActorSpeed      = options.ActorSpeed,
                BulletLifeTime  = options.BulletLifeTime,
                ActorRadius     = options.ActorRadius,
                BulletRadius    = options.BulletRadius
            };

            var allShared = new Services()
            {
                TimeService   = new TimeService(),
                ActorService  = new ActorService(),
                BulletService = new BulletService(),
                SharedState   = ss
            };

            if (options.IsRendering)
            {
                var bullet            = options.BulletPrefab;
                var bulletViewService = new BulletViewService()
                {
                    Pool = new Pool <Transform>(
                        () =>
                    {
                        var tr = Object.Instantiate(bullet).transform;
                        tr.gameObject.SetActive(false);
                        return(tr);
                    }, 2),
                    Views = new Dictionary <int, Transform>()
                };
                var actor = options.ShooterPrefab;

                var actorViewService = new ActorViewService()
                {
                    Pool = new Pool <Transform>(
                        () =>
                    {
                        var tr = Object.Instantiate(actor).transform;
                        tr.gameObject.SetActive(false);
                        return(tr);
                    }, 2),
                    Views = new Dictionary <int, Transform>()
                };

                allShared.ActorViewService  = actorViewService;
                allShared.BulletViewService = bulletViewService;
            }

            return(allShared);
        }
コード例 #35
0
ファイル: LevelManager.cs プロジェクト: mottatta/FarmHeroes
 void OnEverySecond()
 {
     countSeconds++;
     if (countSeconds >= durationToProgress)
     {
         countSeconds = 0;
         SharedState.SubmitProgress();
     }
     Invoke("OnEverySecond", 1f);
 }
コード例 #36
0
ファイル: ControlSystem.cs プロジェクト: geirsagberg/ecs-fun
 public ControlSystem(SharedState sharedState, MouseListener mouseListener,
                      Random random, GraphicsDeviceManager graphics, Sprites sprites) : base(Aspect.All(typeof(Transform2),
                                                                                                        typeof(EntityInfo)))
 {
     this.sharedState            = sharedState;
     this.random                 = random;
     this.graphics               = graphics;
     this.sprites                = sprites;
     mouseListener.MouseClicked += OnMouseClicked;
 }
コード例 #37
0
 //--- Constructor ---
 public DekiScriptExpressionEvaluationState(DekiScriptEvalMode mode, DekiScriptEnv env, DekiScriptRuntime runtime, TimeSpan evaluationTimeout, int maxOutputBufferSize) {
     this.Env = env;
     this.Namespaces = new XmlNamespaceManager(XDoc.XmlNameTable);
     this.Buffer = new DekiScriptOutputBuffer(maxOutputBufferSize);
     this.Runtime = runtime;
     _sharedState = new SharedState();
     _sharedState.Safe = (mode == DekiScriptEvalMode.EvaluateSafeMode);
     if(evaluationTimeout == TimeSpan.MaxValue) {
         return;
     }
     _sharedState.EvaluationTimeout = evaluationTimeout;
     _sharedState.EvaluationTimer = Stopwatch.StartNew();
 }
コード例 #38
0
ファイル: Log.cs プロジェクト: KETMGaming/duality
		static Log()
		{
			SharedState state = new SharedState();
			data = new DataLogOutput();
			logGame		= new Log("Game", state, data);
			logCore		= new Log("Core", state, data);
			logEditor	= new Log("Edit", state, data);

			bool hasConsole = true;
			try
			{
				int doesThisThrow = Console.WindowHeight;
			}
			catch (Exception)
			{
				hasConsole = false;
			}
			if (System.Diagnostics.Debugger.IsAttached || hasConsole)
			{
				logGame.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkGray));
				logCore.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkBlue));
				logEditor.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkMagenta));
			}
		}
コード例 #39
0
 public Job(SharedState sharedState)
 {
     _sharedState = sharedState;
 }
コード例 #40
0
ファイル: SmallGateway.cs プロジェクト: Apelsin/positron
 protected SmallGateway(RenderSet render_set, double x, double y, SharedState<bool> sync_state)
     : base(render_set, x, y, sync_state, Texture.Get("sprite_mini_gate"))
 {
     Open = new SpriteAnimation(Texture, 50, false, "closed", "opening_1", "opening_2", "open");
     Close = new SpriteAnimation(Texture, 50, false, "open", "opening_2", "opening_1", "closed");
 }
コード例 #41
0
ファイル: MainGame.cs プロジェクト: clewerton/projetoracexna
        private void StartSharedState()
        {
            var sharedState = new SharedState();

            // se registra como serviço
            Services.AddService(typeof(ISharedState), sharedState);
        }
コード例 #42
0
ファイル: HFTSite.cs プロジェクト: greggman/hft-unity-gamepad
 public Informer(HFTLog log, SharedState sharedState, string url, string domain)
 {
     sharedState_ = sharedState;
     log_ = log;
     url_ = url;
     domain_ = domain;
 }