public override void LoadContent() { Background tempBack = new Background(TheGame.Content.Load<Texture2D>(@"Maps/Level2/underwaterlvl"), TheSpriteBatch); player = new Player(TheGame, TheSpriteBatch, new Vector2(100, 500)); player.LoadContent(); //Loading the Enemy Sprites enemy = new Vortex(TheGame, TheSpriteBatch, new Vector2(200, 200)); enemy.LoadContent(); spawnManager = new SpawnManager(TheGame, TheSpriteBatch); //Object Manager objectManager.RegisterObject(tempBack); objectManager.RegisterObject(enemy); objectManager.RegisterObject(player); collisionManager.RegisterObject(player); collisionManager.RegisterObject(enemy); levelLoaded = true; }
public override void Load() { blackground = new Texture2D(Game1.graphics.GraphicsDevice, 32, 32, false, SurfaceFormat.Color); Color[] pixels = new Color[blackground.Width * blackground.Height]; for (int y = 0; y < blackground.Height; y++) { for (int x = 0; x < blackground.Width; x++) { pixels[y * blackground.Width + x] = Color.Black; } } blackground.SetData<Color>(pixels); background = new Background(new Vector4(0.3f, 0.3f, 0.1f, 0.1f), new Vector4(0.8f, 0.8f, 0.4f, 0.25f), false); //me Names.Add("Aaron Charcoal Styles"); Contribution.Add("Design, Programming & Art"); Website.Add("charcoalstyles.com"); //Mat Names.Add("Mat Teubert"); Contribution.Add("Awards Art"); Website.Add(" "); //Bart Names.Add("Bart Klepka"); Contribution.Add("Main Menu & Boss Music"); Website.Add("bartklepka.com"); //Bart Names.Add("Bård Ericson (Multifaros)"); Contribution.Add("In-Game Music"); Website.Add("multifaros.info.se"); //Sinnix Names.Add("Jeff 'Sinnix' Jenkins"); Contribution.Add("XBox 360 Button Pack"); Website.Add("360prophecy.com"); //Thanks1 Names.Add("Thanks To:"); Contribution.Add("My Girlfriend, Geraldine"); Website.Add("Gayle and Johnee"); //Thanks2 Names.Add("The teams at GDC & GDC China"); Contribution.Add("Brian and Larry at Impulse"); Website.Add("Everyone at Infinite Interactive"); //thanks 3 Names.Add("Alexander Bishop and Family"); Contribution.Add("All my friends and family"); Website.Add("Morgan Pretty and Simon Riley"); //thanks 4 Names.Add("My Grandfather and Tim Richards"); Contribution.Add("And all the playtesters"); Website.Add(""); strHeight = Game1.consoleFont.MeasureString("WWWWW").Y / Game1.scrmgr.screenSize.Y; loaded = true; }
public void Add(Background b, bool flagAsMain) { backgrounds.Add(b); if(flagAsMain) mainBackgroundIndex = backgrounds.IndexOf(b); }
public void ChangeBackground(Background backgroundType) { this.backgroundType = backgroundType; int height = game.Window.ClientBounds.Height; int width = game.Window.ClientBounds.Width; switch (backgroundType) { case Background.grass: { backgroundSprite = new BackgroundSprite(width, height, grassTile); break; } case Background.mud: { backgroundSprite = new BackgroundSprite(width, height, mudTile); break; } case Background.none: { break; } default: { throw new ArgumentException("Unknown background!"); } } }
public override void ViewDidLoad() { base.ViewDidLoad (); Title = AppDelegate.its.getTranslatedText ("Help"); Background back = new Background (); this.View.AddSubview (back.View); this.View.SendSubviewToBack (back.View); if (AppDelegate.Variant == "LITE") { adView = new GADBannerView (size: GADAdSizeCons.Banner, origin: new PointF (0, 66)) { AdUnitID = AppDelegate.AdmobID, RootViewController = this }; adView.DidReceiveAd += (sender, args) => { if (!viewOnScreen) View.AddSubview (adView); viewOnScreen = true; }; adView.LoadRequest (GADRequest.Request); } HelpScreenInner innerViewController = new HelpScreenInner (); UIScrollView innerScroll = new UIScrollView (View.Bounds); innerScroll.ContentSize = innerViewController.GetContentSize (); innerScroll.AddSubview (innerViewController.View); innerScroll.UserInteractionEnabled = true; View.AddSubview (innerScroll); UIBarButtonItem YouTube = new UIBarButtonItem ("YouTube", UIBarButtonItemStyle.Plain, null); YouTube.Clicked += (object sender, System.EventArgs e) => UIApplication.SharedApplication.OpenUrl (new MonoTouch.Foundation.NSUrl ("https://www.youtube.com/watch?v=aq1Ml2O8ado")); this.NavigationItem.SetRightBarButtonItem (YouTube,true); }
// Use this for initialization void Start () { GameManager.LevelHeight = 20F; GameManager.LevelWidth = 50F; layer1 = new Background(GameObject.Find("Nighttime foreground")); layer2 = new Background(GameObject.Find("Shrubbery")); layer3 = new Background(GameObject.Find("Nighttime Distant Background")); }
public Form1() { InitializeComponent(); this.SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true); //set up the game timer GameTimer = new Timer(); GameTimer.Interval = 10; //10 milliseconds 1/100 second GameTimer.Tick += new EventHandler(GameTimer_Tick); //create the graphics object to draw with gameCanvas = pictureBox1.CreateGraphics(); //initialise sprite liono = new Liono(); //initialise bg bg = new Background(); stage = new Foreground(); //start the game if (gameStart == true) { GameTimer.Start(); } //handle game input // Set KeyPreview object to true to allow the form to process // the key before the control with focus processes it. this.KeyPreview = true; this.KeyDown += new KeyEventHandler(userInput); this.KeyUp += new KeyEventHandler(userNoInput); }
public override bool InitOne(ContentManager content, int id) { try { XmlDocument _doc = new XmlDocument(); _doc.Load(_xmlInfo); XmlNode _background = _doc.SelectSingleNode(@"//Background[@id = '" + id.ToString() + "']"); XmlNodeList _imageList = _background.SelectNodes("Image"); _prototype[id] = new Background(); _prototype[id]._nsprite = _imageList.Count; _prototype[id]._sprite = new GameSprite[_prototype[id]._nsprite]; for (int i = 0; i < _prototype[id]._nsprite; i++) { Texture2D _temp = content.Load<Texture2D>(_imageList[i].SelectSingleNode("Path").InnerText); int _xTemp = int.Parse(_imageList[i].SelectSingleNode("X").InnerText) - (int)GlobalVariables.dX; int _yTemp = int.Parse(_imageList[i].SelectSingleNode("Y").InnerText) - (int)GlobalVariables.dY; _prototype[id]._sprite[i] = new GameSprite(_temp, _xTemp, _yTemp); _prototype[id]._sprite[i].Xoffset = 0; _prototype[id]._sprite[i].Yoffset = 0; } } catch { return false; } return true; }
public override void ViewDidLoad() { base.ViewDidLoad (); Title = AppDelegate.its.getTranslatedText ("locations"); Background back = new Background (); View.Add (back.View); View.SendSubviewToBack (back.View); table = new UITableView (new RectangleF (0, 75, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 75), UITableViewStyle.Plain); table.BackgroundColor = UIColor.Clear; this.View.BackgroundColor = UIColor.Clear; Add (table); //this.NavigationController.NavigationBar.BackItem.BackBarButtonItem.Image = backarrow.MakeBackArrow() ; //UIButton backbutton = new UIButton(new RectangleF(10,25,48,32)); // backbutton.SetImage (backarrow.MakeBackArrow(), UIControlState.Normal); // backbutton.TouchUpInside += (object sender, EventArgs e) => DismissViewControllerAsync (true); //Add (backbutton); InitializeAddNewItemButton (); // Perform any additional setup after loading the view, typically from a nib. }
public EffectBackground(int x, int y, int width, int height) { _background = new Background(); _x = x; _y = y; _width = width; _height = height; }
public Feature(IList<LineValue> summaryLines, Background background, IList<FeatureItem> items, IEnumerable<string> tags) { SummaryLines = summaryLines; Background = background; Items = items; Tags = tags; Background.Feature = this; foreach (var item in items) item.Feature = this; }
public static void Main(string[] args){ Background background = new Background(); Color yellow = new Yellow("color yellow"); Color blue = new Blue("color blue"); Color red = new Red("color red"); background.setBackground(yellow); background.setBackground(blue); background.setBackground(red); }
public override void ViewDidLoad() { base.ViewDidLoad (); Background back = new Background (); View.AddSubview (back.View); View.SendSubviewToBack (back.View); View.BackgroundColor = UIColor.Clear; this.PopulateTable(); // Perform any additional setup after loading the view, typically from a nib. }
public QBlizzard() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = Constants.WIN_X; graphics.PreferredBackBufferHeight = Constants.WIN_Y; graphics.PreferMultiSampling = true; Content.RootDirectory = "Content"; bg = new Background(this); m = new Terrain(this); sb = new Snowblower(this, m); }
public void Process(object sender, CapturedScreenshotEventArgs image) { _background.Visibility = Visibility.Visible; _background.SetDimensions(_x, _y, _width, _height); _background.ContentRendered += (s, e) => { OnFiltered(null); _background.Close(); _background = null; }; }
public MainMenu(ContentManager Content, GraphicsDevice graphicsDevice, ControlHandler ch) { this.Content = Content; this.ch = ch; background = new Background(graphicsDevice, Content); sizeSelectArrow = new Vector2(graphicsDevice.Viewport.Width / 900 * 30, graphicsDevice.Viewport.Height / 500 * 30); posSelectArrow = new Vector2(4.5f, 2.6f); recSelectArrow = new Rectangle(graphicsDevice.Viewport.Width / (int)posSelectArrow.X, graphicsDevice.Viewport.Height / (int)posSelectArrow.Y, (int)sizeSelectArrow.X, (int)sizeSelectArrow.Y); framesPassed = 0; selectedNumber = 0; currentGameState = 2; }
public PPU() { bg1 = new Background(this, (uint)Background.ID.BG1); bg2 = new Background(this, (uint)Background.ID.BG2); bg3 = new Background(this, (uint)Background.ID.BG3); bg4 = new Background(this, (uint)Background.ID.BG4); oam = new Sprite(this); window = new Window(this); screen = new Screen(this); //TODO: Remove this hack surface = new ushort[1024 * 1024]; output = new ArraySegment<ushort>(surface, 16 * 512, surface.Length - (16 * 512)); }
public TrackScreen(Background background, Vector2 startPos, ContentManager content, EventHandler screenEvent) : base(screenEvent) { carBasicTex = content.Load<Texture2D>("Cars//redcar"); hudFont = content.Load<SpriteFont>("Fonts//hudFont"); countdownFont = content.Load<SpriteFont>("Fonts//countdownFont"); winnerFont = content.Load<SpriteFont>("Fonts//winnerFont"); this.startPos = startPos; this.background = background; carBasic = new CarBasic(new Vector2(startPos.X, startPos.Y + 15), carBasicTex); aiCar = new AICarBasic(new Vector2(startPos.X, startPos.Y - 15), carBasicTex); }
public Location init (WorldMap worldMap) { this.worldMap = worldMap; fightScreen = Vars.gameplay.getFightScreen(); enemyRender = transform.Find("EnemyImage").GetComponent<SpriteRenderer>(); questMarker = enemyRender.transform.Find("QuestMarker").gameObject; huntBtn = transform.Find("HuntBtn").GetComponent<Button>(); leaveBtn = transform.Find("LeaveBtn").GetComponent<Button>(); attackBtn = transform.Find("AttackBtn").GetComponent<Button>(); backBtn = transform.Find("BackBtn").GetComponent<Button>(); background = transform.Find("BG").GetComponent<Background>(); background.init(this); enemyRender.gameObject.SetActive(true); gameObject.SetActive(false); return this; }
public BackgroundSettingsWrapper(Background background) { Bevel = background.Bevel; Color = new ColorSettingsWrapper(background.Color); GlassEffect = background.GlassEffect; GradientAngle = background.GradientAngle; HatchColor = background.HatchColor; HatchStyle = background.HatchStyle; ImagePath = background.ImagePath; Mode = background.Mode; SecondaryColor = background.SecondaryColor; ShadingEffectMode = background.ShadingEffectMode; Transparency = background.Transparency; Visible = background.Visible; }
/// <summary> /// Восстановить сохранненые значения. /// </summary> public void RestoreSettings(Background background) { background.Bevel = Bevel; background.Color = Color.RestoreSettings(); background.GlassEffect = GlassEffect; background.GradientAngle = GradientAngle; background.HatchColor = HatchColor; background.HatchStyle = HatchStyle; background.ImagePath = ImagePath; background.Mode = Mode; background.SecondaryColor = SecondaryColor; background.ShadingEffectMode = ShadingEffectMode; background.Transparency = Transparency; background.Visible = Visible; }
public PPU() { cache = new Cache(this); bg1 = new Background(this, (uint)Background.ID.BG1); bg2 = new Background(this, (uint)Background.ID.BG2); bg3 = new Background(this, (uint)Background.ID.BG3); bg4 = new Background(this, (uint)Background.ID.BG4); oam = new Sprite(this); screen = new Screen(this); surface = new ushort[512 * 512]; output = new ArraySegment<ushort>(surface, 16 * 512, surface.Length - (16 * 512)); display.width = 256; display.height = 224; display.frameskip = 0; display.framecounter = 0; }
public override void ViewDidLoad() { base.ViewDidLoad (); Title = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Large Objects", "Large Objects"); Background back = new Background (); View.AddSubview (back.View); View.SendSubviewToBack (back.View); table = new UITableView (new RectangleF (0, 75, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 75), UITableViewStyle.Plain); table.BackgroundColor = UIColor.Clear; this.View.BackgroundColor = UIColor.Clear; Add (table); Initialize (); PopulateTable (); }
public override void ViewDidLoad() { base.ViewDidLoad (); InitializeAddButton(); Background back = new Background (); View.AddSubview (back.View); View.SendSubviewToBack (back.View); table = new UITableView (new RectangleF (0, 75, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 75), UITableViewStyle.Plain); table.BackgroundColor = UIColor.Clear; this.View.BackgroundColor = UIColor.Clear; Add (table); PopulateTable (); }
protected override void Initialize() { _screenWidth = GraphicsDevice.Viewport.Width; _screenHeight = GraphicsDevice.Viewport.Height; _background = new Background(); _tank = new Tank(); _cannon = new Cannon(); _bullet = new Bullet(); _alien = new Alien(); _explosion = new Explosion(); _particleList = new List<ParticleData>(); _tankPositionX = _screenWidth/2; _tankPositionY = _screenHeight - 193; base.Initialize(); }
public Engine() { levelBackground = new Background(); mainHero = new Goliath(); al = new EnemyNinjaGirl(); al1 = new EnemyGirl(); this.currentEnemies = new LinkedList<Enemy>(); this.currentEnemies.AddLast(al); this.currentEnemies.AddLast(al1); heroUI = new HeroUI(); sharpingStone = new SharpingStone(); potion = new Potion(); armor = new Armor(); sharpingStoneOnTheField = false; potionOnTheField = false; armorOnTheField = false; }
public override void Load() { //basic black background bkgrnd = new Texture2D(Game1.graphics.GraphicsDevice, Game1.graphics.GraphicsDevice.DisplayMode.Width, Game1.graphics.GraphicsDevice.DisplayMode.Height, false, SurfaceFormat.Color); Color[] pixels = new Color[bkgrnd.Width * bkgrnd.Height]; for (int y = 0; y < bkgrnd.Height; y++) { for (int x = 0; x < bkgrnd.Width; x++) { pixels[y * bkgrnd.Width + x] = Color.Black; } } bkgrnd.SetData<Color>(pixels); //new background. //Soothing light blue. background = new Background(new Vector4(0.1f, 0.6f, 1, 0.25f), true); basicEnemyColor = new Color(Vector3.One - background.topColor.ToVector3()); PlayerBuffs.topColor = background.topColor; PlayerBuffs.botColor = background.botColor; for (int i = 0; i < Game1.gammgr.saveGameData.totalPlayerBuffs; i++) { //Add a single player Buff to the GameManager PlayerBuffs pb = new PlayerBuffs(); pb.resetPosition(Game1.gammgr.playerShip.position); Game1.gammgr.playerBuffs.Add(pb); } Game1.gammgr.isPlaying = true; Game1.gammgr.isLevelOver = false; Game1.gammgr.lh.reset(); Game1.gammgr.mb.Reset(); Game1.gammgr.inTutLevel = true; loaded = true; Game1.musman.PlayNewSong(4); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); TextureManager.LoadContents(Content); FontManager.LoadContents(Content); //initializing here because they are dependent on content managers background = new Background(Width, Height, TextureManager.GetTexture(TextureNames.BACKGROUND)); world = WorldGenerator.Generate(WorldNumber.One); world.Add(new Player(PlayerNumber.One, new Vector2(200, 200))); world.Add(new Player(PlayerNumber.Two, new Vector2(100, 100))); ui = new UserInterface(); mainMenu = new MainMenu(); }
IEnumerator Start() { // Spaceshipコンポーネントを取得 spaceship = GetComponent<Spaceship> (); background = FindObjectOfType<Background>(); while (true) { // 弾をプレイヤーと同じ位置/角度で作成 spaceship.Shot (transform); // ショット音を鳴らす GetComponent<AudioSource>().Play(); // shotDelay秒待つ yield return new WaitForSeconds (spaceship.shotDelay); } }
public override Node ExitBackground(Production node) { var values = GetChildValues(node); // First value is either title from header or first FeatureStep var title = values[0] as string; var featureIndex = title == null ? 0 : 1; // Rest of values are FeatureSteps var steps = values.GetRange(featureIndex, values.Count - featureIndex).Cast<Step>().ToList(); var background = new Background(steps) { Title = title, LineNumber = node.StartLine }; node.AddValue(background); return node; }
protected override bool OnHover(HoverEvent e) { Background.FadeTo(0.4f, 200); return(base.OnHover(e)); }
private void load(BeatmapListingOverlay beatmapListing, SettingsOverlay settings, RankingsOverlay rankings, OsuConfigManager config, SessionStatics statics) { holdDelay = config.GetBindable <float>(OsuSetting.UIHoldActivationDelay); loginDisplayed = statics.GetBindable <bool>(Static.LoginOverlayDisplayed); if (host.CanExit) { AddInternal(exitConfirmOverlay = new ExitConfirmOverlay { Action = () => { if (holdDelay.Value > 0) { confirmAndExit(); } else { this.Exit(); } } }); } AddRangeInternal(new[] { buttonsContainer = new ParallaxContainer { ParallaxAmount = 0.01f, Children = new Drawable[] { buttons = new ButtonSystem { OnEdit = delegate { this.Push(new Editor()); }, OnSolo = onSolo, OnMulti = delegate { this.Push(new Multiplayer()); }, OnExit = confirmAndExit, } } }, sideFlashes = new MenuSideFlashes(), songTicker = new SongTicker { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Margin = new MarginPadding { Right = 15, Top = 5 } }, exitConfirmOverlay?.CreateProxy() ?? Drawable.Empty() }); buttons.StateChanged += state => { switch (state) { case ButtonSystemState.Initial: case ButtonSystemState.Exit: Background.FadeColour(Color4.White, 500, Easing.OutSine); break; default: Background.FadeColour(OsuColour.Gray(0.8f), 500, Easing.OutSine); break; } }; buttons.OnSettings = () => settings?.ToggleVisibility(); buttons.OnBeatmapListing = () => beatmapListing?.ToggleVisibility(); buttons.OnChart = () => rankings?.ShowSpotlights(); LoadComponentAsync(background = new BackgroundScreenDefault()); preloadSongSelect(); }
public override string ToString() { return(string.Format("{0},{1}", Foreground.ToString(), Background.ToString())); }
public override void OnEntering(IScreen last) { base.OnEntering(last); Background.FadeColour(Color4.DarkGray, 500); Beatmap.Value.Track?.Stop(); }
public ScreenSettingsMenuScreen(Game i_Game) : base(i_Game, "Screen Settings") { Background background = new Background(i_Game, this); }
/// <summary> /// Renders the PlotView to a bitmap. /// </summary> /// <returns>A bitmap.</returns> public IBitmap ToBitmap() { var background = ActualModel.Background.IsVisible() ? ActualModel.Background : Background.ToOxyColor(); return(PngExporter.ExportToBitmap(ActualModel, (int)Bounds.Width, (int)Bounds.Height, background)); }
public override bool OnExiting(IScreen next) { Background.FadeTo(1, 250); return(base.OnExiting(next)); }
public abstract string CardBackground(Background background);
public void SetBackground(Texture2D Background, Viewport view) { this.Background = new Background(Background, view); }
public void BackgroundReference(Background background) { m_Background = background; }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public virtual void UpdateBackground(Color pColor) { Background.renderer.sharedMaterial.color = pColor; Background.SetActive(pColor.a > 0); }
public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { var dialog = new TagBuilder("div", "modal"); dialog.MergeAttribute("id", context.RootId); dialog.MergeAttribute("v-cloak", String.Empty); dialog.AddCssClassBoolNo(UserSelect, "user-select"); dialog.MergeAttribute("data-controller-attr", GetControllerAttributes()); dialog.AddCssClassBool(Maximize, "maximize"); dialog.AddCssClassBool(ButtonOnTop, "button-on-top"); if (!String.IsNullOrEmpty(TestId) && context.IsDebugConfiguration) { dialog.MergeAttribute("test-id", TestId); } if (Maximize) { dialog.MergeAttribute("v-maximize", "true"); } else { SetSize(dialog); } dialog.RenderStart(context); if (ShowWaitCursor) { new TagBuilder("wait-cursor", "dialog") .MergeAttribute(":ready", "$data.$ready") .Render(context, TagRenderMode.Normal); } RenderHeader(context); RenderLoadIndicator(context); var content = new TagBuilder("div", "modal-content"); OnCreateContent(content); if (Height != null) { content.MergeStyle("min-height", Height.Value); } if (Padding != null) { Padding.MergeStyles("padding", content); } content.AddCssClassBool(IsContentIsIFrame, "content-iframe"); // bug fix (3px height) if (Background != BackgroundStyle.Default) { content.AddCssClass("background-" + Background.ToString().ToKebabCase()); } content.AddCssClassBool(Overflow, "overflow"); content.RenderStart(context); if (Taskpad != null) { var grid = new TagBuilder("div", "dialog-grid"); if (Taskpad is Taskpad tp && tp.Width != null) { grid.MergeStyle("grid-template-columns", $"1fr {tp.Width.Value}"); } grid.RenderStart(context); var gridContent = new TagBuilder("div", "dialog-grid-content"); gridContent.RenderStart(context); RenderChildren(context); gridContent.RenderEnd(context); Taskpad.RenderElement(context); grid.RenderEnd(context); } else { RenderChildren(context); } content.RenderEnd(context); RenderFooter(context); RenderAccelCommands(context); dialog.RenderEnd(context); }
public Card(int number, Background background, Shape shape, Shading shading) : base(number, background, shape) { Shading = shading; }
//public override bool Equals(ICellEffect effect) //{ // if (effect is Recolor) // { // if (base.Equals(effect)) // { // var effect2 = (Recolor)effect; // return Foreground == effect2.Foreground && // Background == effect2.Background && // Permanent == effect2.Permanent && // RemoveOnFinished == effect2.RemoveOnFinished && // StartDelay == effect2.StartDelay && // DoForeground == effect2.DoForeground && // DoBackground == effect2.DoBackground; // } // } // return false; //} public override string ToString() { return(string.Format("RECOLOR-{0}-{1}-{2}-{3}-{4}", Foreground.ToInteger(), Background.ToInteger(), Permanent, StartDelay, RemoveOnFinished)); }
public static bool SetOverlayPart(this Background bg, EvasObject content, bool preserveOldContent = false) { return(bg.SetPartContent(ThemeConstants.Background.Parts.Overlay, content, preserveOldContent)); }
public override string BarBackground(Background background) => BackgroundColor(background);
/// <summary> /// Builds a string of the stage's information and content. /// </summary> /// <param name="manager">Main window manager</param> /// <returns>String for the DSL</returns> public string ToString(MainWindowManager manager) { string total = ""; Background = Background.Replace('\\', '/'); if (!String.IsNullOrEmpty(Music)) { Music = Music.Replace('\\', '/'); } total += "\t<stage>\r\n"; total += "\t\t<window>\r\n" + "\t\t\t<window_background>" + Background + "</window_background>\r\n" + "\t\t\t<window_background_music>" + Music + "</window_background_music>\r\n" + "\t\t\t<window_id>" + ID + "</window_id>\r\n" + "\t\t\t<window_north>" + ExitUp + "</window_north>\r\n" + "\t\t\t<window_east>" + ExitRight + "</window_east>\r\n" + "\t\t\t<window_south>" + ExitDown + "</window_south>\r\n" + "\t\t\t<window_west>" + ExitLeft + "</window_west>\r\n" + "\t\t</window>\r\n"; foreach (Enemy enemy in Enemies) { enemy.ImageMovingUp = enemy.ImageMovingUp.Replace('\\', '/'); enemy.ImageMovingDown = enemy.ImageMovingDown.Replace('\\', '/'); enemy.ImageMovingLeft = enemy.ImageMovingLeft.Replace('\\', '/'); enemy.ImageMovingRight = enemy.ImageMovingRight.Replace('\\', '/'); if (!String.IsNullOrEmpty(enemy.ImageArrowUp)) { enemy.ImageArrowUp = enemy.ImageArrowUp.Replace('\\', '/'); enemy.ImageArrowDown = enemy.ImageArrowDown.Replace('\\', '/'); enemy.ImageArrowLeft = enemy.ImageArrowLeft.Replace('\\', '/'); enemy.ImageArrowRight = enemy.ImageArrowRight.Replace('\\', '/'); } int enemySpeed; if (enemy.Speed == "slow") { enemySpeed = 1; } else if (enemy.Speed == "normal") { enemySpeed = 2; } else { enemySpeed = 3; } int bulletspeed = enemySpeed + 1; total += "\t\t<enemy>\r\n" + "\t\t\t<enemy_image_up>" + enemy.ImageMovingUp + "</enemy_image_up>\r\n" + "\t\t\t<enemy_image_down>" + enemy.ImageMovingDown + "</enemy_image_down>\r\n" + "\t\t\t<enemy_image_left>" + enemy.ImageMovingLeft + "</enemy_image_left>\r\n" + "\t\t\t<enemy_image_right>" + enemy.ImageMovingRight + "</enemy_image_right>\r\n" + "\t\t\t<enemy_bullet_image_up>" + enemy.ImageArrowUp + "</enemy_bullet_image_up>\r\n" + "\t\t\t<enemy_bullet_image_down>" + enemy.ImageArrowDown + "</enemy_bullet_image_down>\r\n" + "\t\t\t<enemy_bullet_image_left>" + enemy.ImageArrowLeft + "</enemy_bullet_image_left>\r\n" + "\t\t\t<enemy_bullet_image_right>" + enemy.ImageArrowRight + "</enemy_bullet_image_right>\r\n" + "\t\t\t<enemy_initial_state>" + enemy.InitialState + "</enemy_initial_state>\r\n" + "\t\t\t<enemy_framecount>" + enemy.FrameCount + "</enemy_framecount>\r\n" + "\t\t\t<enemy_x_position>" + enemy.PositionX + "</enemy_x_position>\r\n" + "\t\t\t<enemy_y_position>" + enemy.PositionY + "</enemy_y_position>\r\n" + "\t\t\t<enemy_speed>" + enemySpeed + "</enemy_speed>\r\n" + "\t\t\t<enemy_bullet_speed>" + bulletspeed + "</enemy_bullet_speed>\r\n" + "\t\t\t<enemy_strenght>" + enemy.Strenght + "</enemy_strenght>\r\n" + "\t\t\t<enemy_dexterity>" + enemy.Dexterity + "</enemy_dexterity>\r\n" + "\t\t\t<enemy_intelligence>" + enemy.Intelligence + "</enemy_intelligence>\r\n" + "\t\t\t<enemy_hit_points>" + enemy.HitPoints + "</enemy_hit_points>\r\n" + "\t\t\t<enemy_ia>" + enemy.Behavoir + "</enemy_ia>\r\n" + "\t\t\t<enemy_preference>" + enemy.Preference + "</enemy_preference>\r\n" + "\t\t\t<enemy_boss>" + enemy.Boss + "</enemy_boss>\r\n" + "\t\t\t<enemy_detect_zone>" + enemy.DetectZone + "</enemy_detect_zone>\r\n" + "\t\t\t<enemy_patrol_zone>" + enemy.PatrolZone + "</enemy_patrol_zone>\r\n"; if (manager.GetWeapon(enemy.Loot) != null) { Weapon weapon = manager.GetWeapon(enemy.Loot); weapon.ImageWeapon = weapon.ImageWeapon.Replace('\\', '/'); int weaponSpeed; if (weapon.Speed == "slow") { weaponSpeed = 1; } else if (weapon.Speed == "normal") { weaponSpeed = 2; } else { weaponSpeed = 3; } if (weapon.Type == "melee") { total += "\t\t\t<melee>\r\n" + "\t\t\t\t<melee_image>" + weapon.ImageWeapon + "</melee_image>\r\n" + "\t\t\t\t<melee_damage>" + weapon.Damage + "</melee_damage>\r\n" + "\t\t\t\t<melee_speed>" + weaponSpeed + "</melee_speed>\r\n" + "\t\t\t</melee>\r\n"; } else { weapon.ImageWeapon = weapon.ImageWeapon.Replace('\\', '/'); weapon.ImageArrowUp = weapon.ImageArrowUp.Replace('\\', '/'); weapon.ImageArrowDown = weapon.ImageArrowDown.Replace('\\', '/'); weapon.ImageArrowLeft = weapon.ImageArrowLeft.Replace('\\', '/'); weapon.ImageArrowRight = weapon.ImageArrowRight.Replace('\\', '/'); total += "\t\t\t<distance>\r\n" + "\t\t\t\t<distance_image>" + weapon.ImageWeapon + "</distance_image>\r\n" + "\t\t\t\t<distance_damage>" + weapon.Damage + "</distance_damage>\r\n" + "\t\t\t\t<distance_speed>" + weaponSpeed + "</distance_speed>\r\n" + "\t\t\t\t<distance_bullet_image_up>" + weapon.ImageArrowUp + "</distance_bullet_image_up>\r\n" + "\t\t\t\t<distance_bullet_image_down>" + weapon.ImageArrowDown + "</distance_bullet_image_down>\r\n" + "\t\t\t\t<distance_bullet_image_left>" + weapon.ImageArrowLeft + "</distance_bullet_image_left>\r\n" + "\t\t\t\t<distance_bullet_image_right>" + weapon.ImageArrowRight + "</distance_bullet_image_right>\r\n" + "\t\t\t</distance>\r\n"; } } else if (manager.GetKey(enemy.Loot) != null) { KeyItem key = manager.GetKey(enemy.Loot); key.Image = key.Image.Replace('\\', '/'); total += "\t\t\t<key>\r\n" + "\t\t\t\t<key_image>" + key.Image + "</key_image>\r\n" + "\t\t\t\t<key_id>" + key.ID + "</key_id>\r\n" + "\t\t\t</key>\r\n"; } else if (manager.GetConsumable(enemy.Loot) != null) { Consumable consumable = manager.GetConsumable(enemy.Loot); consumable.Image = consumable.Image.Replace('\\', '/'); total += "\t\t\t<consumable>\r\n" + "\t\t\t\t<consumable_image>" + consumable.Image + "</consumable_image>\r\n" + "\t\t\t\t<consumable_affect>" + consumable.Type + "</consumable_affect>\r\n" + "\t\t\t\t<consumable_effect>" + consumable.Effect + "</consumable_effect>\r\n" + "\t\t\t</consumable>\r\n"; } total += "\t\t</enemy>\r\n";; } foreach (Consumable consumable in Consumables) { consumable.Image = consumable.Image.Replace('\\', '/'); total += "\t\t<consumable>\r\n" + "\t\t\t<consumable_image>" + consumable.Image + "</consumable_image>\r\n" + "\t\t\t<consumable_affect>" + consumable.Type + "</consumable_affect>\r\n" + "\t\t\t<consumable_effect>" + consumable.Effect + "</consumable_effect>\r\n" + "\t\t\t<consumable_x_position>" + consumable.PositionX + "</consumable_x_position>\r\n" + "\t\t\t<consumable_y_position>" + consumable.PositionY + "</consumable_y_position>\r\n" + "\t\t</consumable>\r\n"; } foreach (BackgroundItem wall in BgItems) { wall.Image = wall.Image.Replace('\\', '/'); total += "\t\t<wall>\r\n" + "\t\t\t<wall_image>" + wall.Image + "</wall_image>\r\n" + "\t\t\t<wall_x_position>" + wall.PositionX + "</wall_x_position>\r\n" + "\t\t\t<wall_y_position>" + wall.PositionY + "</wall_y_position>\r\n" + "\t\t\t<wall_solid>" + wall.Solid + "</wall_solid>\r\n" + "\t\t\t<wall_bullet_proof>" + wall.BulletProof + "</wall_bullet_proof>\r\n" + "\t\t</wall>\r\n"; } foreach (NPC npc in NonPlayers) { npc.Image = npc.Image.Replace('\\', '/'); npc.DialogImage = npc.DialogImage.Replace('\\', '/'); total += "\t\t<npc>\r\n" + "\t\t\t<npc_image>" + npc.Image + "</npc_image>\r\n" + "\t\t\t<npc_dialog>" + npc.DialogImage + "</npc_dialog>\r\n" + "\t\t\t<npc_x_position>" + npc.PositionX + "</npc_x_position>\r\n" + "\t\t\t<npc_y_position>" + npc.PositionY + "</npc_y_position>\r\n" + "\t\t</npc>\r\n"; } foreach (Weapon weapon in Weapons) { weapon.ImageWeapon = weapon.ImageWeapon.Replace('\\', '/'); int weaponSpeed; if (weapon.Speed == "slow") { weaponSpeed = 1; } else if (weapon.Speed == "normal") { weaponSpeed = 2; } else { weaponSpeed = 3; } if (weapon.Type == "melee") { total += "\t\t<melee>\r\n" + "\t\t\t<melee_image>" + weapon.ImageWeapon + "</melee_image>\r\n" + "\t\t\t<melee_damage>" + weapon.Damage + "</melee_damage>\r\n" + "\t\t\t<melee_speed>" + weaponSpeed + "</melee_speed>\r\n" + "\t\t\t<melee_x_position>" + weapon.PositionX + "</melee_x_position>\r\n" + "\t\t\t<melee_y_position>" + weapon.PositionY + "</melee_y_position>\r\n" + "\t\t</melee>\r\n"; } else { weapon.ImageWeapon = weapon.ImageWeapon.Replace('\\', '/'); weapon.ImageArrowUp = weapon.ImageArrowUp.Replace('\\', '/'); weapon.ImageArrowDown = weapon.ImageArrowDown.Replace('\\', '/'); weapon.ImageArrowLeft = weapon.ImageArrowLeft.Replace('\\', '/'); weapon.ImageArrowRight = weapon.ImageArrowRight.Replace('\\', '/'); total += "\t\t<distance>\r\n" + "\t\t\t<distance_image>" + weapon.ImageWeapon + "</distance_image>\r\n" + "\t\t\t<distance_damage>" + weapon.Damage + "</distance_damage>\r\n" + "\t\t\t<distance_speed>" + weaponSpeed + "</distance_speed>\r\n" + "\t\t\t<distance_bullet_image_up>" + weapon.ImageArrowUp + "</distance_bullet_image_up>\r\n" + "\t\t\t<distance_bullet_image_down>" + weapon.ImageArrowDown + "</distance_bullet_image_down>\r\n" + "\t\t\t<distance_bullet_image_left>" + weapon.ImageArrowLeft + "</distance_bullet_image_left>\r\n" + "\t\t\t<distance_bullet_image_right>" + weapon.ImageArrowRight + "</distance_bullet_image_right>\r\n" + "\t\t\t<distance_x_position>" + weapon.PositionX + "</distance_x_position>\r\n" + "\t\t\t<distance_y_position>" + weapon.PositionY + "</distance_y_position>\r\n" + "\t\t</distance>\r\n"; } } foreach (Door door in Doors) { door.Image = door.Image.Replace('\\', '/'); total += "\t\t<door>\r\n" + "\t\t\t<door_image>" + door.Image + "</door_image>\r\n" + "\t\t\t<door_x_position>" + door.PositionX + "</door_x_position>\r\n" + "\t\t\t<door_y_position>" + door.PositionY + "</door_y_position>\r\n" + "\t\t\t<door_id>" + door.ID + "</door_id>\r\n" + "\t\t</door>\r\n"; } foreach (KeyItem key in Keys) { key.Image = key.Image.Replace('\\', '/'); total += "\t\t<key>\r\n" + "\t\t\t<key_image>" + key.Image + "</key_image>\r\n" + "\t\t\t<key_x_position>" + key.PositionX + "</key_x_position>\r\n" + "\t\t\t<key_y_position>" + key.PositionY + "</key_y_position>\r\n" + "\t\t\t<key_id>" + key.ID + "</key_id>\r\n" + "\t\t</key>\r\n"; } total += "\t</stage>\r\n"; return(total); }
public override string JumbotronBackground(Background background) => $"jumbotron-{ToBackground( background )}";
public MainState(Game1 _game, GraphicsDeviceManager _graphics, ContentManager _content, int id) : base(_game, _graphics, _content, id) { //Carico la mappa background = new Background(_game, _graphics, _content, "maps/mondo"); //Inizializzazione personaggi mainChar = new Character(_game, _graphics, _content, "character/bob", new Vector2(ConstVar.animatedSpriteWidth / 2, ConstVar.animatedSpriteHeigth), new Vector2(0, 0), ConstVar.animatedCols, ConstVar.animatedFrame, ConstVar.animatedSpriteWidth, ConstVar.animatedSpriteHeigth); mainChar.isGamer = true; mainChar.setTilePos(9, 28, background); mainChar.Action += Character_Action; alice = new Character(_game, _graphics, _content, "character/alice", new Vector2(ConstVar.animatedSpriteWidth / 2, ConstVar.animatedSpriteHeigth), new Vector2(0, 0), ConstVar.animatedCols, ConstVar.animatedFrame, ConstVar.animatedSpriteWidth, ConstVar.animatedSpriteHeigth); alice.isGamer = false; alice.setTilePos(47, 22, background); //Inizializzo le finestre di testo ban = new Banner(_game, _graphics, _content, "button/button", new Vector2(ConstVar.displayDim.X / 2, ConstVar.displayDim.Y / 2), "Fonts/Font", ""); gDebug = new gameDebug(_game, _graphics, _content); //All Objects //ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/bananaDebug", new Vector2(0, 0), new Vector2(0, 0), 0.5, Item.Type.ORGANICO, true)); //ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/bananaDebug", new Vector2(0, 0), new Vector2(0, 0), 1, Item.Type.ORGANICO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/banana", new Vector2(0, 0), new Vector2(0, 0), 0.4f, Item.Type.ORGANICO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/lattina", new Vector2(0, 0), new Vector2(0, 0), 0.3f, Item.Type.PLASTICA_MET, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/mela", new Vector2(0, 0), new Vector2(0, 0), 0.2f, Item.Type.ORGANICO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/giornale", new Vector2(0, 0), new Vector2(0, 0), 0.3f, Item.Type.CARTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/accendino", new Vector2(0, 0), new Vector2(0, 0), 0.2f, Item.Type.SECCO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/scatola-cartone", new Vector2(0, 0), new Vector2(0, 0), 0.25f, Item.Type.CARTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/bottiglia-vetro", new Vector2(0, 0), new Vector2(0, 0), 0.3f, Item.Type.VETRO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/bottiglia", new Vector2(0, 0), new Vector2(0, 0), 0.07f, Item.Type.PLASTICA_MET, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/battery", new Vector2(0, 0), new Vector2(0, 0), 0.06f, Item.Type.BATTERIE, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/car-battery", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.BATTERIE, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/tv", new Vector2(0, 0), new Vector2(0, 0), 0.08f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/wooden-chair", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/microwave-oven", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/clothes", new Vector2(0, 0), new Vector2(0, 0), 0.05f, Item.Type.ABITI, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/lamp", new Vector2(0, 0), new Vector2(0, 0), 0.2f, Item.Type.SECCO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/jeans", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.ABITI, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/plastic-sack", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.PLASTICA_MET, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/chemical-containers", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.PLASTICA_MET, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/bucket", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.PLASTICA_MET, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/asciugamani", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.ABITI, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/batteriaHgO", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.BATTERIE, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/batteriaLithium", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.BATTERIE, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/batteriaMiNh", new Vector2(0, 0), new Vector2(0, 0), 0.2f, Item.Type.BATTERIE, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/contenitorePolipropilene", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.PLASTICA_MET, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/cotone", new Vector2(0, 0), new Vector2(0, 0), 0.25f, Item.Type.SECCO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/farmaci1", new Vector2(0, 0), new Vector2(0, 0), 0.2f, Item.Type.FARMACI, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/farmaci2", new Vector2(0, 0), new Vector2(0, 0), 0.2f, Item.Type.FARMACI, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/flaconeBioplastica", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.PLASTICA_MET, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/foglioAlluminio", new Vector2(0, 0), new Vector2(0, 0), 0.2f, Item.Type.PLASTICA_MET, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/lattinaAcciaio", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.PLASTICA_MET, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/olioMinerale", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.OLIOSPECIFICO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/olioGirasole", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.OLIOSPECIFICO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/libri", new Vector2(0, 0), new Vector2(0, 0), 0.2f, Item.Type.CARTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/olioOliva", new Vector2(0, 0), new Vector2(0, 0), 0.15f, Item.Type.OLIOSPECIFICO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/riviste", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.CARTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/scatolaPolistirolo", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.PLASTICA_MET, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/scatoleAlimentari", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.CARTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/tappoSughero", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.SECCO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/toner1", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.TONER, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/toner2", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.TONER, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/toner3", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.TONER, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/vetroMarrone", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.VETRO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/vetroTrasparente", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.VETRO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/mattonciniLego", new Vector2(0, 0), new Vector2(0, 0), 0.25f, Item.Type.PLASTICA_MET, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/toner4", new Vector2(0, 0), new Vector2(0, 0), 0.15f, Item.Type.TONER, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/toner5", new Vector2(0, 0), new Vector2(0, 0), 0.15f, Item.Type.TONER, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/asciugacapelli", new Vector2(0, 0), new Vector2(0, 0), 0.10f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/bilanciaCucina", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/bombolettaSpray", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.PLASTICA_MET, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/borsa", new Vector2(0, 0), new Vector2(0, 0), 0.10f, Item.Type.ABITI, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/cappello", new Vector2(0, 0), new Vector2(0, 0), 0.10f, Item.Type.ABITI, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/caricabatterie", new Vector2(0, 0), new Vector2(0, 0), 0.10f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/cartonePizzaSporca", new Vector2(0, 0), new Vector2(0, 0), 0.15f, Item.Type.SECCO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/cassa", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/chewing-gum", new Vector2(0, 0), new Vector2(0, 0), 0.15f, Item.Type.SECCO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/coperta", new Vector2(0, 0), new Vector2(0, 0), 0.15f, Item.Type.ABITI, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/frullatore", new Vector2(0, 0), new Vector2(0, 0), 0.10f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/insalata", new Vector2(0, 0), new Vector2(0, 0), 0.10f, Item.Type.ORGANICO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/lampadinaLED", new Vector2(0, 0), new Vector2(0, 0), 0.10f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/lettoreMP3", new Vector2(0, 0), new Vector2(0, 0), 0.10f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/liscaPesce", new Vector2(0, 0), new Vector2(0, 0), 0.15f, Item.Type.ORGANICO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/mascheraMare", new Vector2(0, 0), new Vector2(0, 0), 0.15f, Item.Type.SECCO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/matita", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.SECCO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/pannolino", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.SECCO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/scarpe", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.ABITI, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/scontrino", new Vector2(0, 0), new Vector2(0, 0), 0.10f, Item.Type.SECCO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/lavatrice", new Vector2(0, 0), new Vector2(0, 0), 0.15f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/sigaretta", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.SECCO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/uovo", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.ORGANICO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/armadio", new Vector2(0, 0), new Vector2(0, 0), 0.2f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/poltrona", new Vector2(0, 0), new Vector2(0, 0), 0.2f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/ringhiera", new Vector2(0, 0), new Vector2(0, 0), 0.2f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/cellulareRotto", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.CENTRORACCOLTA, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/bicchiere", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.VETRO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/bottigliaBirra", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.VETRO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/carote", new Vector2(0, 0), new Vector2(0, 0), 0.15f, Item.Type.ORGANICO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/lattinaBibita", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.PLASTICA_MET, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/pomata", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.FARMACI, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/tazzinaCaffeVetro", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.VETRO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/termometro", new Vector2(0, 0), new Vector2(0, 0), 0.2f, Item.Type.FARMACI, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/zucca", new Vector2(0, 0), new Vector2(0, 0), 0.15f, Item.Type.ORGANICO, true)); ConstVar.allObjects.Add(new Item(_game, _graphics, _content, "oggetti/bloccoNote", new Vector2(0, 0), new Vector2(0, 0), 0.1f, Item.Type.CARTA, true)); objects = new List <Item>(); //Load effect coinSound = _content.Load <SoundEffect>("soundEffect/coin-dropped"); effectOpenWindow = _content.Load <SoundEffect>("soundEffect/effectOpenWindow"); //for (int i = 0; i<10; i++) { //mainChar.collect(ConstVar.allObjects[i]); } }
public void BackgroundTab() { if (ImGui.BeginTabItem("Backgrounds")) { if (ImGui.Button("Add new Background")) { BackgroundList.Add(new Background(Sprites.GetSprite("spr_cursor"), Vector2.Zero, Vector2.Zero)); } ImGui.SameLine(); //Update if (PlayBackgroundUpdate) { if (ImGui.Button("Stop Background")) { PlayBackgroundUpdate = false; foreach (Background bk in BackgroundList) { bk.Position = Vector2.Zero; } } } else { if (ImGui.Button("Play Background")) { PlayBackgroundUpdate = true; } } ImGui.SameLine(); ImGui.Checkbox("Mouse Parralax", ref MouseIsParralaxPos); ImGui.Separator(); for (int i = 0; i < BackgroundList.Count; i++) { if (ImGui.TreeNode(BackgroundList[i].BackgroundSprite.Name)) { Background bk = BackgroundList[i]; //Draw Sprite List if (ImGui.BeginCombo("Background Sprite", bk.BackgroundSprite.Name)) { for (int b = 0; b < Sprites.SpriteList.Count; b++) { if (ImGui.Selectable(Sprites.SpriteList.Keys[b])) { bk.BackgroundSprite = Sprites.SpriteList.Values[b]; } } ImGui.EndCombo(); } ImGui.Checkbox("xTile", ref bk.xTile); ImGui.Checkbox("yTile", ref bk.yTile); //Position Speed Num.Vector2 pos = new Num.Vector2(bk.Position.X, bk.Position.Y); ImGui.SliderFloat2("Position", ref pos, 0, 0); bk.Position = new Vector2(pos.X, pos.Y); //Scroll Speed Num.Vector2 spd = new Num.Vector2(bk.ScrollSpeed.X, bk.ScrollSpeed.Y); ImGui.SliderFloat2("Speed", ref spd, -5, 5); bk.ScrollSpeed = new Vector2(spd.X, spd.Y); //Parralax Speed Num.Vector2 parra = new Num.Vector2(bk.ParralxMulit.X, bk.ParralxMulit.Y); ImGui.SliderFloat2("Parralax", ref parra, -2, 2); bk.ParralxMulit = new Vector2(parra.X, parra.Y); BackgroundList[i] = bk; ImGui.TreePop(); } } ImGui.EndTabItem(); } }
public abstract void clear(Background background);
public async Task BuyProfileBackgroundAsync(EventContext e) { ArgObject arguments = e.Arguments.FirstOrDefault(); if (arguments.TryParseInt(out int id)) { if (id >= Global.Backgrounds.Backgrounds.Count || id < 0) { e.ErrorEmbed("This background does not exist!") .ToEmbed() .QueueToChannel(e.Channel); return; } Background background = Global.Backgrounds.Backgrounds[id]; var embed = new EmbedBuilder() .SetTitle("Buy Background") .SetImage(background.ImageUrl); if (background.Price > 0) { embed.SetDescription($"This background for your profile will cost {background.Price} mekos, Type `>buybackground {id} yes` to buy."); } else { embed.SetDescription($"This background is not for sale."); } arguments = arguments.Next(); if (arguments?.Argument.ToLower() == "yes") { if (background.Price > 0) { using (var context = new MikiContext()) { User user = await User.GetAsync(context, e.Author); long userId = (long)e.Author.Id; BackgroundsOwned bo = await context.BackgroundsOwned.FindAsync(userId, background.Id); if (bo == null) { await user.AddCurrencyAsync(-background.Price, e.Channel); await context.BackgroundsOwned.AddAsync(new BackgroundsOwned() { UserId = e.Author.Id.ToDbLong(), BackgroundId = background.Id, }); await context.SaveChangesAsync(); e.SuccessEmbed("Background purchased!") .QueueToChannel(e.Channel); } else { throw new BackgroundOwnedException(); } } } } else { embed.ToEmbed() .QueueToChannel(e.Channel); } } }
public static NFP simplifyFunction(NFP polygon, bool inside, SvgNestConfig config) { var tolerance = 4 * config.curveTolerance; // give special treatment to line segments above this length (squared) var fixedTolerance = 40 * config.curveTolerance * 40 * config.curveTolerance; int i, j, k; var hull = Background.getHull(polygon); if (config.simplify) { /* * // use convex hull * var hull = new ConvexHullGrahamScan(); * for(var i=0; i<polygon.length; i++){ * hull.addPoint(polygon[i].x, polygon[i].y); * } * * return hull.getHull();*/ if (hull != null) { return(hull); } else { return(polygon); } } var cleaned = cleanPolygon2(polygon); if (cleaned != null && cleaned.length > 1) { polygon = cleaned; } else { return(polygon); } // polygon to polyline var copy = polygon.slice(0); copy.push(copy[0]); // mark all segments greater than ~0.25 in to be kept // the PD simplification algo doesn't care about the accuracy of long lines, only the absolute distance of each point // we care a great deal for (i = 0; i < copy.length - 1; i++) { var p1 = copy[i]; var p2 = copy[i + 1]; var sqd = (p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y); if (sqd > fixedTolerance) { p1.marked = true; p2.marked = true; } } var simple = Simplify.simplify(copy, tolerance, true); // now a polygon again //simple.pop(); simple.Points = simple.Points.Take(simple.Points.Count() - 1).ToArray(); // could be dirty again (self intersections and/or coincident points) simple = cleanPolygon2(simple); // simplification process reduced poly to a line or point if (simple == null) { simple = polygon; } var offsets = polygonOffsetDeepNest(simple, inside ? -tolerance : tolerance); NFP offset = null; double offsetArea = 0; List <NFP> holes = new List <NFP>(); for (i = 0; i < offsets.Length; i++) { var area = GeometryUtil.polygonArea(offsets[i]); if (offset == null || area < offsetArea) { offset = offsets[i]; offsetArea = area; } if (area > 0) { holes.Add(offsets[i]); } } // mark any points that are exact for (i = 0; i < simple.length; i++) { var seg = new NFP(); seg.AddPoint(simple[i]); seg.AddPoint(simple[i + 1 == simple.length ? 0 : i + 1]); var index1 = find(seg[0], polygon); var index2 = find(seg[1], polygon); if (index1 + 1 == index2 || index2 + 1 == index1 || (index1 == 0 && index2 == polygon.length - 1) || (index2 == 0 && index1 == polygon.length - 1)) { seg[0].exact = true; seg[1].exact = true; } } var numshells = 4; NFP[] shells = new NFP[numshells]; for (j = 1; j < numshells; j++) { var delta = j * (tolerance / numshells); delta = inside ? -delta : delta; var shell = polygonOffsetDeepNest(simple, delta); if (shell.Count() > 0) { shells[j] = shell.First(); } else { //shells[j] = shell; } } if (offset == null) { return(polygon); } // selective reversal of offset for (i = 0; i < offset.length; i++) { var o = offset[i]; var target = getTarget(o, simple, 2 * tolerance); // reverse point offset and try to find exterior points var test = clone(offset); test.Points[i] = new SvgPoint(target.x, target.y); if (!exterior(test, polygon, inside)) { o.x = target.x; o.y = target.y; } else { // a shell is an intermediate offset between simple and offset for (j = 1; j < numshells; j++) { if (shells[j] != null) { var shell = shells[j]; var delta = j * (tolerance / numshells); target = getTarget(o, shell, 2 * delta); test = clone(offset); test.Points[i] = new SvgPoint(target.x, target.y); if (!exterior(test, polygon, inside)) { o.x = target.x; o.y = target.y; break; } } } } } // straighten long lines // a rounded rectangle would still have issues at this point, as the long sides won't line up straight var straightened = false; for (i = 0; i < offset.length; i++) { var p1 = offset[i]; var p2 = offset[i + 1 == offset.length ? 0 : i + 1]; var sqd = (p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y); if (sqd < fixedTolerance) { continue; } for (j = 0; j < simple.length; j++) { var s1 = simple[j]; var s2 = simple[j + 1 == simple.length ? 0 : j + 1]; var sqds = (p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y); if (sqds < fixedTolerance) { continue; } if ((GeometryUtil._almostEqual(s1.x, s2.x) || GeometryUtil._almostEqual(s1.y, s2.y)) && // we only really care about vertical and horizontal lines GeometryUtil._withinDistance(p1, s1, 2 * tolerance) && GeometryUtil._withinDistance(p2, s2, 2 * tolerance) && (!GeometryUtil._withinDistance(p1, s1, config.curveTolerance / 1000) || !GeometryUtil._withinDistance(p2, s2, config.curveTolerance / 1000))) { p1.x = s1.x; p1.y = s1.y; p2.x = s2.x; p2.y = s2.y; straightened = true; } } } //if (straightened) { var Ac = _Clipper.ScaleUpPaths(offset, 10000000); var Bc = _Clipper.ScaleUpPaths(polygon, 10000000); var combined = new List <List <IntPoint> >(); var clipper = new ClipperLib.Clipper(); clipper.AddPath(Ac.ToList(), ClipperLib.PolyType.ptSubject, true); clipper.AddPath(Bc.ToList(), ClipperLib.PolyType.ptSubject, true); // the line straightening may have made the offset smaller than the simplified if (clipper.Execute(ClipperLib.ClipType.ctUnion, combined, ClipperLib.PolyFillType.pftNonZero, ClipperLib.PolyFillType.pftNonZero)) { double?largestArea = null; for (i = 0; i < combined.Count; i++) { var n = Background.toNestCoordinates(combined[i].ToArray(), 10000000); var sarea = -GeometryUtil.polygonArea(n); if (largestArea == null || largestArea < sarea) { offset = n; largestArea = sarea; } } } } cleaned = cleanPolygon2(offset); if (cleaned != null && cleaned.length > 1) { offset = cleaned; } #region experimental if (config.clipByHull) { offset = ClipSubject(offset, hull, config.clipperScale); } else if (config.clipByRects) { NFP rect1 = boundingBox(hull); offset = ClipSubject(offset, rect1, config.clipperScale); var mbox = GetMinimumBox(hull); offset = ClipSubject(offset, mbox, config.clipperScale); } #endregion // mark any points that are exact (for line merge detection) for (i = 0; i < offset.length; i++) { var seg = new SvgPoint[] { offset[i], offset[i + 1 == offset.length ? 0 : i + 1] }; var index1 = find(seg[0], polygon); var index2 = find(seg[1], polygon); if (index1 == null) { index1 = 0; } if (index2 == null) { index2 = 0; } if (index1 + 1 == index2 || index2 + 1 == index1 || (index1 == 0 && index2 == polygon.length - 1) || (index2 == 0 && index1 == polygon.length - 1)) { seg[0].exact = true; seg[1].exact = true; } } if (!inside && holes != null && holes.Count > 0) { offset.children = holes; } return(offset); }
protected override void OnHoverLost(HoverLostEvent e) { Background.FadeTo(0, 200); base.OnHoverLost(e); }
/// <summary> /// To initialize UI Components of an application information page /// </summary> private void InitializeComponent() { Title = "ApplicationInfo"; /// The mainLayout consists of several parts to display application information. var mainLayout = new RelativeLayout { }; /// To display an image as the background var background = new Background { Image = new FileImageSource { File = "background_app.png" }, Option = BackgroundOptions.Stretch, }; mainLayout.Children.Add( background, Constraint.RelativeToParent((parent) => { return(0); }), Constraint.RelativeToParent((parent) => { return(0); }), Constraint.RelativeToParent((parent) => { return(parent.Width); }), Constraint.RelativeToParent((parent) => { return(parent.Height); })); /// To display an application icon path var icon = new Image { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, }; mainLayout.Children.Add( icon, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.0556); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.0537); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.1319); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.0774); })); /// To display an application name var applicationName = new Label { }; applicationName.Style = ApplicationInformationStyle.ContentStyle; mainLayout.Children.Add( applicationName, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.2472); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.0961); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.7389); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.0293); })); /// To display an application ID var applicationID = new Label { }; applicationID.Style = ApplicationInformationStyle.ContentStyle; mainLayout.Children.Add( applicationID, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.0375); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.3014); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.4486); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.0519); })); /// To display an application version var applicationVersion = new Label { }; applicationVersion.Style = ApplicationInformationStyle.ContentStyle; mainLayout.Children.Add( applicationVersion, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.5416); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.3014); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.4486); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.0319); })); /// To display the device memory status var memoryLED = new Image { Source = "led.png" }; mainLayout.Children.Add( memoryLED, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.0375); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.4661); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.0236); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.0152); })); /// To display the device battery status var batteryLED = new Image { Source = "led.png" }; mainLayout.Children.Add( batteryLED, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.5416); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.4661); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.0236); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.0152); })); /// To display the language setting on the device var language = new Label { }; language.Style = ApplicationInformationStyle.ContentStyle; mainLayout.Children.Add( language, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.0375); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.7032); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.4486); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.0319); })); /// To display the region format setting on the device var regionFormat = new Label { }; regionFormat.Style = ApplicationInformationStyle.ContentStyle; mainLayout.Children.Add( regionFormat, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.5416); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.7032); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.4486); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.0319); })); /// To display the orientation of the device var deviceOrienation = new Label { }; deviceOrienation.Style = ApplicationInformationStyle.ContentStyle; mainLayout.Children.Add( deviceOrienation, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.0375); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.9109); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.4661); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.0321); })); /// To display the orientation degree of the device var rotationDegree = new Label { }; rotationDegree.Style = ApplicationInformationStyle.LargerContentStyle; mainLayout.Children.Add( rotationDegree, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.5416); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.8254); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.4486); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.1276); })); BindingContextChanged += (s, e) => { if (BindingContext == null) { return; } icon.Source = ((ApplicationInformationViewModel)BindingContext).IconPath; applicationName.Text = ((ApplicationInformationViewModel)BindingContext).Name; applicationID.Text = ((ApplicationInformationViewModel)BindingContext).ID; applicationVersion.Text = ((ApplicationInformationViewModel)BindingContext).Version; memoryLED.BindingContext = BindingContext; batteryLED.BindingContext = BindingContext; language.BindingContext = BindingContext; regionFormat.BindingContext = BindingContext; deviceOrienation.BindingContext = BindingContext; rotationDegree.BindingContext = BindingContext; language.SetBinding(Label.TextProperty, "Language"); regionFormat.SetBinding(Label.TextProperty, "RegionFormat"); deviceOrienation.SetBinding(Label.TextProperty, "DeviceOrientation"); rotationDegree.SetBinding(Label.TextProperty, "RotationDegree"); memoryLED.SetBinding(ImageAttributes.BlendColorProperty, "LowMemoryLEDColor"); batteryLED.SetBinding(ImageAttributes.BlendColorProperty, "LowBatteryLEDColor"); }; /// Set mainLayout as Content of the page Content = mainLayout; }
private async Task WritePacketAsync(SendPacket packet) { _connectedEvent.WaitOne(); DisconnectedEventArgs disconnectedArgs = null; try { // determine if we know the payload length and end if (!packet.IsLengthKnown) { var count = await packet.Payload.ReadAsync(_sendContentBuffer, 0, TransportConstants.MaxPayloadLength).ConfigureAwait(false); packet.Header.PayloadLength = count; packet.Header.End = count == 0; } int length; var headerLength = HeaderSerializer.Serialize(packet.Header, _sendHeaderBuffer, 0); // Send: Packet Header length = await _sender.SendAsync(_sendHeaderBuffer, 0, headerLength).ConfigureAwait(false); if (length == 0) { throw new TransportDisconnectedException(); } var offset = 0; // Send content in chunks if (packet.Header.PayloadLength > 0 && packet.Payload != null) { // If we already read the buffer, send that // If we did not, read from the stream until we've sent that amount if (!packet.IsLengthKnown) { // Send: Packet content length = await _sender.SendAsync(_sendContentBuffer, 0, packet.Header.PayloadLength).ConfigureAwait(false); if (length == 0) { throw new TransportDisconnectedException(); } } else { do { var count = Math.Min(packet.Header.PayloadLength - offset, TransportConstants.MaxPayloadLength); // copy the stream to the buffer count = await packet.Payload.ReadAsync(_sendContentBuffer, 0, count).ConfigureAwait(false); // Send: Packet content length = await _sender.SendAsync(_sendContentBuffer, 0, count).ConfigureAwait(false); if (length == 0) { throw new TransportDisconnectedException(); } offset += count; }while (offset < packet.Header.PayloadLength); } } if (packet.SentCallback != null) { Background.Run(() => packet.SentCallback(packet.Header)); } } catch (Exception e) { disconnectedArgs = new DisconnectedEventArgs() { Reason = e.Message, }; Disconnect(disconnectedArgs); } }
private void dimChanged(object sender, EventArgs e) { Background?.FadeTo((100f - dimLevel) / 100, 800); }
public virtual string CardBackground(Background background) => Color(background);
public SimonSaysState(Background background, GameStateManager gsm, Textures textures) : base(background, gsm, textures) { this.InitializeButtons(); this.InitializeSoundEffects(); }
protected override void Serialize(IDictionary <string, object> json) { //>> Serialization if (Editable.HasValue) { json["editable"] = Editable; } if (Rotatable.HasValue) { json["rotatable"] = Rotatable; } if (Resizable.HasValue) { json["resizable"] = Resizable; } if (Path.HasValue()) { json["path"] = Path; } var stroke = Stroke.ToJson(); if (stroke.Any()) { json["stroke"] = stroke; } if (Type.HasValue()) { json["type"] = Type; } if (X.HasValue) { json["x"] = X; } if (Y.HasValue) { json["y"] = Y; } if (MinWidth.HasValue) { json["minWidth"] = MinWidth; } if (MinHeight.HasValue) { json["minHeight"] = MinHeight; } if (Width.HasValue) { json["width"] = Width; } if (Height.HasValue) { json["height"] = Height; } if (Background.HasValue()) { json["background"] = Background; } var hover = Hover.ToJson(); if (hover.Any()) { json["hover"] = hover; } var connectors = Connectors.ToJson(); if (connectors.Any()) { json["connectors"] = connectors; } var rotation = Rotation.ToJson(); if (rotation.Any()) { json["rotation"] = rotation; } if (Content.HasValue()) { json["content"] = Content; } //<< Serialization if (Visual.HasValue()) { json["visual"] = Visual; } }