void OnEnable() { GameObject managerObject = GameObject.Find("IOManager"); m_ioManager = managerObject.GetComponent<IOManager>(); Levels = m_ioManager.GetLevelsInDirectory(Application.dataPath + "/Levels/"); LoadedLevel = null; }
public Player(IOManager io) { Inventory = new Inventory(this); IO = io; if(IO == null) { IO = new ConsoleIOManager(); } }
protected Command(string input, string[] data, Tester judge, StudentsRepository repository, DownloadManager downloadManager, IOManager inputOutputManager) { this.Input = input; this.Data = data; this.judge = judge; this.repository = repository; this.downloadManager = downloadManager; this.inputOutputManager = inputOutputManager; }
public void GameStartUp() { ObjectPool = (GameObject.Instantiate(Resources.Load("Prefabs/System/GameObjectPool")) as GameObject).GetComponent<GameObjectPool>(); IOManager = (GameObject.Instantiate(Resources.Load("Prefabs/System/IOManager")) as GameObject).GetComponent<IOManager>(); UICore = (GameObject.Instantiate(Resources.Load("Prefabs/UI/UIRoot")) as GameObject).GetComponent<UICore>(); GameState = new GameStateHandler(); GameState.Initialize(); PlayerInfo = new PlayerInfo(); EventManager = new EventManager(); }
void Awake() { if (Instance != null) { Debug.LogError("Error: IOManager singleton already exists."); } Instance = this; }
public ChangeAbsolutePathCommand(string input, string[] data, Tester judge, StudentsRepository repository, DownloadManager downloadManager, IOManager inputOutputManager) : base(input, data, judge, repository, downloadManager, inputOutputManager) { }
/// <summary> /// Set I/O manager implementation to use for file/directory reference initialization. /// </summary> /// <param name="impl">I/O manager implementation to use.</param> public static void SetImplementation(IOManager impl) { implementation = impl; }
void Awake() { _manager = this; }
public override void Solve(IOManager io) { var n = io.ReadInt(); var m = io.ReadInt(); var myMonsters = LoadMonsters(io, n); var helpMonsters = LoadMonsters(io, m); myMonsters.Sort(); var maxPower = myMonsters.Reverse().Take(5).Sum(mo => mo.Power); var dp = Enumerable.Repeat(0, 6).Select(_ => { var d = new int[maxPower + 1]; d.Fill(1 << 29); return(d); }).ToArray(); dp[0][0] = 0; for (int i = 0; i < myMonsters.Length; i++) { for (int selected = dp.Length - 1; selected >= 1; selected--) { var length = maxPower - myMonsters[i].Power + 1; var current = dp[selected].AsSpan(myMonsters[i].Power, length); var last = dp[selected - 1].AsSpan(0, length); var toAdd = new Vector <int>(myMonsters[i].Weight); int p; for (p = 0; p + Vector <int> .Count <= current.Length; p += Vector <int> .Count) { var lastSpan = last.Slice(p); var currentSpan = current.Slice(p); var lastV = new Vector <int>(lastSpan); var currentV = new Vector <int>(currentSpan); var added = lastV + toAdd; var comp = Vector.LessThan(added, currentV); var result = Vector.ConditionalSelect(comp, added, currentV); result.CopyTo(currentSpan); } if (p != current.Length) { for (; p < current.Length; p++) { current[p].ChangeMin(last[p] + myMonsters[i].Weight); } } } } double max = 0; for (int p = 1; p <= maxPower; p++) { max.ChangeMax((double)p / dp[5][p]); for (int i = 0; i < helpMonsters.Length; i++) { var weight = dp[4][p] + helpMonsters[i].Weight; var power = p + helpMonsters[i].Power; max.ChangeMax((double)power / weight); } } io.WriteLine(max); }
public TraverseFoldersCommand(string input, string[] data, Tester tester, StudentsRepository repository, DownloadManager downloadManager, IOManager ioManager) : base(input, data, tester, repository, downloadManager, ioManager) { }
public MakeDirectoryCommand(string input, string[] data, Tester judge, StudentsRepository repo, IOManager ioManager) : base(input, data, judge, repo, ioManager) { }
public ReadDatabaseCommand(Tester judge, StudentsRepository repository, IOManager inputOutputManager, string[] data, string input) : base(judge, repository, inputOutputManager, data, input) { }
public GetHelpCommand(string input, string[] data, Tester junge, StudentsRepository repository, IOManager inputOutputManager) : base(input, data, junge, repository, inputOutputManager) { }
public TraverseFoldersCommand(Tester judge, StudentsRepository repository, IOManager inputOutputManager, string[] data, string input) : base(judge, repository, inputOutputManager, data, input) { }
protected override void SolveEach(IOManager io) { throw new NotImplementedException(); }
public PrintFilteredStudentsCommand(string input, string[] data, Tester judge, StudentsRepository repository, IOManager inputOutputManager) : base(input, data, judge, repository, inputOutputManager) { }
public override void Solve(IOManager io) { throw new NotImplementedException(); }
public async Task <HttpResponseMessage> GetStudyInstances(HttpRequestMessage requestMessage, string requestType, string studyUID, string seriesUID, string objectUID, string contentType = null, string charset = null, string transferSyntax = null, string anonymize = null) { //we do not handle anonymization if (anonymize == "yes") { return(requestMessage.CreateErrorResponse(HttpStatusCode.NotAcceptable, String.Format("anonymise is not supported on the server", contentType))); } //we extract the content types from contentType value string[] contentTypes; bool canParseContentTypeParameter = ExtractContentTypesFromContentTypeParameter(contentType, out contentTypes); if (!canParseContentTypeParameter) { return(requestMessage.CreateErrorResponse(HttpStatusCode.NotAcceptable, String.Format("contentType parameter (value: {0}) cannot be parsed", contentType))); } //8.1.5 The Web Client shall provide list of content types it supports in the "Accept" field of the GET method. The //value of the contentType parameter of the request shall be one of the values specified in that field. string[] acceptContentTypesHeader = requestMessage.Headers.Accept.Select(header => header.MediaType).ToArray(); // */* means that we accept everything for the content Header bool acceptAllTypesInAcceptHeader = acceptContentTypesHeader.Contains("*/*"); bool isRequestedContentTypeCompatibleWithAcceptContentHeader = acceptAllTypesInAcceptHeader || contentTypes == null || acceptContentTypesHeader.Intersect( contentTypes).Any(); if (!isRequestedContentTypeCompatibleWithAcceptContentHeader) { return(requestMessage.CreateErrorResponse(HttpStatusCode.NotAcceptable, String.Format("content type {0} is not compatible with types specified in Accept Header", contentType))); } //6.3.2.1 The MIME type shall be one on the MIME types defined in the contentType parameter, preferably the most //desired by the Web Client, and shall be in any case compatible with the ‘Accept’ field of the GET method. //Note: The HTTP behavior is that an error (406 – Not Acceptable) is returned if the required content type cannot //be served. string[] compatibleContentTypesByOrderOfPreference = GetCompatibleContentTypesByOrderOfPreference(contentTypes, acceptContentTypesHeader); //if there is no type that can be handled by our server, we return an error if (compatibleContentTypesByOrderOfPreference != null && !compatibleContentTypesByOrderOfPreference.Contains(JpegImageContentType) && !compatibleContentTypesByOrderOfPreference.Contains(AppDicomContentType)) { return(requestMessage.CreateErrorResponse(HttpStatusCode.NotAcceptable, String.Format("content type(s) {0} cannot be served", String.Join(" - ", compatibleContentTypesByOrderOfPreference) ))); } //we now need to handle the case where contentType is not specified, but in this case, the default value //depends on the image, so we need to open it string dicomImagePath = _dicomImageFinderService.GetImageByInstanceUid(objectUID); if (dicomImagePath == null) { return(requestMessage.CreateErrorResponse(HttpStatusCode.NotFound, "no image found")); } try { IOManager.SetImplementation(DesktopIOManager.Instance); DicomFile dicomFile = await DicomFile.OpenAsync(dicomImagePath); string finalContentType = PickFinalContentType(compatibleContentTypesByOrderOfPreference, dicomFile); return(ReturnImageAsHttpResponse(dicomFile, finalContentType, transferSyntax)); } catch (Exception ex) { Trace.TraceError("exception when sending image: " + ex.ToString()); return(requestMessage.CreateErrorResponse(HttpStatusCode.InternalServerError, "server internal error")); } }
public ChangePathAbsoluteCommand(string input, string[] data, Tester judge, StudentsRepository repository, IOManager inputOutputManager) : base(input, data, judge, repository, inputOutputManager) { }
/// <summary> /// Initializes the static fields of <see cref="DesktopIOManager"/> /// </summary> static DesktopIOManager() { Instance = new DesktopIOManager(); }
public DropDatabaseCommand(string input, string[] data, Tester judge, StudentsRepository repository, IOManager inputOutputManager) : base(input, data, judge, repository, inputOutputManager) { }
public IOManager provideIOManager() { return mIOManager ?? (mIOManager = new IOManager()); }
public TraverseFoldersCommand(string input, string[] data, Tester judge, StudentsRepository repository, IOManager inputOutputManager) : base(input, data, judge, repository, inputOutputManager) { }
public override void Initialize() { childComponents = new List<GameObject>(); ioManager = new IOManager(); font = gameRef.Content.Load<SpriteFont>("SpriteFont1"); platform = new Platform(new Rectangle(18, 40, 445, 650), gameRef.Content); guage = new Guage(new Rectangle(platform.Position.X + platform.Position.Width + 2, 40, 100, 650), gameRef.Content); Vector2 startingPos = platform.getMidPoint(); player = new Munchlit(new Rectangle((int)startingPos.X, (int)startingPos.Y, 20, 20), gameRef.Content); childComponents.Add(platform); childComponents.Add(guage); childComponents.Add(player); for (int i = platform.Position.X + 12; i <= platform.Position.X + platform.Position.Width - 24; i += 30) { childComponents.Add(new Meteor(new Rectangle(i, platform.Position.Y + platform.Position.Height - 45, 30, 30), gameRef.Content, 0)); childComponents.Add(new Meteor(new Rectangle(i, platform.Position.Y + platform.Position.Height - 75, 30, 30), gameRef.Content, 0)); childComponents.Add(new Meteor(new Rectangle(i, platform.Position.Y + platform.Position.Height - 105, 30, 30), gameRef.Content, 0)); } guiManager.AddLabel("HighScore", font, "Highscore: " + 0); guiManager["HighScore"].Position = new Vector2(guage.Position.X + guage.Position.Width + 10, 40.0f); guiManager["HighScore"].Size = new Vector2(200.0f, 75.0f); guiManager["HighScore"].Color = Color.Black; guiManager.AddLabel("level", font, "Level: " + level); guiManager["level"].Position = new Vector2(platform.Position.X + platform.Position.Width / 3 + 20, 10.0f); guiManager["level"].Size = new Vector2(150, 20.0f); guiManager["level"].Color = Color.Black; guiManager.AddLabel("time", font, "Timer: " + timer); guiManager["time"].Position = new Vector2(guage.Position.X + guage.Position.Width + 10, 70.0f); guiManager["time"].Size = new Vector2(200.0f, 75.0f); guiManager["time"].Color = Color.Black; guiManager.AddLabel("lives", font, "Lives: " + player.Lives); guiManager["lives"].Position = new Vector2(guage.Position.X + guage.Position.Width + 10, 100.0f); guiManager["lives"].Size = new Vector2(150.0f, 20.0f); guiManager["lives"].Color = Color.Black; guiManager.AddLabel("points", font, "Points: " + player.Point); guiManager["points"].Position = new Vector2(guage.Position.X + guage.Position.Width + 10, 130.0f); guiManager["points"].Size = new Vector2(150.0f, 20.0f); guiManager["points"].Color = Color.Black; guiManager.AddPicture("tmp", gameRef.Content.Load<Texture2D>("Freezling")); guiManager["tmp"].Position = new Vector2(guage.Position.X + guage.Position.Width + 30, 200.0f); guiManager["tmp"].Size = new Vector2(200.0f, 200.0f); guiManager.AddButton("pause", "PAUSE", guage.Position.X + guage.Position.Width + 10, 400, 200.0f, 75.0f); guiManager.AddButton("btnMainMenu", "Menu", guage.Position.X + guage.Position.Width + 10, 500, 200.0f, 75.0f); guiManager.AddButton("btnExit", "Exit", guage.Position.X + guage.Position.Width + 10, 600, 200.0f, 75.0f); btnMainMenu = guiManager["btnMainMenu"] as Button; btnMainMenu.Click += (control, button) => { GameState MainMenu = this.parent[GameStateType.Playing]; if (MainMenu != null) { this.parent.PushState(MainMenu); MainMenu MainMenuState = new MainMenu(this.gameRef, this.renderer, this.parent); MainMenu.Initialize(); this.parent.PushState(MainMenuState); } }; btnExit = guiManager["btnExit"] as Button; btnExit.Click += (control, button) => { gameRef.Exit(); }; try { highScore = ioManager.LoadHighScore(); } catch (Exception) { ioManager.SaveHighScore(0); highScore = 0; } }
public GetHelpCommand(Match match, Tester judge, StudentsRepository repository, IOManager inputOutputManager) : base(match, judge, repository, inputOutputManager) { }
void Start() { ioManager = GameObject.FindGameObjectWithTag ( "IOManager" ).GetComponent<IOManager> (); paneManager = GameObject.FindGameObjectWithTag ( "PaneManager" ).GetComponent<PaneManager> (); }
protected Command(string input, string[] data, Tester judge, StudentsRepository repository, IOManager inputOutputManager) { this.Input = input; this.Data = data; this.judge = judge; this.repository = repository; this.inputOutputManager = inputOutputManager; }
void Start() { screenArea = new Rect (0, 0, Screen.width, Screen.height); iManager = GameObject.FindGameObjectWithTag ( "IManager" ).GetComponent<IManager> (); ioManager = GameObject.FindGameObjectWithTag ( "IOManager" ).GetComponent<IOManager> (); transactionWindowPosition = new Rect ( screenArea.x, screenArea.y + 100, screenArea.width, screenArea.height - 100 ); historyWindowPosition = new Rect ( screenArea.x, -screenArea.height + 100, screenArea.width, screenArea.height ); scrollPosition = new Vector2 ( scrollPosition.x, Mathf.Infinity ); }
public ReadDatabaseCommand(string input, string[] data, Tester tester, StudentRepository repo, IOManager iOManager) : base(input, data, tester, repo, iOManager) { }
public PrintFilteredStudentsCommand(string input, string[] data, Tester judge, StudentsRepository repository, DownloadManager downloadManager, IOManager inputOutputManager) : base(input, data, judge, repository, downloadManager, inputOutputManager) { }
/// <summary> /// /// </summary> /// <param name="w"></param> public override void Work(BackgroundWorker w) { // settings if (Settings == null) { Settings = new ModelImportSettings(); } if (IOSettings == null) { IOSettings = new ImportSettings(); } _cache.POBJGen.UseTriangleStrips = Settings.UseStrips; _cache.POBJGen.UseVertexAlpha = Settings.ImportVertexAlpha; _cache.FolderPath = Path.GetDirectoryName(FilePath); // import model ProgressStatus = "Importing Model Data..."; w.ReportProgress(0); var scene = IOManager.LoadScene(FilePath, IOSettings); var model = scene.Models[0]; // process nodes ProgressStatus = "Processing Joints..."; w.ReportProgress(30); HSD_JOBJ root = null; foreach (var r in model.Skeleton.RootBones) { if (root == null) { root = IOBoneToJOBJ(r); } else { root.Add(IOBoneToJOBJ(r)); } } if (root == null) { root = IOBoneToJOBJ( new IOBone() { Name = "Root" }); } // get root of skeleton root.Flags = JOBJ_FLAG.SKELETON_ROOT; // process mesh ProgressStatus = "Processing Mesh..."; foreach (var mesh in model.Meshes) { ProcessMesh(scene, mesh, root); if (root.Dobj != null) { ProgressStatus = $"Processing Mesh {root.Dobj.List.Count} {model.Meshes.Count + 1}..."; w.ReportProgress((int)(30 + 60 * (root.Dobj.List.Count / (float)model.Meshes.Count))); } } // set flags if (_cache.EnvelopedJOBJs.Count > 0) { root.Flags |= JOBJ_FLAG.ENVELOPE_MODEL; } // enable xlu if anything needs it if (_cache.HasXLU) { root.Flags |= JOBJ_FLAG.XLU | JOBJ_FLAG.TEXEDGE; } // just always enable opaque root.Flags |= JOBJ_FLAG.OPA; // calculate inverse binds foreach (var jobj in _cache.EnvelopedJOBJs) { ProgressStatus = "Generating Inverse Transforms..."; if (_cache.jobjToWorldTransform.ContainsKey(jobj)) { jobj.InverseWorldTransform = Matrix4ToHSDMatrix(_cache.jobjToWorldTransform[jobj].Inverted()); } } // SAVE POBJ buffers ProgressStatus = "Generating and compressing vertex buffers..."; w.ReportProgress(90); _cache.POBJGen.SaveChanges(); // done NewModel = root; // update flags JOBJTools.UpdateJOBJFlags(NewModel); #if DEBUG if (Settings.Merge) { JOBJTools.MergeIntoOneObject(NewModel); } #endif ProgressStatus = "Done!"; w.ReportProgress(100); }