Esempio n. 1
0
        public void LoadContent(ContentManager Content)
        {
            if (charNames.Count > 0)
            {
                for (int i = 0; i < 4; i++) {
                    this.charThumbs[selected[i]].unlock();
                    //this.connected[i] = false;
                    //this.selected[i] = 0;
                    this.locked[i] = false;
                    back[i] = true;

                }

                return;
            }

            for(int i = 0; i < 4; i++)
            {
                playerSelect[i] = Content.Load<Texture2D>("MenuData/S" + (i + 1).ToString());
            }

            Vector2 negPos = new Vector2(0, 0);
            Vector2 offset = new Vector2(-4, -4);
            Texture2D bar = Content.Load<Texture2D>("bar");
            /*for (int i = 0; i < 4; i++)
            {
                if (players[i] != null && players[i].active)
                {
                    players[i].Initialize(Content.Load<Texture2D>(default_charName), negPos, screenSize, null, players, offset, bar);
                }
            }*/

            background = Content.Load<Texture2D>("MenuData/characterselect");
            loadScreen = Content.Load<Texture2D>("controller2");

            //Gets a list of all the .char files in our chardata folder, Platform specific paths
            #if WINDOWS
            chars = Directory.EnumerateFiles(Environment.CurrentDirectory + "\\Content\\CharData", "*.char");
            #elif LINUX
            chars = Directory.EnumerateFiles(Environment.CurrentDirectory + "/Content/CharData", "*.char");
            #endif

            //For each char file, slice off the path to store just the char's name.
            foreach (string path in chars)
            {
                string charName = path.Remove(0, Environment.CurrentDirectory.Length + "\\Content\\CharData\\".Length);
                charName = charName.Replace(".char", "");
                charNames.Add(charName);
                Texture2D charThumbtext = Content.Load<Texture2D>("CharData/"+charName);
                ImageButton thumb = new ImageButton(charThumbtext, new Vector2(), charName, playerSelect);
                thumb.useMultiSelect();
                thumb.setSize(new Vector2(200, 200));
                charThumbs.Add(thumb);
            }

            positionThumbs(charThumbs);
        }