Пример #1
0
        private string DuplicateRoom(RoomData originalData)
        {
            // Add a new room file, yo!
            string newRoomKey = originalData.MyWorldData.GetUnusedRoomKey(originalData.RoomKey);

            RoomSaverLoader.SaveRoomFileAs(originalData, originalData.WorldIndex, newRoomKey);
            return(newRoomKey);
        }
Пример #2
0
    private void DuplicateCurrRoom()
    {
        // Add a new room file, yo!
        RoomData currRD     = CurrRoom.MyRoomData;
        string   newRoomKey = currRD.MyWorldData.GetUnusedRoomKey(currRD.RoomKey);

        RoomSaverLoader.SaveRoomFileAs(currRD, currRD.WorldIndex, newRoomKey);
        dm.ReloadWorldDatas();
        RoomData newRD = dm.GetRoomData(currRD.WorldIndex, newRoomKey, false);

        newRD.isClustStart = false;                                                           // say new room's NOT a clustStart.
        newRD.SetPosGlobal(newRD.PosGlobal + new Vector2(15, -15) * GameProperties.UnitSize); // offset its position a bit.
        newRD.SetDesignerFlag(0);                                                             // Reset its designerFlag
        RoomSaverLoader.UpdateRoomPropertiesInRoomFile(newRD);                                // update file!
        dm.currRoomData = newRD;
        SceneHelper.ReloadScene();
    }