コード例 #1
0
        public UISwitchAvatarPanel(TS1GameScreen screen)
        {
            Game = screen;
            Bg   = Content.Get().CustomUI.Get("pswitch_bg.png").Get(GameFacade.GraphicsDevice);

            var familyMembers = Game.vm.Context.ObjectQueries.Avatars.Where(x => ((VMAvatar)x).GetPersonData(FSO.SimAntics.Model.VMPersonDataVariable.TS1FamilyNumber) == (Game.vm.CurrentFamily.ChunkID));
            int i             = 0;

            foreach (var fam in familyMembers)
            {
                var btn = new UIAvatarSelectButton(UIIconCache.GetObject(fam));
                if (fam.PersistID > 0)
                {
                    btn.Outlined = true;
                }
                btn.Opacity = 0f;
                var id = fam.ObjectID;
                btn.OnButtonClick += (b) => { Select(id); };
                btn.Y              = 64;
                GameFacade.Screens.Tween.To(btn, 0.3f, new Dictionary <string, float>()
                {
                    { "X", 185 + (i++) * 100 }, { "Opacity", 1f }
                }, TweenQuad.EaseOut);
                Add(btn);
            }
        }
コード例 #2
0
        public void PopulateList(FAMI family)
        {
            var world = new FSO.LotView.World(GameFacade.GraphicsDevice);

            world.Initialize(GameFacade.Scenes);
            var context = new VMContext(world);
            var vm      = new VM(context, new VMServerDriver(new VMTS1GlobalLinkStub()), new VMNullHeadlineProvider());

            vm.Init();
            var blueprint = new Blueprint(1, 1);

            //world.InitBlueprint(blueprint);
            context.Blueprint    = blueprint;
            context.Architecture = new VMArchitecture(1, 1, blueprint, vm.Context);

            int i     = 0;
            var baseX = 0;

            foreach (var sim in family.FamilyGUIDs)
            {
                var fam = vm.Context.CreateObjectInstance(sim, LotTilePos.OUT_OF_WORLD, Direction.NORTH, true).BaseObject;
                var btn = new UIAvatarSelectButton(UIIconCache.GetObject(fam));
                btn.Opacity = 1f;
                var id = i;
                btn.Name = fam.Name;
                btn.X    = baseX + (i++) * 100;
                btn.Y    = 0;
                btn.DeregisterHandler();
                Btns.Add(btn);
                Add(btn);
                fam.Delete(true, vm.Context);
            }
            world.Dispose();
        }
コード例 #3
0
        public UISwitchAvatarPanel(TS1GameScreen screen)
        {
            Game = screen;
            Bg   = Content.Get().CustomUI.Get("pswitch_bg.png").Get(GameFacade.GraphicsDevice);

            var familyMembers = Game.vm.Context.ObjectQueries.Avatars.Where(x => Game.vm.TS1State.CurrentFamily.RuntimeSubset.Contains(x.Object.OBJ.GUID));
            int i             = 0;

            foreach (var fam in familyMembers)
            {
                var btn = new UIAvatarSelectButton(UIIconCache.GetObject(fam));
                btn.Name = fam.Name;
                if (fam.PersistID > 0)
                {
                    btn.Outlined = true;
                }
                btn.Opacity = 0f;
                var id = fam.ObjectID;
                btn.OnButtonClick += (b) => { Select(id); };
                btn.Y              = 54;
                GameFacade.Screens.Tween.To(btn, 0.3f, new Dictionary <string, float>()
                {
                    { "X", 185 + (i++) * 100 }, { "Opacity", 1f }
                }, TweenQuad.EaseOut);
                Add(btn);
            }
        }