public static MatchParameters Load(SavedMatch savedMatch, bool isTournament) { return(new MatchParameters { Player1 = savedMatch.SavedGame.Player1, Player2 = savedMatch.SavedGame.Player2, IsTournament = isTournament, SavedMatch = savedMatch }); }
public static MatchParameters Load(SavedMatch savedMatch, bool isTournament) { return new MatchParameters { Player1 = savedMatch.SavedGame.Player1, Player2 = savedMatch.SavedGame.Player2, IsTournament = isTournament, SavedMatch = savedMatch }; }
public ActionResult SaveMatch(int match, DateTime t, int barId) { var time = t.AddMilliseconds(t.Millisecond * -1); var _Matches = db.Matches.Where(m => m.TimeStamp > time).ToList(); var list = _Matches.OrderByDescending(s => s.Score).ToList(); var matchSv = list[match - 1]; var userId = User.Identity.GetUserId(); var pcid = db.PatronClients.SingleOrDefault(s => s.UserId == userId); var savedMatch = new SavedMatch() { BCId = barId, PCId = pcid.Id, Match = matchSv }; db.SavedMatches.Add(savedMatch); db.SaveChanges(); return(RedirectToAction("MyPrevs", "AppUser", new { barId = barId })); }
protected override void OnNavigatedTo(NavigationEventArgs e) { SharedGraphicsDeviceManager.Current.GraphicsDevice.SetSharingMode(true); spriteBatch = new SpriteBatch(SharedGraphicsDeviceManager.Current.GraphicsDevice); /** * DebugShapeRenderer.Initialize(SharedGraphicsDeviceManager.Current.GraphicsDevice); */ //LA VITA DEVE CAMBIARE A SECONDA DEL LIVELLO DI DIFFICOLTA' maxLife = Constants.MAX_EASY_LIFE; //SE NON ESISTE UN MATCH CARICATO LO CREO. MA SOLO ALLORA. if (((App)App.Current).NewMatch) { ((App)App.Current).match = new SavedMatch(); ((App)App.Current).match.cameraPos = new Vector3(0, 3.5f, 0); ((App)App.Current).match.cameraLook = new Vector3(0, 3.5f, -1); ((App)App.Current).match.cameraShake = Vector2.Zero; ((App)App.Current).match.shakeMagnitude = 0; ((App)App.Current).match.playerBox = new BoundingBox(new Vector3(((App)App.Current).match.cameraPos.X, ((App)App.Current).match.cameraPos.Y, ((App)App.Current).match.cameraPos.Z - 1), ((App)App.Current).match.cameraPos); ((App)App.Current).match.life = Utilities.Constants.MAX_EASY_LIFE; ((App)App.Current).match.lifepositions = new float[maxLife]; for (int counter = 0; counter < ((App)App.Current).match.lifepositions.Length; counter++) { ((App)App.Current).match.lifepositions[counter] = 0; } ((App)App.Current).match.matchTime = new TimeSpan(); ((App)App.Current).match.gameState = GamePageState.PLAY; //Add sections ((App)App.Current).match.sections = new List <Section>(); ((App)App.Current).match.sections.Add(new Section(0, 0, 0)); ((App)App.Current).match.sections.Add(new Section(0, 0, ((App)App.Current).match.sections[((App)App.Current).match.sections.Count - 1].zPosition - 50)); ((App)App.Current).match.sections.Add(new Section(0, 0, ((App)App.Current).match.sections[((App)App.Current).match.sections.Count - 1].zPosition - 50)); ((App)App.Current).match.speedTime = 0.1f; ((App)App.Current).match.flashCounter = 0; ((App)App.Current).match.fadeIndex = 0; } else { ((App)App.Current).NewMatch = true; } match = ((App)App.Current).match; //Pubblicità AdComponent.Initialize("00000000-0000-0000-0000-000000000000"); drawableAd = AdComponent.Current.CreateAd("00000000", new Rectangle(168, 0, 480, 80), true); drawableAd.AdRefreshed += new EventHandler(drawableAd_AdRefreshed); drawableAd.ErrorOccurred += new EventHandler <AdErrorEventArgs>(drawableAd_ErrorOccurred); //Textures timeBack = contentManager.Load <Texture2D>("TimeBack"); barraBack = contentManager.Load <Texture2D>("BarraBack"); barra = contentManager.Load <Texture2D>("Barra"); heart = contentManager.Load <Texture2D>("Heart"); //Models models = new Model[8]; models[0] = contentManager.Load <Model>("planeModel"); models[1] = contentManager.Load <Model>("fenceModel"); models[2] = contentManager.Load <Model>("treeModel"); models[3] = contentManager.Load <Model>("dogModel"); models[4] = contentManager.Load <Model>("shadowModel"); models[5] = contentManager.Load <Model>("boostModel"); models[6] = contentManager.Load <Model>("heartModel"); models[7] = contentManager.Load <Model>("boxesModel"); //Suoni bark = contentManager.Load <SoundEffect>("bark"); hit = contentManager.Load <SoundEffect>("hit"); //Font font = contentManager.Load <SpriteFont>("font"); /* * debug = false; */ //Speed - abbastanza definitivo. speedCurve = new Curve(); firstKey = new CurveKey(0, 0); speedCurve.Keys.Add(firstKey); speedCurve.Keys.Add(new CurveKey(Constants.SPRINT_DURATION, Constants.MAX_SPEED)); speedCurve.Keys.Add(new CurveKey(Constants.SPRINT_DURATION + Constants.MAX_SPEED_DURATION, Constants.MAX_SPEED)); speedCurve.Keys.Add(new CurveKey(Constants.SPRINT_DURATION + Constants.MAX_SPEED_DURATION + Constants.SLOWDOWN_DURATION, 0)); //Flash boost boostFlashCurve = new Curve(); boostFlashCurve.Keys.Add(new CurveKey(0, 128)); boostFlashCurve.Keys.Add(new CurveKey(Constants.FLASH_DURATION - Constants.FLASH_DURATION / 5, Constants.FLASH_STRENGTH)); boostFlashCurve.Keys.Add(new CurveKey(Constants.FLASH_DURATION, 128)); inputManager = new InputManager(true); //FLASH PICKUP BOOST whiteTexture = new Texture2D(SharedGraphicsDeviceManager.Current.GraphicsDevice, 1, 1); whiteTexture.SetData <Color>(new Color[] { Color.White }); brightness = 255; brightnessBlend = new BlendState(); brightnessBlend.ColorSourceBlend = brightnessBlend.AlphaSourceBlend = Blend.Zero; brightnessBlend.ColorDestinationBlend = brightnessBlend.AlphaDestinationBlend = Blend.SourceColor; contrastBlend = new BlendState(); contrastBlend.ColorSourceBlend = contrastBlend.AlphaSourceBlend = Blend.DestinationColor; contrastBlend.ColorDestinationBlend = contrastBlend.AlphaDestinationBlend = Blend.SourceColor; //BLACK FADE blackTexture = new Texture2D(SharedGraphicsDeviceManager.Current.GraphicsDevice, 1, 1); blackTexture.SetData <Color>(new Color[] { Color.Black }); IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; soundEffectsVolume = (float)settings["SoundsVolume"]; vibration = (bool)settings["Vibration"]; timer.Start(); PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; base.OnNavigatedTo(e); }