Пример #1
0
        private void TestForm1_Load(object sender, EventArgs e)
        {
            GameService.Instance.Initialize(ExecuteMode.RunTime, xnaControl1.GraphicsDevice);
            Graphics = GameService.Instance.QueryModule<GraphicsModule>();

            ContentSetData csInfo = new ContentSetData();
            csInfo.Id = GameService.Instance.QueryModule<UIDStackModule>().Take(typeof(ContentSetData));
            csInfo.Name = "Default";
            GameService.Instance.QueryModule<ContentManager>().AddContentSet(csInfo);

            ContentData fontInfo = new ContentData();
            fontInfo.Id = -1;
            fontInfo.Key = "Content/Font/Default";
            fontInfo.Type = ContentType.Font;
            GameService.Instance.QueryModule<ContentManager>().AddContent(csInfo.Id, fontInfo);

            ContentData texInfo = new ContentData();
            texInfo.Id = -1;
            texInfo.Key = "Content/Texture/Char";
            texInfo.Type = ContentType.Texture;
            GameService.Instance.QueryModule<ContentManager>().AddContent(csInfo.Id, texInfo);

            GameService.Instance.QueryModule<ContentManager>().LoadCombra(csInfo.Id);

            pos = Vector2.Zero;
            speed = new Vector2(80f, 60f);
            textSize = new Vector2(30, 150);// GameManager.Instance.GraphicsMgr.MeasureString("Default", "Hello World");
        }
Пример #2
0
        public ContentSet(ContentSetData data)
        {
            this.Id = data.Id;
            this.Name = data.Name;

            ContentList = new List<Content>();
            foreach (ContentData ri in data.ContentDataList)
            {
                Content c = new Content(ri);
                ContentList.Add(c);
            }
        }
Пример #3
0
        public void AddContentSet(ContentSetData data)
        {
            // 若有同名资源集,则先将其卸载
            ContentSet existed = ContentSetList.Find(s => s.Id == data.Id);
            if (existed != null)
            {
                return;
            }

            ContentSet newSet = new ContentSet(data);
            newSet.ContentMgr = new Microsoft.Xna.Framework.Content.ContentManager(GameService.Instance.Services);

            ContentSetList.Add(newSet);
        }
Пример #4
0
        public ContentSetData CreateContentSetData()
        {
            ContentSetData csInfo = new ContentSetData();
            csInfo.Name = this.Name;
            foreach (ResourceData ri in ResourceDataList)
            {
                ContentData ci = new ContentData();
                ci.Id = ri.ContentId;
                ci.Key = ri.ContentKey;
                ci.Type = ri.ContentType;
                csInfo.ContentDataList.Add(ci);
            }

            return csInfo;
        }