Exemple #1
0
 Get <T, R, B, C>(
     string MainBackround = "MainBackround",
     string DarkBackround = "DarkBackround")
     where B : CrossBrush <R, C>, new()
     where C : Color, new()
     where T : CustomBackground <R, B, C>
 {
     return(CustomBackground <R, B, C> .Get <T>(MainBackround, DarkBackround));
 }
 Get <T>
 (
     string MainBackround = "MainBackround",
     string DarkBackround = "DarkBackround")
     where T : CustomBackground <System.Windows.Media.Brush, Brush, Color>
 {
     return(CustomBackground <System.Windows.Media.Brush, Kit.WPF.Controls.Brush.Brush, Kit.WPF.Controls.Brush.Color>
            .Get <T>(MainBackround, DarkBackround));
 }
Exemple #3
0
 Get <T>
 (
     string MainBackround = "MainBackround",
     string DarkBackround = "DarkBackround")
     where T : CustomBackground <Xamarin.Forms.Brush,
                                 Kit.Forms.Controls.Brush.Brush,
                                 Kit.Forms.Controls.Brush.Color>
 {
     return(CustomBackground <Xamarin.Forms.Brush,
                              Kit.Forms.Controls.Brush.Brush,
                              Kit.Forms.Controls.Brush.Color>
            .Get <T>(MainBackround, DarkBackround));
 }
        /// <summary>Adds or updates the set of currently active backgrounds.</summary>
        /// <remarks>
        /// Backgrounds are stored in the <see cref="ActiveBackgrounds"/> dictionary with unique string keys.
        /// See the <see cref="CustomBackground"/> class for information on available settings.
        /// Note that overwriting an existing background with a <see cref="CustomBackground.Movement"/> setting will cause it to reset.
        /// </remarks>
        private static void UpdateBackgrounds()
        {
            if (!Context.IsWorldReady)
            {
                return;
            }

            if (r == null)
            {
                r = new Random((int)(Game1.uniqueIDForThisGame % 1000) + SDate.Now().DaysSinceStart); //use game ID + day count as a seed for randomization
            }
            if (ActiveBackgrounds.Count == 0)                                                         //if no backgrounds are currently loaded
            {
                //add any backgrounds that should always exist
                ActiveBackgrounds["Highlands Background"] = new CustomBackground("Custom_Highlands", "Maps/HighlandsBackground")
                {
                    RepeatX  = true,
                    Parallax = new Vector2(0.2f, 0.2f),
                };

                //
                //commented out below: small cloud sprite creation
                //

                /***
                 *
                 * for (int numberOfClouds = r.Next(1, 6); numberOfClouds > 0; numberOfClouds--) //generate 1 to 5 clouds (note the max number is exclusive)
                 * {
                 *  //choose a random tile and convert it to pixels
                 *  Vector2 position = new Vector2(r.Next(highlandsCloudZone.X, highlandsCloudZone.Width), r.Next(highlandsCloudZone.Y, highlandsCloudZone.Height)) * 64;
                 *
                 *  ActiveBackgrounds["Highlands Cloud " + numberOfClouds] = new CustomBackground("Custom_Highlands", "LooseSprites/Cursors")
                 *  {
                 *      TextureArea = new Rectangle(230, 1303, 58, 19),
                 *      Position = position,
                 *      Parallax = new Vector2(0.1f, 0.1f),
                 *      Movement = new Vector2(0.2f, 0f),
                 *      Priority = 1 //higher than the main background
                 *  };
                 * }
                 *
                 ***/
            }

            //add conditional backgrounds below or update/replace existing ones

            //
            //commented out below: logic that resets cloud positions if they leave the screen
            //

            /***
             *
             * foreach (var background in ActiveBackgrounds)
             * {
             *  if (background.Key.StartsWith("Highlands Cloud", StringComparison.Ordinal)) //if this is a cloud
             *  {
             *      if (background.Value.Position.X >= 9984) //if this cloud is completely past the right edge of the map
             *      {
             *          //move it before the left edge of the background & randomly choose a new height
             *          background.Value.Position = new Vector2(53, r.Next(highlandsCloudZone.Y, highlandsCloudZone.Height)) * 64;
             *      }
             *  }
             * }
             *
             ***/
        }
Exemple #5
0
        public Tela_Home()
        {
            InitializeComponent();
            int              Espaçamento        = 20;
            Point            Posição            = new Point(23, 25);
            Consultar        Consulta           = new Consultar();
            Notificação      Notificação        = new Notificação();
            Departamento     Departamento       = new Departamento();
            DataTable        Table_Notificação  = new DataTable();
            DataTable        Table_Departamento = new DataTable();
            Custom_Card      Card_Notificação   = new Custom_Card();
            CustomBackground BackGround         = new CustomBackground();
            Image            IconeMapa          = Properties.Resources.icone_mapa;
            Image            IconeCalendario    = Properties.Resources.icone_calendario;


            Table_Notificação = Consulta.Notificação(Notificação, 2);
            if (Table_Notificação.Rows.Count > 0)
            {
                //Deleta o ID Da tabela para facilitar a minha vida.
                Table_Notificação.Columns.Remove("ID_NOTIFICACAO");

                for (int NumNotificaçoes = (Table_Notificação.Rows.Count - 1); NumNotificaçoes >= 0; NumNotificaçoes--)
                {
                    //Cria as Notificações na tela
                    Card_Notificação          = new Custom_Card();
                    Card_Notificação.Name     = "NotificaçãoNumero" + Convert.ToString(NumNotificaçoes);
                    Card_Notificação.Location = Posição;
                    Posição.Y = Posição.Y + Card_Notificação.Size.Height + Espaçamento;

                    /*
                     * Tabela:
                     *      Coluna
                     *      0               1       2       3
                     *      ID_DEPARTAMENTO	TITULO	IMAGEM	DESCRICAO
                     * Linha   0
                     *      1
                     *
                     * -------------------------------X-------------------------------
                     * Caminho das Imagens Fica o seguinte:
                     *
                     * ./NotificacaoIcones/NomedoIcone.png
                     *
                     */
                    //Elementos vindo da Tabela do Departamento
                    Departamento.ID_Departamento    = Convert.ToInt32(Table_Notificação.Rows[NumNotificaçoes][0]);
                    Table_Departamento              = Consulta.Departamento(Departamento, 3);
                    Card_Notificação.SubTitulo_Card = Convert.ToString(Table_Departamento.Rows[0][2]);

                    //Elementos vindo da Tabela do Notificação
                    Card_Notificação.Titulo_Card = Convert.ToString(Table_Notificação.Rows[NumNotificaçoes][1]);
                    Card_Notificação.Texto_Card  = Convert.ToString(Table_Notificação.Rows[NumNotificaçoes][3]);

                    //Testa para qual Icone adiconar
                    if (Convert.ToString(Table_Notificação.Rows[NumNotificaçoes][2]) == "icone_mapa")
                    {
                        Card_Notificação.Icone = IconeMapa;
                    }
                    if (Convert.ToString(Table_Notificação.Rows[NumNotificaçoes][2]) == "icone_calendario")
                    {
                        Card_Notificação.Icone = IconeCalendario;
                    }
                    this.Controls.Add(Card_Notificação);
                }
                this.Controls.Add(BackGround);
            }
        }