Exemplo n.º 1
0
 public void GridChange(GridInfo source, CraftCommandList.ChangeValGrid val, int mode)
 {
     source.DelFloor(0);
     for (int index = 0; index < val.nFloorNum[mode]; ++index)
     {
         source.AddFloor();
     }
     for (int index1 = 0; index1 < val.nFloorNum[mode]; ++index1)
     {
         for (int index2 = 0; index2 < 4; ++index2)
         {
             source.SetCanRoofSmallGrid(index2, index1, val.smallGrids[mode][index1][index2].m_canRoof);
             source.SetInRoomSmallGrid(index2, val.smallGrids[mode][index1][index2].m_inRoom, index1);
             source.ChangeSmallGrid(index2, val.smallGrids[mode][index1][index2].m_state, -1, index1, false);
             for (int changePlace = 0; changePlace < 7; ++changePlace)
             {
                 source.ChangeSmallGridItemKind(index1, index2, changePlace, val.smallGrids[mode][index1][index2].m_itemkind[changePlace]);
             }
             int num1 = 0;
             for (int index3 = 0; index3 < val.smallGrids[mode][index1][index2].m_itemstackwall.Length && val.smallGrids[mode][index1][index2].m_itemstackwall[index3] != -1; ++index3)
             {
                 ++num1;
             }
             for (int index3 = 0; index3 < num1; ++index3)
             {
                 source.ChangeSmallGridStack(index1, index2, 4, 0);
             }
             int num2 = 0;
             for (int index3 = 0; index3 < val.smallGrids[mode][index1][index2].m_itemstackwall.Length && val.smallGrids[mode][index1][index2].m_itemdupulication[index3] != -1; ++index3)
             {
                 ++num2;
             }
             for (int index3 = 0; index3 < num2; ++index3)
             {
                 source.ChangeSmallGridStack(index1, index2, val.smallGrids[mode][index1][index2].m_itemdupulication[index3], 0);
             }
             source.ChangeSmallGridUnderCarsol(index1, index2, source.GetUnderTheCarsol(index1, index2));
             source.ChangeSmallGridColor(index1, index2);
             if (val.smallGrids[mode][index1][index2].m_PutElement != null)
             {
                 for (int index3 = 0; index3 < val.smallGrids[mode][index1][index2].m_PutElement.Count; ++index3)
                 {
                     source.SetSmallGridPutElement(index1, index2, val.smallGrids[mode][index1][index2].m_PutElement[index3], false, false);
                 }
             }
         }
         source.SetUseState(index1, val.bUse[mode][index1]);
     }
     source.nFloorPartsHeight = val.nFloorPartsHeight[mode];
     if (Singleton <CraftCommandListBaseObject> .Instance.nTargetFloorCnt >= source.GetFloorNum())
     {
         --Singleton <CraftCommandListBaseObject> .Instance.nTargetFloorCnt;
     }
     ((Component)source).get_gameObject().get_transform().set_position(val.Pos[mode]);
     if (!source.GetUseState(Singleton <CraftCommandListBaseObject> .Instance.nTargetFloorCnt))
     {
         return;
     }
     ((Component)source).get_gameObject().SetActive(true);
 }