Example #1
0
 protected override void OnInit(object data = null)
 {
     base.OpenDoor(false);
     GameLogic.Hold.Guide.GuideBattleNext();
     if (data != null)
     {
         RoomControlBase.Mode_LevelData data2 = (RoomControlBase.Mode_LevelData)data;
         if (data2 != null)
         {
             this.room     = data2.room;
             this.nextRoom = data2.nextroom;
         }
     }
     if (this.room != null)
     {
         base.SetLayer(this.room.RoomID);
     }
     this.DoorDownShow();
     this.ExcuteLayer();
     this.OnInitStage();
 }
    private void GotoNextDoor()
    {
        this.RandomNextRoom();
        Room       room = this.roomList[this.currentRoomID];
        GameObject obj2 = this.CreateMapObject(room.ResourcesID);

        this.currentMap = obj2;
        this.roomCtrl   = obj2.GetComponent <RoomControlBase>();
        object[] args = new object[] { room.RoomID, room.ResourcesID, room.TMXID };
        obj2.name = obj2.name + Utils.FormatString("_{0}_{1}_{2}", args);
        obj2.transform.position   = new Vector3(0f, 0f, 0f);
        obj2.transform.localScale = new Vector3(1f, 1f, 1.23f);
        Room room2 = null;

        this.roomList.TryGetValue(this.currentRoomID + 1, out room2);
        GameLogic.Release.Mode.SetGoodsParent(this.roomCtrl.GetGoodsDropParent());
        MapCreator.Transfer t = new MapCreator.Transfer {
            roomctrl    = this.roomCtrl,
            roomid      = this.currentRoomID,
            resourcesid = room.ResourcesID,
            tmxid       = room.TMXID
        };
        GameLogic.Release.MapCreatorCtrl.CreateMap(t);
        RoomControlBase.Mode_LevelData data = new RoomControlBase.Mode_LevelData {
            room     = room,
            nextroom = room2
        };
        this.roomCtrl.Init(data);
        if (this.gotonextdoor_canopen())
        {
            this.OpenDoorDelay(0f);
        }
        else
        {
            GameLogic.Self.SetAbsorb(false);
        }
        if (this._currentRoomID > 0)
        {
            GameConfig.MapGood.Init();
            if ((this.roomList[this.currentRoomID].IsBossRoom && (GameLogic.Self != null)) && (GameLogic.Self.OnInBossRoom != null))
            {
                GameLogic.Self.OnInBossRoom();
            }
            if (LocalSave.Instance.BattleIn_GetIn())
            {
                GameLogic.Self.SetPosition(new Vector3(0f, 0f, -this.roomList[this.currentRoomID].playery));
            }
            else
            {
                GameLogic.Self.SetPosition(new Vector3(0f, 0f, this.roomList[this.currentRoomID].playery));
            }
            if (GameLogic.Release.Mode.OnGotoNextRoom != null)
            {
                GameLogic.Release.Mode.OnGotoNextRoom(this.roomList[this.currentRoomID]);
            }
            GameLogic.Self.OnGotoNextRoom();
            GameLogic.Release.Bullet.CacheAll();
            GameLogic.Release.MapEffect.Clear();
            CameraControlM.Instance.ResetCameraPosition();
            GameLogic.Self.SetAbsorbRangeMax(false);
            GameLogic.Hold.PreLoad(this.currentRoomID);
            ResourceManager.UnloadUnused();
        }
    }