public UIWallPainter(VM vm, World world, UILotControl parent, List<int> parameters)
        {
            Pattern = (ushort)parameters[0];

            this.vm = vm;
            World = parent.World;
            Parent = parent;
            WallCursor = vm.Context.CreateObjectInstance(0x00000439, LotTilePos.OUT_OF_WORLD, tso.world.model.Direction.NORTH);

            ((ObjectComponent)WallCursor.Objects[0].WorldUI).ForceDynamic = true;
            Commands = new List<VMArchitectureCommand>();

            SetCursorGraphic(2);
        }
        public UIWallPlacer(VM vm, World world, UILotControl parent, List<int> parameters)
        {
            Pattern = (ushort)parameters[0];
            Style = (ushort)parameters[1];
            if (Style == 1)
            {
                DrawPattern = 255;
                DrawStyle = 255;
            } else
            {
                DrawPattern = Pattern;
                DrawStyle = Style;
            }

            this.vm = vm;
            World = parent.World;
            Parent = parent;
            WallCursor = vm.Context.CreateObjectInstance(0x00000439, LotTilePos.OUT_OF_WORLD, tso.world.model.Direction.NORTH);

            ((ObjectComponent)WallCursor.Objects[0].WorldUI).ForceDynamic = true;
        }
Esempio n. 3
0
        public VMMultitileGroup CreateObjectInstance(UInt32 GUID, LotTilePos pos, Direction direction, short MainStackOBJ, short MainParam)
        {
            VMMultitileGroup group = new VMMultitileGroup();
            var objDefinition = TSO.Content.Content.Get().WorldObjects.Get(GUID);
            if (objDefinition == null)
            {
                return null;
            }

            var master = objDefinition.OBJ.MasterID;
            if (master != 0)
            {
                group.MultiTile = true;
                var objd = objDefinition.Resource.List<OBJD>();

                for (int i = 0; i < objd.Count; i++)
                {
                    if (objd[i].MasterID == master && objd[i].SubIndex != -1) //if sub-part of this object, make it!
                    {
                        var subObjDefinition = TSO.Content.Content.Get().WorldObjects.Get(objd[i].GUID);
                        if (subObjDefinition != null)
                        {
                            var worldObject = new ObjectComponent(subObjDefinition);
                            var vmObject = new VMGameObject(subObjDefinition, worldObject);
                            vmObject.MasterDefinition = objDefinition.OBJ;
                            vmObject.UseTreeTableOf(objDefinition);

                            vmObject.MainParam = MainParam;
                            vmObject.MainStackOBJ = MainStackOBJ;
                            group.Objects.Add(vmObject);

                            vmObject.MultitileGroup = group;
                            VM.AddEntity(vmObject);

                        }
                    }
                }

                group.Init(this);
                VMPlacementError couldPlace = group.ChangePosition(pos, direction, this);
                if (couldPlace != VMPlacementError.Success);
                return group;
            }
            else
            {
                if (objDefinition.OBJ.ObjectType == OBJDType.Person) //person
                {
                    var vmObject = new VMAvatar(objDefinition);
                    vmObject.MultitileGroup = group;
                    group.Objects.Add(vmObject);
                    VM.AddEntity(vmObject);

                    Blueprint.AddAvatar((AvatarComponent)vmObject.WorldUI);

                    vmObject.MainParam = MainParam;
                    vmObject.MainStackOBJ = MainStackOBJ;

                    group.Init(this);
                    vmObject.SetPosition(pos, direction, this);

                    return group;
                }
                else
                {
                    var worldObject = new ObjectComponent(objDefinition);
                    var vmObject = new VMGameObject(objDefinition, worldObject);

                    vmObject.MultitileGroup = group;
                    group.Objects.Add(vmObject);

                    VM.AddEntity(vmObject);

                    vmObject.MainParam = MainParam;
                    vmObject.MainStackOBJ = MainStackOBJ;

                    group.Init(this);
                    vmObject.SetPosition(pos, direction, this);

                    return group;
                }
            }
        }
        void Catalog_OnSelectionChange(int selection)
        {
            var item = CurrentCategory[selection];
            if (OldSelection != -1) Catalog.SetActive(OldSelection, false);
            Catalog.SetActive(selection, true);

            if (LotController.CustomControl != null)
            {
                LotController.CustomControl.Release();
                LotController.CustomControl = null;
            }

            if (item.Special != null)
            {
                QueryPanel.Active = false;
                LotController.CustomControl = (UICustomLotControl)Activator.CreateInstance(item.Special.Control, vm, LotController.World, LotController, item.Special.Parameters);
            }
            else
            {
                if (BuyItem != null && Holder.Holding != null && BuyItem == Holder.Holding.Group)
                {
                    BuyItem.Delete(vm.Context);
                }

                BuyItem = vm.Context.CreateObjectInstance(item.GUID, LotTilePos.OUT_OF_WORLD, Direction.NORTH);
                QueryPanel.SetInfo(BuyItem.Objects[0], false);
                QueryPanel.Mode = 1;
                QueryPanel.Tab = 0;
                QueryPanel.Active = true;
                Holder.SetSelected(BuyItem);
            }

            OldSelection = selection;
        }
 public void SetSelected(VMMultitileGroup Group)
 {
     if (Holding != null) ClearSelected();
     Holding = new UIObjectSelection();
     Holding.Group = Group;
     Holding.PreviousTile = Holding.Group.BaseObject.Position;
     Holding.Dir = Group.Objects[0].Direction;
     VMEntity[] CursorTiles = new VMEntity[Group.Objects.Count];
     for (int i = 0; i < Group.Objects.Count; i++)
     {
         var target = Group.Objects[i];
         if (target is VMGameObject) ((ObjectComponent)target.WorldUI).ForceDynamic = true;
         CursorTiles[i] = vm.Context.CreateObjectInstance(0x00000437, new LotTilePos(target.Position), tso.world.model.Direction.NORTH).Objects[0];
         CursorTiles[i].SetPosition(new LotTilePos(0,0,1), Direction.NORTH, vm.Context);
         ((ObjectComponent)CursorTiles[i].WorldUI).ForceDynamic = true;
     }
     Holding.TilePosOffset = new Vector2(0, 0);
     Holding.CursorTiles = CursorTiles;
 }
Esempio n. 6
0
 void Catalog_OnSelectionChange(int selection)
 {
     if (BuyItem != null && Holder.Holding != null && BuyItem == Holder.Holding.Group) {
         BuyItem.Delete(vm.Context);
     }
     if (OldSelection != -1) Catalog.SetActive(OldSelection, false);
     Catalog.SetActive(selection, true);
     BuyItem = vm.Context.CreateObjectInstance(CurrentCategory[selection].GUID, LotTilePos.OUT_OF_WORLD, Direction.NORTH);
     QueryPanel.SetInfo(BuyItem.Objects[0], false);
     QueryPanel.Mode = 1;
     QueryPanel.Tab = 0;
     QueryPanel.Active = true;
     Holder.SetSelected(BuyItem);
     OldSelection = selection;
 }
Esempio n. 7
0
        public VMEntity CreateObjectInstance(UInt32 GUID, short x, short y, sbyte level, Direction direction)
        {
            var objDefinition = TSO.Content.Content.Get().WorldObjects.Get(GUID);
            if (objDefinition == null)
            {
                return null;
            }

            var master = objDefinition.OBJ.MasterID;
            if (master != 0)
            {
                var objd = objDefinition.Resource.List<OBJD>();
                VMMultitileGroup group = new VMMultitileGroup();

                for (int i = 0; i < objd.Count; i++)
                {
                    if (objd[i].MasterID == master && objd[i].SubIndex != -1) //if sub-part of this object, make it!
                    {
                        var subObjDefinition = TSO.Content.Content.Get().WorldObjects.Get(objd[i].GUID);
                        if (subObjDefinition != null)
                        {
                            var worldObject = new ObjectComponent(subObjDefinition);
                            var vmObject = new VMGameObject(subObjDefinition, worldObject);
                            vmObject.MasterDefinition = objDefinition.OBJ;
                            vmObject.UseTreeTableOf(objDefinition);
                            group.Objects.Add(vmObject);

                            VM.AddEntity(vmObject);

                            vmObject.MultitileGroup = group;
                        }
                    }
                }

                group.ChangePosition(x, y, level, direction, this);
                return (VMGameObject)group.Objects[0];
            }
            else
            {
                if (objDefinition.OBJ.ObjectType == OBJDType.Person) //person
                {
                    var vmObject = new VMAvatar(objDefinition);
                    VM.AddEntity(vmObject);

                    //this.InitWorldComponent(vmObject.WorldUI);
                    Blueprint.AddAvatar((AvatarComponent)vmObject.WorldUI);

                    vmObject.SetPosition(x, y, level, direction, this);
                    return vmObject;
                }
                else
                {
                    var worldObject = new ObjectComponent(objDefinition);
                    var vmObject = new VMGameObject(objDefinition, worldObject);

                    VM.AddEntity(vmObject);

                    vmObject.SetPosition(x, y, level, direction, this);
                    return vmObject;
                }
            }
        }