Exemplo n.º 1
0
    private void renderSelectionInfo(Graphics g)
    {
        StringBuffer strBuffer = new StringBuffer();

        strBuffer.append("selection: ");
        if (this.m_selectedObject == null)
        {
            strBuffer.append("none");
        }
        else if (house.Room.house_cast(this.m_selectedObject) != null)
        {
            house.Room room = house.Room.house_cast(this.m_selectedObject);
            strBuffer.append("room (floor=").append(GlobalConstants.LOOKUP_FLOOR[room.getFloor()]).append(", wall=").append(GlobalConstants.LOOKUP_WALL[room.getWall()]).append(")");
        }
        else if (Door.house_cast(this.m_selectedObject) != null)
        {
            Door door = Door.house_cast(this.m_selectedObject);
            strBuffer.append("door (type=").append(GlobalConstants.LOOKUP_OBJECT[door.getType()]).append(")");
        }
        else if (HouseObject.house_cast(this.m_selectedObject) != null)
        {
            HouseObject houseObject = HouseObject.house_cast(this.m_selectedObject);
            strBuffer.append("object (type=").append(GlobalConstants.LOOKUP_OBJECT[houseObject.getType()]).append(")");
        }
        else if (Window.house_cast(this.m_selectedObject) != null)
        {
            Window window = Window.house_cast(this.m_selectedObject);
            strBuffer.append("window (type=").append(GlobalConstants.LOOKUP_OBJECT[window.getType()]).append(")");
        }
        this.m_engine.getTextManager().drawString(g, strBuffer, 5, 5, 5, 9);
    }
Exemplo n.º 2
0
 private void setSelectedObjectAttributes()
 {
     if (house.Room.house_cast(this.m_selectedObject) != null)
     {
         house.Room room = house.Room.house_cast(this.m_selectedObject);
         JSystem.println("setting room attributes");
         room.setFloor(this.m_currSelectionFirstList);
         room.setWall(this.m_currSelectionSecondList);
     }
     else if (Door.house_cast(this.m_selectedObject) != null)
     {
         Door.house_cast(this.m_selectedObject).setType(this.getAttributeValueLookupIndex(this.m_currSelectionFirstList, 0));
     }
     else if (HouseObject.house_cast(this.m_selectedObject) != null)
     {
         HouseObject houseObject = HouseObject.house_cast(this.m_selectedObject);
         if (this.m_currentFacingSelectionButtonId == 4)
         {
             houseObject.setFacing(0);
         }
         else if (this.m_currentFacingSelectionButtonId == 5)
         {
             houseObject.setFacing(2);
         }
         else if (this.m_currentFacingSelectionButtonId == 6)
         {
             houseObject.setFacing(1);
         }
         else if (this.m_currentFacingSelectionButtonId == 7)
         {
             houseObject.setFacing(3);
         }
         int valueLookupIndex = this.getAttributeValueLookupIndex(this.m_currSelectionFirstList, 0);
         this.m_prevAddedObjectType = valueLookupIndex;
         houseObject.setType(valueLookupIndex);
     }
     else
     {
         if (Window.house_cast(this.m_selectedObject) == null)
         {
             return;
         }
         Window.house_cast(this.m_selectedObject).setType(this.getAttributeValueLookupIndex(this.m_currSelectionFirstList, 0));
     }
 }
Exemplo n.º 3
0
    private void renderCurrentHouse(Graphics g)
    {
        if (this.m_currentHouse == null)
        {
            return;
        }
        Vector rooms        = this.m_currentHouse.getRooms();
        int    num1         = rooms.size();
        Vector windows      = this.m_currentHouse.getWindows();
        int    num2         = windows.size();
        Vector houseObjects = this.m_currentHouse.getHouseObjects();
        int    num3         = houseObjects.size();
        Vector doors        = this.m_currentHouse.getDoors();
        int    num4         = doors.size();

        for (int index = 0; index < num1; ++index)
        {
            house.Room room = (house.Room)rooms.elementAt(index);
            this.renderPlaceableObject(g, 16711680, room.getX(), room.getY(), room.getWidth(), room.getHeight(), true, room == this.m_selectedObject, -1);
        }
        for (int index = 0; index < num2; ++index)
        {
            Window window = (Window)windows.elementAt(index);
            this.renderPlaceableObject(g, 16776960, window.getX(), window.getY(), window.getWidth(), window.getHeight(), false, window == this.m_selectedObject, -1);
        }
        for (int index = 0; index < num3; ++index)
        {
            HouseObject houseObject = (HouseObject)houseObjects.elementAt(index);
            this.renderPlaceableObject(g, 16711935, houseObject.getX(), houseObject.getY(), houseObject.getWidth(), houseObject.getHeight(), false, houseObject == this.m_selectedObject, houseObject.getFacing());
        }
        for (int index = 0; index < num4; ++index)
        {
            Door door = (Door)doors.elementAt(index);
            this.renderPlaceableObject(g, 65280, door.getX(), door.getY(), door.getWidth(), door.getHeight(), false, door == this.m_selectedObject, -1);
        }
    }
Exemplo n.º 4
0
    private void initStateEditAttributes()
    {
        this.m_lookupsFirstList               = (string[])null;
        this.m_numPagesFirstList              = 0;
        this.m_currPageFirstList              = 0;
        this.m_lookupSizeFirstList            = 0;
        this.m_lookupsSecondList              = (string[])null;
        this.m_numPagesSecondList             = 0;
        this.m_currPageSecondList             = 0;
        this.m_lookupSizeFirstList            = 0;
        this.m_currSelectionFirstList         = 0;
        this.m_currSelectionSecondList        = 0;
        this.m_currentFacingSelectionButtonId = -1;
        this.m_attrEditButtons[4].hide();
        this.m_attrEditButtons[5].hide();
        this.m_attrEditButtons[6].hide();
        this.m_attrEditButtons[7].hide();
        this.m_attrEditButtons[0].hide();
        this.m_attrEditButtons[2].hide();
        this.m_attrEditButtons[1].hide();
        this.m_attrEditButtons[3].hide();
        if (house.Room.house_cast(this.m_selectedObject) != null)
        {
            house.Room room = house.Room.house_cast(this.m_selectedObject);
            this.m_lookupsFirstList        = GlobalConstants.LOOKUP_FLOOR;
            this.m_lookupSizeFirstList     = this.m_simWorld.getFloorCount();
            this.m_currSelectionFirstList  = room.getFloor();
            this.m_lookupsSecondList       = GlobalConstants.LOOKUP_WALL;
            this.m_lookupSizeSecondList    = this.m_simWorld.getWallCount();
            this.m_currSelectionSecondList = room.getWall();
        }
        else if (Door.house_cast(this.m_selectedObject) != null)
        {
            Door door = Door.house_cast(this.m_selectedObject);
            this.m_lookupsFirstList       = GlobalConstants.LOOKUP_OBJECT;
            this.m_lookupSizeFirstList    = this.m_simWorld.getDoorTypeNthCount();
            this.m_currSelectionFirstList = this.m_simWorld.getObjectOfTypeIndexFromObjectArrayIndex(15, door.getType() == -1 ? 70 : door.getType());
            JSystem.println("door count = " + (object)this.m_lookupSizeFirstList);
        }
        else if (HouseObject.house_cast(this.m_selectedObject) != null)
        {
            HouseObject houseObject = HouseObject.house_cast(this.m_selectedObject);
            this.m_attrEditButtons[4].show();
            this.m_attrEditButtons[5].show();
            this.m_attrEditButtons[6].show();
            this.m_attrEditButtons[7].show();
            switch (houseObject.getFacing())
            {
            case 0:
                this.m_currentFacingSelectionButtonId = 4;
                break;

            case 1:
                this.m_currentFacingSelectionButtonId = 6;
                break;

            case 2:
                this.m_currentFacingSelectionButtonId = 5;
                break;

            case 3:
                this.m_currentFacingSelectionButtonId = 7;
                break;
            }
            this.m_lookupsFirstList    = GlobalConstants.LOOKUP_OBJECT;
            this.m_lookupSizeFirstList = this.m_simWorld.getBuildableNthCount();
            JSystem.println("object count = " + (object)this.m_lookupSizeFirstList);
            this.m_currSelectionFirstList = this.m_simWorld.getBuildableObjectIndexFromObjectArrayIndex(houseObject.getType());
        }
        else if (Window.house_cast(this.m_selectedObject) != null)
        {
            Window window = Window.house_cast(this.m_selectedObject);
            this.m_lookupsFirstList    = GlobalConstants.LOOKUP_OBJECT;
            this.m_lookupSizeFirstList = this.m_simWorld.getWindowTypeNthCount();
            JSystem.println("window count = " + (object)this.m_lookupSizeFirstList);
            this.m_currSelectionFirstList = this.m_simWorld.getObjectOfTypeIndexFromObjectArrayIndex(32, window.getType());
        }
        if (this.m_lookupsFirstList != null)
        {
            this.m_numPagesFirstList = 1 + (this.m_lookupSizeFirstList - 1) / this.m_numListRows;
            if (this.m_numPagesFirstList > 1)
            {
                this.m_attrEditButtons[1].show();
            }
        }
        if (this.m_lookupsSecondList == null)
        {
            return;
        }
        this.m_numPagesSecondList = 1 + (this.m_lookupSizeSecondList - 1) / this.m_numListRows;
        if (this.m_numPagesSecondList <= 1)
        {
            return;
        }
        this.m_attrEditButtons[3].show();
    }
Exemplo n.º 5
0
    private void processInputMainEdit(int _event, int[] args)
    {
        switch (_event)
        {
        case 0:
            this.coordScreenToTile(args[1], args[2], ref this.m_activeTileX, ref this.m_activeTileY);
            break;

        case 3:
            JSystem.println("  single tap");
            int screenX1 = args[1];
            int screenY1 = args[2];
            this.coordScreenToTile(screenX1, screenY1, ref this.m_activeTileX, ref this.m_activeTileY);
            int mainEditButtonId1 = this.getMainEditButtonId(screenX1, screenY1);
            if (mainEditButtonId1 == 5)
            {
                this.writeCurrentHouseToFile();
                this.editStateTransition(5);
            }
            if (mainEditButtonId1 == 6)
            {
                this.writeCurrentHouseToFile();
                this.m_simWorld.editHouse(this.m_currentHouse.getId(), this.m_currentHouse);
                this.loadMap(this.m_currentHouse.getId());
                this.editStateTransition(5);
                break;
            }
            if (mainEditButtonId1 == 4 && this.m_selectedObject != null)
            {
                JSystem.println("object dropped on the trash button...");
                if (house.Room.house_cast(this.m_selectedObject) != null)
                {
                    this.m_currentHouse.deleteRoom((house.Room) this.m_selectedObject);
                }
                else if (Window.house_cast(this.m_selectedObject) != null)
                {
                    this.m_currentHouse.deleteWindow((Window)this.m_selectedObject);
                }
                else if (HouseObject.house_cast(this.m_selectedObject) != null)
                {
                    this.m_currentHouse.deleteHouseObject((HouseObject)this.m_selectedObject);
                }
                else if (Door.house_cast(this.m_selectedObject) != null)
                {
                    this.m_currentHouse.deleteDoor((Door)this.m_selectedObject);
                }
                this.m_selectedObject = (PlaceableObject)null;
                break;
            }
            this.m_selectedObject = this.getObjectAt(this.m_activeTileX, this.m_activeTileY);
            break;

        case 4:
            int screenX2 = args[1];
            int screenY2 = args[2];
            this.m_startDragScreenX = screenX2;
            this.m_startDragScreenY = screenY2;
            this.m_prevActiveTileX  = this.m_activeTileX;
            this.m_prevActiveTileY  = this.m_activeTileY;
            this.coordScreenToTile(screenX2, screenY2, ref this.m_activeTileX, ref this.m_activeTileY);
            int mainEditButtonId2 = this.getMainEditButtonId(screenX2, screenY2);
            JSystem.println("Drag started in button w id " + (object)mainEditButtonId2);
            if (mainEditButtonId2 != -1 && mainEditButtonId2 != 4 && this.m_currentHouse != null)
            {
                switch (mainEditButtonId2)
                {
                case 0:
                    house.Room room1 = new house.Room(this.m_activeTileX, this.m_activeTileY, 2, 2, 0, 0);
                    this.m_currentHouse.addRoom(room1);
                    this.m_selectedObject = (PlaceableObject)room1;
                    break;

                case 1:
                    Door door1 = new Door(this.m_activeTileX, this.m_activeTileY, 1, 70);
                    this.m_currentHouse.addDoor(door1);
                    this.m_selectedObject = (PlaceableObject)door1;
                    break;

                case 2:
                    Window window1 = new Window(this.m_activeTileX, this.m_activeTileY, 1, 138);
                    this.m_currentHouse.addWindow(window1);
                    this.m_selectedObject = (PlaceableObject)window1;
                    break;

                case 3:
                    HouseObject @object = new HouseObject(this.m_activeTileX, this.m_activeTileY, this.m_prevAddedObjectType < 0 ? 82 : this.m_prevAddedObjectType, 1);
                    this.m_currentHouse.addHouseObject(@object);
                    this.m_selectedObject = (PlaceableObject)@object;
                    break;
                }
            }
            if (this.m_selectedObject == null)
            {
                break;
            }
            this.m_selectedObject.setPosition(this.m_selectedObject.getX() + this.m_activeTileX - this.m_prevActiveTileX, this.m_selectedObject.getY() + this.m_activeTileY - this.m_prevActiveTileY);
            break;

        case 5:
            int screenX3 = args[1];
            int screenY3 = args[2];
            this.m_prevActiveTileX = this.m_activeTileX;
            this.m_prevActiveTileY = this.m_activeTileY;
            this.coordScreenToTile(screenX3, screenY3, ref this.m_activeTileX, ref this.m_activeTileY);
            if (this.m_selectedObject == null)
            {
                break;
            }
            this.m_selectedObject.setPosition(this.m_selectedObject.getX() + (this.m_activeTileX - this.m_prevActiveTileX), this.m_selectedObject.getY() + (this.m_activeTileY - this.m_prevActiveTileY));
            break;

        case 6:
            JSystem.println("  single drag end");
            break;

        case 7:
            JSystem.println("  double tap");
            if (this.isDoubleTapHorizontal(args))
            {
                if (this.m_selectedObject == null)
                {
                    break;
                }
                this.editStateTransition(4);
                break;
            }
            this.editStateTransition(3);
            break;

        case 9:
            int  num1 = args[1];
            int  num2 = args[2];
            int  num3 = args[3];
            int  num4 = args[4];
            int  viewportHeight = this.m_simWorld.getViewportHeight();
            bool flag1 = num1 <40 && num2> viewportHeight - 40;
            bool flag2 = num1 <40 && num4> viewportHeight - 40;
            if ((!flag1 || flag2) && (flag1 || !flag2) || this.m_selectedObject == null)
            {
                break;
            }
            int screenX4 = flag1 ? num3 : num1;
            int screenY4 = flag2 ? num2 : num4;
            this.m_prevActiveTileX = this.m_activeTileX;
            this.m_prevActiveTileY = this.m_activeTileY;
            this.coordScreenToTile(screenX4, screenY4, ref this.m_activeTileX, ref this.m_activeTileY);
            house.Room room2   = house.Room.house_cast(this.m_selectedObject);
            Door       door2   = Door.house_cast(this.m_selectedObject);
            Window     window2 = Window.house_cast(this.m_selectedObject);
            int        num5    = this.m_activeTileX - this.m_prevActiveTileX;
            int        num6    = this.m_activeTileY - this.m_prevActiveTileY;
            if (room2 != null)
            {
                room2.setSize(JMath.max(1, room2.getWidth() + num5), JMath.max(1, room2.getHeight() + num6));
                break;
            }
            if (door2 != null)
            {
                door2.setSize(door2.getWidth() + num5, door2.getHeight());
                break;
            }
            window2?.setSize(JMath.min(2, window2.getWidth() + num5), window2.getHeight());
            break;
        }
    }