コード例 #1
0
 public DebugHelper(GameObjectCollection col, ContentManager Content, bool FullDebug, bool texton)
 {
     this.col       = col;
     this.FullDebug = FullDebug;
     this.texton    = texton;
     font           = Content.Load <SpriteFont>("Font1");
     mRect          = new Rectangle(0, 0, 1, 1);
 }
コード例 #2
0
        public static GameObjectCollection MakeCollection(string file, string contentpath, ContentManager Content)
        {
            string list                  = new StreamReader(file).ReadToEnd();
            GameObjectCollection b       = new GameObjectCollection();
            List <string>        temp    = new List <string>();
            List <string>        parsed1 = new List <string>(Parse(list, ";"));
            List <string>        parsed2 = new List <string>();

            Dictionary <string, Vector2> objectCreator = new Dictionary <string, Vector2>();

            foreach (string i in parsed1)
            {
                if (i.Contains("\r\n"))
                {
                    parsed2.Add(i.Substring(2, i.Length - 2));
                }
                else
                {
                    parsed2.Add(i);
                }
            }

            parsed1 = new List <string>(parsed2);
            parsed2.Clear();

            foreach (string i in parsed1)
            {
                string[] p = Parse(i, ":");
                parsed2.Add(p[1]);
                temp.Add(p[0]);
            }

            parsed1 = new List <string>(temp);

            for (int i = 0; i < parsed1.Count; i++)
            {
                string[] p = Parse(parsed2[i], ",");
                objectCreator.Add(parsed1[i], new Vector2(float.Parse(p[0]), float.Parse(p[1])));
            }

            foreach (string key in objectCreator.Keys)
            {
                b.Items.Add(key, new GameObject(objectCreator[key], key, contentpath, Content));
            }

            temp.Clear();
            parsed1.Clear();
            parsed2.Clear();
            objectCreator.Clear();

            return(b);
        }