示例#1
0
 private void processAttributeListSelection(int listIndex, int itemIdx)
 {
     if (listIndex == 0)
     {
         if (itemIdx + this.m_currPageFirstList * this.m_numListRows >= this.m_lookupSizeFirstList)
         {
             JSystem.println("non existing item selected from list 1, doing nothing");
         }
         else
         {
             this.m_currSelectionFirstList = this.m_currPageFirstList * this.m_numListRows + itemIdx;
         }
     }
     else if (itemIdx + this.m_currPageSecondList * this.m_numListRows >= this.m_lookupSizeSecondList)
     {
         JSystem.println("non existing item selected from list 2, doing nothing");
     }
     else
     {
         this.m_currSelectionSecondList = this.m_currPageSecondList * this.m_numListRows + itemIdx;
     }
 }
示例#2
0
 private static int copyCharArray(
     string srcArray,
     int srcOffset,
     int srcEncoding,
     string dstArray,
     int dstOffset,
     int dstEncoding,
     int numChars)
 {
     if (srcEncoding == dstEncoding || srcEncoding == 1 && dstEncoding != 0)
     {
         dstArray = srcArray ?? "";
         return(numChars);
     }
     if (srcEncoding != 1 && dstEncoding != 0)
     {
         JSystem.println("Cannot copy characters from a non ASCII string to a non UTF string.");
         return(0);
     }
     dstArray = srcArray ?? "";
     return(numChars);
 }
示例#3
0
    private void changeAttributePage(int columnIdx, int delta)
    {
        this.m_attrEditButtons[0].show();
        this.m_attrEditButtons[1].show();
        this.m_attrEditButtons[2].show();
        this.m_attrEditButtons[3].show();
        switch (columnIdx)
        {
        case 0:
            this.m_currPageFirstList = delta <= 0 ? JMath.max(this.m_currPageFirstList - 1, 0) : JMath.min(this.m_currPageFirstList + 1, this.m_numPagesFirstList - 1);
            JSystem.println("first list page changed to " + (object)this.m_currPageFirstList);
            break;

        case 1:
            this.m_currPageSecondList = delta <= 0 ? JMath.max(this.m_currPageSecondList - 1, 0) : JMath.min(this.m_currPageSecondList + 1, this.m_numPagesSecondList - 1);
            JSystem.println("second list page changed to " + (object)this.m_currPageSecondList);
            break;
        }
        if (this.m_currPageFirstList == 0 || this.m_numPagesFirstList == 0)
        {
            this.m_attrEditButtons[0].hide();
        }
        if (this.m_currPageFirstList == this.m_numPagesFirstList - 1 || this.m_numPagesFirstList == 0)
        {
            this.m_attrEditButtons[1].hide();
        }
        if (this.m_currPageSecondList == 0 || this.m_numPagesSecondList == 0)
        {
            this.m_attrEditButtons[2].hide();
        }
        if (this.m_currPageSecondList != this.m_numPagesSecondList - 1 && this.m_numPagesSecondList != 0)
        {
            return;
        }
        this.m_attrEditButtons[3].hide();
    }
示例#4
0
    private void processInputPan(int _event, int[] args)
    {
        switch (_event)
        {
        case 4:
            int num1 = args[1];
            int num2 = args[2];
            this.m_startDragScreenX      = num1;
            this.m_startDragScreenY      = num2;
            this.m_startDragTopLeftTileX = this.m_topLeftTileX;
            this.m_startDragTopLeftTileY = this.m_topLeftTileY;
            break;

        case 5:
            int num3 = args[1];
            int num4 = args[2];
            int num5 = (num3 - this.m_startDragScreenX) / this.m_tileSize;
            int num6 = (num4 - this.m_startDragScreenY) / this.m_tileSize;
            this.m_topLeftTileX = this.m_startDragTopLeftTileX - num5;
            this.m_topLeftTileY = this.m_startDragTopLeftTileY - num6;
            break;

        case 7:
            JSystem.println("  double tap");
            this.editStateTransition(2);
            break;

        case 9:
            int num7  = args[5];
            int num8  = args[6];
            int num9  = args[7];
            int num10 = args[8];
            this.m_tileSize = (int)(5.0 + 45.0 * (double)JMath.min(1f, JMath.max(0.0f, JMath.max(150f, JMath.min(400f, MathExt.mag2((float)(num9 - num7), (float)(num10 - num8)))) / 400f)));
            break;
        }
    }
示例#5
0
 public JRandom()
 {
     this.mSeed = 0L;
     this.setSeed(JSystem.currentTimeMillis());
 }
示例#6
0
 internal void logEvent(int EVT_SIMS3_CAS_HAIR, int hairType, int hairColor)
 {
     JSystem.println("TODO: Figure out what EASpywaremanager.logEvent() is supposed to do");
 }
示例#7
0
 internal void logEvent(int EVT_SIMS3_CAS_SKIN, int skin)
 {
     JSystem.println("TODO: Figure out what EASpywaremanager.logEvent() is supposed to do");
 }
示例#8
0
 internal void logEventDuration(int EVT_SIMS3_PLAYTIME, int duration)
 {
     JSystem.println("TODO: Figure out what EASpywaremanager.logEvent() is supposed to do");
 }
示例#9
0
 internal void logEvent(int EVT_SIMS3_RESETDATA)
 {
     JSystem.println("TODO: Figure out what EASpywaremanager.logEvent() is supposed to do");
 }
示例#10
0
 internal void logEvent(int EVT_SIMS3_NEWGAME, string simName, string slotStr)
 {
     JSystem.println("TODO: Figure out what EASpywaremanager.logEvent() is supposed to do");
 }
示例#11
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();
    }
示例#12
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;
        }
    }
示例#13
0
    private void processInputAttrEdit(int _event, int[] args)
    {
        switch (_event)
        {
        case 3:
            int num1             = args[1];
            int num2             = args[2];
            int attrEditButtonId = this.getAttrEditButtonId(num1, num2);
            switch (attrEditButtonId)
            {
            case 0:
                this.changeAttributePage(0, -1);
                JSystem.println("col 1 prev pressed");
                break;

            case 1:
                this.changeAttributePage(0, 1);
                JSystem.println("col 1 next pressed");
                break;

            case 2:
                this.changeAttributePage(1, -1);
                JSystem.println("col 2 prev pressed");
                break;

            case 3:
                this.changeAttributePage(1, 1);
                JSystem.println("col 2 next pressed");
                break;

            case 4:
                JSystem.println("x p facing button pressed");
                this.m_currentFacingSelectionButtonId = attrEditButtonId;
                break;

            case 5:
                JSystem.println("x n facing button pressed");
                this.m_currentFacingSelectionButtonId = attrEditButtonId;
                break;

            case 6:
                JSystem.println("z p facing button pressed");
                this.m_currentFacingSelectionButtonId = attrEditButtonId;
                break;

            case 7:
                JSystem.println("z n facing button pressed");
                this.m_currentFacingSelectionButtonId = attrEditButtonId;
                break;

            case 8:
                int listItemIndex1 = this.getListItemIndex(num1, num2);
                this.processAttributeListSelection(0, listItemIndex1);
                JSystem.println("list 1 tapped, " + (object)listItemIndex1 + " selected");
                break;

            case 9:
                int listItemIndex2 = this.getListItemIndex(num1, num2);
                this.processAttributeListSelection(1, listItemIndex2);
                JSystem.println("list 2 tapped, " + (object)listItemIndex2 + " selected");
                break;
            }
            break;

        case 7:
            this.editStateTransition(2);
            break;
        }
        this.setSelectedObjectAttributes();
    }
示例#14
0
 public void trackStartGame()
 {
     this.m_gameStart = JSystem.currentTimeMillis();
     EASpywareManager.getInstance().logEvent(229, AppEngine.getCanvas().getSimName(), string.Concat((object)AppEngine.getCanvas().getRMSGameSlotIndex()));
 }
示例#15
0
 internal void logEvent(int eventId, string str)
 {
     JSystem.println("TODO: Figure out what EASpywaremanager.logEvent() is supposed to do");
 }
示例#16
0
 private void trackPlayTime()
 {
     EASpywareManager.getInstance().logEventDuration(230, (int)((JSystem.currentTimeMillis() - this.m_gameStart) / 1000L));
 }
示例#17
0
        public static void drawSubString(
            SDKString _string,
            int offset,
            int len,
            int xConst,
            int yConst,
            int anchor,
            SDKTextUtils.DrawRegionRoutineDelegate DrawRegionRoutine)
        {
            int num1 = xConst;
            int num2 = yConst;

            if (SDKTextUtils.s_currentFont == null)
            {
                return;
            }
            object fontImage = SDKTextUtils.s_currentFont.getFontImage();
            int    ascent    = SDKTextUtils.s_currentFont.getAscent();
            int    lineSize  = SDKTextUtils.s_currentFont.getLineSize();
            int    textDir   = SDKTextUtils.s_currentFont.getTextDir();
            int    lineDir   = SDKTextUtils.s_currentFont.getLineDir();

            if (SDKTextUtils.s_currentFont.m_charData == null)
            {
                return;
            }
            int num3 = 0;
            int num4 = 0;

            if ((anchor & 32) != 0)
            {
                num3 -= SDKTextUtils.getSubStringSize(_string, offset, len);
            }
            else if ((anchor & 16) != 0)
            {
                num3 -= SDKTextUtils.getSubStringSize(_string, offset, len) >> 1;
            }
            if ((anchor & 64) != 0)
            {
                num4 -= ascent;
            }
            else if ((anchor & 4) != 0)
            {
                num4 -= lineSize;
            }
            switch (textDir)
            {
            case 1:
                num1 += num3;
                num2 += num4;
                break;

            case 2:
                num1 -= num4;
                num2 += num3;
                break;

            case 4:
                num1 -= num3;
                num2 -= num4;
                break;

            case 8:
                num1 -= num4;
                num2 -= num3;
                break;
            }
            int[] p = new int[2] {
                num1, num2
            };
            int encoding = _string.getEncoding();

            switch (encoding)
            {
            case 0:
            case 1:
                bool  flag1 = (textDir & 5) != 0;
                sbyte num5  = (sbyte)((textDir & 4) >> 1);
                sbyte num6  = (sbyte)(((lineDir & 1) << 1) + ((~lineDir & 2) >> 1));
                sbyte num7  = flag1 ? num5 : num6;
                bool  flag2 = (textDir & 10) != 0;
                sbyte num8  = (sbyte)((textDir & 8) >> 2);
                sbyte num9  = (sbyte)((lineDir & 2) + (~lineDir & 1));
                sbyte num10 = flag2 ? num8 : num9;
                for (int index1 = offset; index1 != offset + len; ++index1)
                {
                    ushort code = _string.charCodeAt(index1);
                    if (code != (ushort)173 || index1 == offset + len - 1)
                    {
                        ushort charOffset  = SDKTextUtils.getCharOffset(code, encoding);
                        int    charAdvance = SDKTextUtils.s_currentFont.getCharAdvance(charOffset);
                        if (charOffset == ushort.MaxValue)
                        {
                            if (code == (ushort)32)
                            {
                                ;
                            }
                        }
                        else
                        {
                            ushort  num11      = (ushort)((uint)charOffset + 1U);
                            sbyte[] mCharData1 = SDKTextUtils.s_currentFont.m_charData;
                            int     index2     = (int)num11;
                            ushort  num12      = (ushort)(index2 + 1);
                            int     num13      = (int)mCharData1[index2] & (int)byte.MaxValue;
                            for (int index3 = 0; index3 != num13; ++index3)
                            {
                                sbyte[] mCharData2 = SDKTextUtils.s_currentFont.m_charData;
                                int     index4     = (int)num12;
                                ushort  num14      = (ushort)(index4 + 1);
                                int     num15      = (int)mCharData2[index4] & (int)byte.MaxValue;
                                sbyte[] mCharData3 = SDKTextUtils.s_currentFont.m_charData;
                                int     index5     = (int)num14;
                                ushort  num16      = (ushort)(index5 + 1);
                                int     num17      = (int)mCharData3[index5] & (int)byte.MaxValue;
                                sbyte[] mCharData4 = SDKTextUtils.s_currentFont.m_charData;
                                int     index6     = (int)num16;
                                ushort  num18      = (ushort)(index6 + 1);
                                int     num19      = (int)mCharData4[index6];
                                sbyte[] mCharData5 = SDKTextUtils.s_currentFont.m_charData;
                                int     index7     = (int)num18;
                                ushort  num20      = (ushort)(index7 + 1);
                                int     num21      = (int)mCharData5[index7];
                                sbyte[] mCharData6 = SDKTextUtils.s_currentFont.m_charData;
                                int     index8     = (int)num20;
                                ushort  num22      = (ushort)(index8 + 1);
                                int     num23      = (int)mCharData6[index8] & (int)byte.MaxValue;
                                sbyte[] mCharData7 = SDKTextUtils.s_currentFont.m_charData;
                                int     index9     = (int)num22;
                                num12 = (ushort)(index9 + 1);
                                int   num24    = (int)mCharData7[index9] & (int)byte.MaxValue;
                                int[] numArray = new int[4]
                                {
                                    num19,
                                    num21 - ascent,
                                    -num19 - num23,
                                    ascent - num21 - num24
                                };
                                int num25 = p[0] + numArray[(int)num7];
                                int num26 = p[1] + numArray[(int)num10];
                                DrawRegionRoutine(fontImage, (short)num25, (short)num26, (short)num23, (short)num24, (short)num15, (short)num17);
                            }
                        }
                        SDKTextUtils.s_currentFont.advance(p, charAdvance);
                    }
                }
                break;

            default:
                if (encoding != SDKTextUtils.s_currentLanguage.encoding)
                {
                    JSystem.println("ERROR: SDKTextUtils::drawString: SDKString has encoding " + encoding.ToString() + ", but the currently set language has encoding " + SDKTextUtils.s_currentLanguage.encoding.ToString());
                    goto case 0;
                }
                else
                {
                    goto case 0;
                }
            }
        }