public void EnumPortsMultipleTimes() { var debugSessionIds = new[] { "session1", "session2" }; _metrics.NewDebugSessionId().Returns(debugSessionIds[0], debugSessionIds[1]); var gamelet = new Gamelet { Id = "test id1" }; _gameletClient.ListGameletsAsync(onlyOwned: false) .Returns(x => Task.FromResult(new List <Gamelet> { gamelet })); foreach (string sessionId in debugSessionIds) { var port = Substitute.For <IDebugPort2>(); _debugPortFactory.Create(gamelet, _portSupplier, sessionId).Returns(port); Assert.AreEqual(VSConstants.S_OK, _portSupplier.EnumPorts(out IEnumDebugPorts2 portsEnum)); var ports = new IDebugPort2[1]; uint numFetched = 0; Assert.AreEqual(VSConstants.S_OK, portsEnum.Next((uint)ports.Length, ports, ref numFetched)); Assert.AreEqual(1, numFetched); Assert.AreSame(ports[0], port); AssertMetricRecorded(DeveloperEventType.Types.Type.VsiGameletsList, DeveloperEventStatus.Types.Code.Success, sessionId); } }
public void AddPort() { var request = Substitute.For <IDebugPortRequest2>(); string portName = "test port"; request.GetPortName(out string _).Returns(x => { x[0] = portName; return(VSConstants.S_OK); }); var gamelet = new Gamelet { Id = "test id" }; _gameletClient.LoadByNameOrIdAsync(portName).Returns(gamelet); var port = Substitute.For <IDebugPort2>(); _debugPortFactory.Create(gamelet, _portSupplier, _testDebugSessionId).Returns(port); Assert.AreEqual(VSConstants.S_OK, _portSupplier.AddPort(request, out IDebugPort2 debugPort)); Assert.AreEqual(port, debugPort); AssertMetricRecorded(DeveloperEventType.Types.Type.VsiGameletsGet, DeveloperEventStatus.Types.Code.Success); }
protected override void Initialize() { TTengineMaster.Create(this); // open the TTMusicEngine musicEngine = MusicEngine.GetInstance(); musicEngine.AudioPath = "Content"; if (!musicEngine.Initialize()) { throw new Exception(musicEngine.StatusMsg); } // from here on, main screen mainScreenlet = new PixieScreenlet(myWindowWidth, myWindowHeight); TTengineMaster.ActiveScreen = mainScreenlet; TreeRoot = new FixedTimestepPhysics(); TreeRoot.Add(mainScreenlet); // debug only debugMsg = new DebugMessage(""); //mainScreenlet.Add(debugMsg); // finally call base to enumnerate all (gfx) Game components to init base.Initialize(); }
public override void OnUpdate(Gamelet g, ref UpdateParams p) { base.OnUpdate(g, ref p); if (SimTime > 1f && !isFirstDraw) { // suppress drawing during play of another game - save resources and avoid gfx conflicts. GardenGame.Instance.SuppressDraw(); } // check keyboard - if esc, get back to garden state if (loadingDisplay.isExiting) { loadingDisplay.timeExiting += p.Dt; if (loadingDisplay.timeExiting > TIME_ESC_PRESS_TO_EXIT) { loadingDisplay.willExitSoon = true; } } // perform real exit operation (abort launcher task) when ESC released if (!loadingDisplay.isExiting && loadingDisplay.willExitSoon) { GardenGame.Instance.launcher.Abort(); loadingDisplay.willExitSoon = false; } }
public void AddPortMultipleTimes() { var debugSessionIds = new[] { "session1", "session2" }; _metrics.NewDebugSessionId().Returns(debugSessionIds[0], debugSessionIds[1]); var request = Substitute.For <IDebugPortRequest2>(); string portName = "test port"; request.GetPortName(out string _).Returns(x => { x[0] = portName; return(VSConstants.S_OK); }); var gamelet = new Gamelet { Id = "test id" }; _gameletClient.LoadByNameOrIdAsync(portName).Returns(gamelet); foreach (string sessionId in debugSessionIds) { var port = Substitute.For <IDebugPort2>(); _debugPortFactory.Create(gamelet, _portSupplier, sessionId).Returns(port); Assert.AreEqual(VSConstants.S_OK, _portSupplier.AddPort(request, out IDebugPort2 debugPort)); Assert.AreSame(port, debugPort); AssertMetricRecorded(DeveloperEventType.Types.Type.VsiGameletsGet, DeveloperEventStatus.Types.Code.Success, sessionId); } }
public override void OnExit(Gamelet g) { base.OnExit(g); GardenGame.Instance.IsMouseVisible = false; if (fadeInMusicWhenDone) GardenGame.Instance.music.FadeIn(); }
async Task CustomCommandAsync(IAsyncProject project, Gamelet gamelet, DataRecorder record, string command) { var startInfo = new ProcessStartInfo { FileName = Path.Combine(Environment.SystemDirectory, YetiConstants.Command), Arguments = $"/C \"{command}\"", WorkingDirectory = await project.GetAbsoluteRootPathAsync(), }; startInfo.EnvironmentVariables[GgpInstanceIdName] = gamelet.Id; Stopwatch stopwatch = Stopwatch.StartNew(); using (IProcess process = _managedProcessFactory.CreateVisible(startInfo, int.MaxValue)) { try { await process.RunToExitWithSuccessAsync(); record.CustomDeploy(stopwatch.ElapsedMilliseconds, DataRecorder.NoError); } catch (ProcessException e) { Trace.WriteLine("Error running custom deploy command: " + e); record.CustomDeploy(stopwatch.ElapsedMilliseconds, e); throw new DeployException( ErrorStrings.ErrorRunningCustomDeployCommand(e.Message), e); } } }
// check ball2ball and ball2ship collisions public void OnCollision(Gamelet sender, GameletEventArgs e) { /* if (e.otherItem is Ball && Parent is Ball) { Ball parentBall = Parent as Ball; Ball collidingBall = e.otherItem as Ball; if (parentBall.nrgCharge != null) { isEndOfLifeMode = true; Charged = false; } } */ if (e.otherItem is Ship && !isEndOfLifeMode ) { Ship ship = e.otherItem as Ship; // uncouple from my parent (whatever it was) LinkedToParent = false; Position = Parent.PositionAbsolute; // reduce velocity Velocity = new Vector2(Parent.Velocity.X * 0.75f, Parent.Velocity.Y * 0.75f); isEndOfLifeMode = true; Charged = false; // score ship.player.Score += 100.0f; // energy increaes ship.player.NRG += 2.0f; // TODO } }
public override void OnUpdate(Gamelet g, ref UpdateParams p) { base.OnUpdate(g, ref p); int phase = (int)Math.Round((SimTime * 2f) % 3.0f); string t = "Loading \"" + loadingDisplay.game.Name + "\""; switch (phase) { case 0: t += " ."; break; case 1: t += " .."; break; case 2: t += " ..."; break; } loadingDisplay.tbox.Text = t; if (loadingDisplay.nextStateTimer >= 0f && SimTime > loadingDisplay.nextStateTimer) { loadingDisplay.nextStateTimer = -1f; g.SetNextState(new StateLoadingDisplay_Playing(loadingDisplay)); } loadingDisplay.helpTextBox.Text = loadingDisplay.game.HelpText; }
public void Gamelet(Gamelet gamelet) { _action.UpdateEvent(new DeveloperLogEvent { GameletData = Metrics.GameletData.FromGamelet(gamelet) }); }
bool PromptToDeleteLaunch(GgpGrpc.Models.GameLaunch currentGameLaunch, List <Gamelet> gamelets, Gamelet selectedGamelet, ActionRecorder actionRecorder, string testAccount, string devAccount) { if (currentGameLaunch.GameLaunchState == GameLaunchState.IncompleteLaunch) { return(true); } bool thisInstance = selectedGamelet.Name == currentGameLaunch.GameletName; string instanceName = gamelets .SingleOrDefault(g => g.Name == currentGameLaunch.GameletName)?.DisplayName; bool okToStop = actionRecorder.RecordUserAction(ActionType.GameLaunchStopPrompt, () => _dialogUtil.ShowYesNo( ErrorStrings.LaunchExistsDialogText( thisInstance, instanceName, testAccount, devAccount), ErrorStrings.StopRunningGame)); if (!okToStop) { // Developer opted to not stop the existing launch. // Launch can not proceed. return(false); } return(true); }
public async Task LaunchIncorrectTestAccountAsync() { _project.GetTestAccountAsync().Returns("wrong"); var gamelet = new Gamelet { Id = _testGameletId, Name = _testGameletName, IpAddr = _testGameletIp, State = GameletState.Reserved, }; _gameletClient.ListGameletsAsync().Returns( Task.FromResult(new List <Gamelet> { gamelet })); var testAccountClient = Substitute.For <ITestAccountClient>(); testAccountClient.LoadByIdOrGamerTagAsync(_testOrganizationId, _testProjectId, "wrong") .Returns(Task.FromResult(new List <TestAccount>())); _testAccountClientFactory.Create(Arg.Any <ICloudRunner>()).Returns(testAccountClient); var launchSettings = await QueryDebugTargetsAsync(0); Assert.AreEqual(0, launchSettings.Count); AssertMetricRecorded(DeveloperEventType.Types.Type.VsiDebugSetupQueries, DeveloperEventStatus.Types.Code.InvalidConfiguration); }
List <string> ReadMountsContentOrDefault(Gamelet gamelet, ActionRecorder actionRecorder) { List <string> content = new List <string>(); ICancelableTask getMountsTask = _cancelableTaskFactory.Create(TaskMessages.CheckingMountInfo, async _ => { content = await _remoteCommand.RunWithSuccessCapturingOutputAsync( new SshTarget(gamelet), ReadMountsCmd) ?? new List <string>(); }); try { getMountsTask.RunAndRecord(actionRecorder, ActionType.GameletReadMounts); return(content); } catch (ProcessException e) { Trace.WriteLine($"Error reading /proc/mounts file: {e.Message}"); _dialogUtil.ShowError(ErrorStrings.FailedToStartRequiredProcess(e.Message), e.ToString()); return(content); } finally { string joinedContent = string.Join("\n\t", content); Trace.WriteLine($"Gamelet /proc/mounts:{Environment.NewLine}{joinedContent}"); } }
void SelectInstance() { List <Gamelet> instances = ListInstances(); if (instances == null) { return; } SortInstancesByReserver(instances); _instance = _instanceSelectionWindowFactory.Create(instances).Run(); if (_instance == null) { return; } RefreshInstanceLabel(); if (!EnableSsh()) { return; } RefreshCoreList(); }
public void EnumProcessesError() { var gamelet = new Gamelet { Id = _testGameletId, IpAddr = _testGameletIp }; var port = _portFactory.Create(gamelet, _portSupplier, _testDebugSessionId); _sshManager.EnableSshAsync(gamelet, Arg.Any <IAction>()).Returns(Task.FromResult(true)); _processListRequest.When(x => x.GetBySshAsync(new SshTarget(_testGameletTarget))) .Do(x => { throw new ProcessException("test exception"); }); Assert.AreEqual(VSConstants.S_OK, port.EnumProcesses(out IEnumDebugProcesses2 processesEnum)); Assert.AreEqual(VSConstants.S_OK, processesEnum.GetCount(out uint count)); Assert.AreEqual(0, count); _dialogUtil.Received().ShowError(Arg.Is <string>(x => x.Contains("test exception")), Arg.Any <string>()); AssertMetricRecorded(DeveloperEventType.Types.Type.VsiGameletsEnableSsh, DeveloperEventStatus.Types.Code.Success); AssertMetricRecorded(DeveloperEventType.Types.Type.VsiProcessList, DeveloperEventStatus.Types.Code.ExternalToolUnavailable); }
public override void OnUpdate(Gamelet g, ref UpdateParams p) { base.OnUpdate(g, ref p); // fade in loadingDisplay.iggNameBox.ColorB.FadeTarget = 1.0f; if (SimTime <= 1f || isFirstDraw) { loadingDisplay.tbox.Text = " Enjoy \"" + loadingDisplay.game.Name + "\""; } else { // suppress drawing during play of another game - save resources and avoid gfx conflicts. GardenGame.Instance.SuppressDraw(); } if (SimTime > TIME_SHOW_PLAYING_MESSAGE) { g.SetNextState(new StateLoadingDisplay_Empty(loadingDisplay)); } // check keyboard - if esc, get back to garden state if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { g.SetNextState(new StateBrowsingMenu()); } }
public async Task EnableSshAsync(Gamelet gamelet, Metrics.IAction action) { var sshKey = await sshKeyLoader.LoadOrCreateAsync(); sshKnownHostsWriter.CreateOrUpdate(gamelet); action.UpdateEvent(new DeveloperLogEvent { GameletData = GameletData.FromGamelet(gamelet) }); // Try to optimistically connect, but only if we already have a key file. try { await remoteCommand.RunWithSuccessAsync(new SshTarget(gamelet), "/bin/true"); return; } catch (ProcessException e) { Trace.WriteLine("Optimistic SSH check failed; fallback to calling EnableSSH; " + "error: " + e.ToString()); } // Generate a new key, if necessary, and upload it to the gamelet. var gameletClient = gameletClientFactory.Create(cloudRunner.Intercept(action)); await gameletClient.EnableSshAsync(gamelet.Id, sshKey.PublicKey); }
public Task <GgpGrpc.Models.GameLaunch> GetGameLaunchStateAsync(string gameLaunchName) { GgpGrpc.Models.GameLaunch launch = null; if (gameLaunchName.EndsWith("current")) { Gamelet instanceInUse = _instances.Find(i => i.State == GameletState.InUse); if (instanceInUse != null) { launch = _launchesByInstance[instanceInUse.Name]; } } else { launch = _launchesByInstance.Values.ToList().Find(l => l.Name == gameLaunchName); } if (launch == null) { var rpcException = new RpcException(new Status(StatusCode.NotFound, "no launch with the specified name found")); throw new CloudException("error getting launch status", rpcException); } return(Task.FromResult(launch)); }
void TryAccept() { _selected = (InstancesList.SelectedItem as Gamelet); if (_selected != null) { Close(); } }
/** * called upon collision event of my associated NRGCharge (or Ball or ... other) */ public void OnBallCollided(Gamelet item, GameletEventArgs e) { if (e.otherItem is Ship) { // switch off my dimming behaviour. this.Active = false; } }
public override void OnEntry(Gamelet g) { base.OnEntry(g); isFirstDraw = true; if (loadingDisplay.gameIcon != null) { loadingDisplay.gameIcon.Visible = true; } }
public override void OnUpdate(Gamelet g, ref UpdateParams p) { base.OnUpdate(g, ref p); if (SimTime > 1f && !isFirstDraw) { // suppress drawing during play of another game - save resources and avoid gfx conflicts. GardenGame.Instance.SuppressDraw(); } }
public void SetColors(float cyclePeriod, Color minColor, Color maxColor) { var fx = new ColorCycleBehavior(cyclePeriod); fx.minColor = minColor; fx.maxColor = maxColor; Add(fx); ColorFx = fx; }
public virtual void CreateStats() { statsPanel = new Gamelet(); this.Add(statsPanel); NrgBar nrgbar = new NrgBar(); statsPanel.Add(nrgbar); Score score = new Score(); statsPanel.Add(score); }
public override void OnExit(Gamelet g) { base.OnExit(g); GardenGame.Instance.IsMouseVisible = false; if (fadeInMusicWhenDone) { GardenGame.Instance.music.FadeIn(); } }
public VolDimSoundEvent(Gamelet item, double timeDuration) { // specify a dimming envelope Signal and add to this as a child. Signal sig = new Signal(new List<double>() { 0, 1, 0.020, 0, timeDuration + 0.050, 0, timeDuration + 0.1, 1 }); SignalSoundEvent se = new SignalSoundEvent(SignalSoundEvent.Modifier.AMPLITUDE, sig); this.AddEvent(0, se); // use eventing to add me as listener item.OnCollisionEvent += new GameletEventHandler(OnBallCollided); }
public override void OnUpdate(Gamelet g, ref UpdateParams p) { base.OnUpdate(g, ref p); simTime += p.Dt; if (stateDuration > 0f) { if (simTime > stateDuration) GardenGame.Instance.TreeRoot.SetNextState(new StateBrowsingMenu()); } }
public void SetUp() { var testGamelet = new Gamelet { Id = TEST_GAMELET_ID, IpAddr = TEST_IP }; sshTarget = new SshTarget(testGamelet); managedProcessFactory = Substitute.For <ManagedProcess.Factory>(); coreListRequestFactory = new CoreListRequest.Factory(managedProcessFactory); }
public override void OnEntry(Gamelet g) { base.OnEntry(g); loadingDisplay.iggNameBox.ColorB.Intensity = 0f; loadingDisplay.iggNameBox.ColorB.FadeTarget = 0f; if (loadingDisplay.gameIcon != null) { loadingDisplay.gameIcon.Visible = true; } }
public static DeveloperLogEvent.Types.GameletData FromGamelet(Gamelet gamelet) { return(new DeveloperLogEvent.Types.GameletData { State = (int)gamelet.State, Type = gamelet.DevkitId != "" ? DeveloperLogEvent.Types.GameletData.Types.Type.GameletDevkit : DeveloperLogEvent.Types.GameletData.Types.Type.GameletEdge }); }
bool StopGameIfNeeded(ref Gamelet gamelet) { IGameletClient gameletClient = _gameletClientFactory.Create(_runner); string gameletName = gamelet.Name; gamelet = _taskContext.Factory.Run(async() => await gameletClient.GetGameletByNameAsync( gameletName)); return(gamelet.State != GameletState.InUse || PromptStopGame(ref gamelet)); }
public override void OnEntry(Gamelet g) { base.OnEntry(g); loadingDisplay.willExitSoon = false; loadingDisplay.isExiting = false; loadingDisplay.iggNameBox.ColorB.Alpha = 0f; loadingDisplay.iggNameBox.ColorB.AlphaTarget = 0f; if (loadingDisplay.gameIcon != null) { loadingDisplay.gameIcon.Visible = true; } }
void SetupGetGameletApi(Gamelet gamelet, params GameletState[] states) { IEnumerable <Task <Gamelet> > gameletCopies = states.Select(state => { Gamelet gameletCopy = gamelet.Clone(); gameletCopy.State = state; return(Task.FromResult(gameletCopy)); }).ToList(); _gameletClient.GetGameletByNameAsync(gamelet.Name) .Returns(gameletCopies.First(), gameletCopies.Skip(1).ToArray()); }
public SshTarget(Gamelet gamelet) { IpAddress = gamelet.IpAddr; if (gamelet.Id.StartsWith("devkit")) { Port = 22; } else { Port = 44722; } }
public override void OnUpdate(Gamelet g, ref UpdateParams p) { base.OnUpdate(g, ref p); simTime += p.Dt; if (stateDuration > 0f) { if (simTime > stateDuration) { GardenGame.Instance.TreeRoot.SetNextState(new StateBrowsingMenu()); } } }
/// <summary> /// Confirms that the user wants to stop the gamelet and, if so, stops the gamelet. /// </summary> /// <returns>True if the user chooses to stop the gamelet and the gamelet stops /// successfully, false otherwise.</returns> bool PromptStopGamelet(ref Gamelet gamelet) { bool okToStop = _actionRecorder.RecordUserAction( ActionType.GameletPrepare, () => _dialogUtil.ShowYesNo(ErrorStrings.GameletBusyDialogText, ErrorStrings.StopRunningGame)); if (!okToStop) { return(false); } gamelet = StopGamelet(gamelet); return(gamelet != null); }
public void OnCollision(Gamelet item, GameletEventArgs e) { if (!(e.otherItem is Ship)) return; Ship ship = e.otherItem as Ship; Ball ball = Parent as Ball; Vector2 ballPos = ball.PositionAbsolute; Vector2 shipPos = ship.PositionAbsolute; Vector2 localNormal; float h2, r; // never let ball bounce back twice in the same period of time. if (ball.Velocity.X > 0) return; if (ballPos.X < (shipPos.X)) // if already left-of ship return; r = ship.WidthAbsolute / 2; h2 = ship.HeightAbsolute / 2 - r; // check where ball is: up, down or middle zone of ship if (ballPos.Y < shipPos.Y - h2) { // up zone Vector2 p = new Vector2(shipPos.X, shipPos.Y - h2); localNormal = ballPos - p; localNormal.Normalize(); } else if (ballPos.Y > shipPos.Y + h2) { // down zone Vector2 p = new Vector2(shipPos.X, shipPos.Y + h2); localNormal = ballPos - p; localNormal.Normalize(); } else { // middle zone ball.Velocity = new Vector2(-ball.Velocity.X, ball.Velocity.Y); return; } // reduce mass after refl ball.Mass /= 10.0f; //Vector2 newItemVelocity; //Vector2 itemVelocity = item.Velocity; //Vector2.Reflect(ref itemVelocity, ref localNormal, out newItemVelocity); ball.Velocity = localNormal * ball.Velocity.Length(); //new Vector2(-newItemVelocity.X, newItemVelocity.Y); }
public void OnCollision(Gamelet item, GameletEventArgs e) { if (!(e.otherItem is Ball)) return; Ship ship = Parent as Ship; Ball ball = e.otherItem as Ball; // impact vector of Ball Vector2 v = ball.Velocity; v.Y = -v.Y; // calc rotation float dy = (ball.PositionAbsolute.Y - ship.PositionAbsolute.Y); float rotAmpl = ball.Mass * dy / 1.5f; ship.AddFront(new LashbackBehavior(ball.Mass * v / 30.0f, rotAmpl)); //ball.Mass /= 10.0f; }
public void OnCollision(Gamelet item, GameletEventArgs e) { Gamelet withItem = e.otherItem; // TODO reset the lastCollide when not-colliding if (lastCollidedWith != withItem) { if (withItem is Ball) { Ball ball = withItem as Ball; // swap the velocity vecs - pseudo-phyics eff Vector2 v = ball.Velocity; ball.Velocity = item.Velocity; item.Velocity = v; } lastCollidedWith = withItem; } }
protected override void Initialize() { RunningGameState.IsXNAHiDef = (GraphicsDevice.GraphicsProfile == GraphicsProfile.HiDef); spriteBatch = new SpriteBatch(GraphicsDevice); #if MUSIC_ENABLED // create music engine musicEngine = MusicEngine.GetInstance(); // TODO check for Initialized property musicEngine.AudioPath = "..\\..\\..\\..\\Audio"; #endif RunningGameState.musicEngine = musicEngine; toplevelScreen = new Screenlet(1280, 768); Gamelet physicsModel = new FixedTimestepPhysics(); toplevelScreen.Add(physicsModel); toplevelScreen.Add(new FrameRateCounter(1.0f, 0f)); physicsModel.Add(new TTRStateMachine()); treeRoot = toplevelScreen; TTengineMaster.Initialize(treeRoot); // finally call base to enumnerate all (gfx) Game components to init base.Initialize(); }
public override void OnEntry(Gamelet g) { base.OnEntry(g); loadingDisplay.iggNameBox.ColorB.Intensity = 0f; loadingDisplay.iggNameBox.ColorB.FadeTarget = 0f; if (loadingDisplay.gameIcon != null) loadingDisplay.gameIcon.Visible = true; }
public override void OnUpdate(Gamelet g, ref UpdateParams p) { base.OnUpdate(g, ref p); int phase = (int)Math.Round((SimTime*2f) % 3.0f); string t = "Loading \"" + loadingDisplay.game.Name + "\""; switch (phase) { case 0: t += " ."; break; case 1: t += " .."; break; case 2: t += " ..."; break; } loadingDisplay.tbox.Text = t; if (loadingDisplay.nextStateTimer >= 0f && SimTime > loadingDisplay.nextStateTimer) { loadingDisplay.nextStateTimer = -1f; g.SetNextState(new StateLoadingDisplay_Playing(loadingDisplay)); } loadingDisplay.helpTextBox.Text = loadingDisplay.game.HelpText; }
public override void OnDraw(Gamelet g) { base.OnDraw(g); isFirstDraw = false; }
public override void OnDraw(Gamelet g) { isFirstDraw = false; }
void GardenInit() { // loading screen loadingScreenlet = new Screenlet(myWindowWidth, myWindowHeight); TTengineMaster.ActiveScreen = loadingScreenlet; loadingScreenlet.ActiveInState = new StatePlayingGame(); loadingScreenlet.DrawInfo.DrawColor = Color.Black; loadingDisplay = new LoadingDisplay(); loadingScreenlet.Add(loadingDisplay); // from here on, main screen mainScreenlet = new Screenlet(myWindowWidth, myWindowHeight); TTengineMaster.ActiveScreen = mainScreenlet; //mainScreenlet.ActiveInState = new StateBrowsingMenu(); TreeRoot = new FixedTimestepPhysics(); TreeRoot.SetNextState(new StateStartup()); // set the initial state TreeRoot.Add(mainScreenlet); TreeRoot.Add(loadingScreenlet); mainScreenlet.DrawInfo.DrawColor = new Color(169 * 2 / 3, 157 * 2 / 3, 241 * 2 / 3); // Color.Black; // graphics bitmap scaling that adapts to screen resolution mainScreenlet.Motion.Scale = ((float)myWindowHeight) / 900f; loadingScreenlet.Motion.Scale = mainScreenlet.Motion.Scale; // Spritelet SplashScreen = new Spritelet("igglogo"); SplashScreen.DrawInfo.LayerDepth = 1f; SplashScreen.ActiveInState = new StateStartup(); //l.Duration = 17.5f; SplashScreen.Motion.Position = mainScreenlet.Center; //l.Motion.Add(new MyFuncyModifier( delegate(float v) { return 1f-(float)Math.Sqrt((18f-v)/18f); }, "Scale" )); mainScreenlet.Add(SplashScreen); // music engine musicEngine = MusicEngine.GetInstance(); musicEngine.AudioPath = "."; if (!musicEngine.Initialize()) throw new Exception(musicEngine.StatusMsg); Thread t = new Thread(new ThreadStart(GardenInitInBackground)); t.Start(); }
public override void OnEntry(Gamelet g) { base.OnEntry(g); loadingDisplay.tbox.Text = ""; }
public override void OnEntry(Gamelet g) { base.OnEntry(g); isFirstDraw = true; if (loadingDisplay.gameIcon != null) loadingDisplay.gameIcon.Visible = true; }
public override void OnEntry(Gamelet g) { base.OnEntry(g); GardenGame.Instance.IsMouseVisible = true; }
public override void OnEntry(Gamelet g) { GardenGame.Instance.IsMouseVisible = false; }