void showViewFromTo(ViewManagerEvent.VIEW_TYPE fromView, ViewManagerEvent.VIEW_TYPE toView) { //-----------------------处理所有控制器-------------------- setAllControllerEvent(fromView, toView); //此处可以实现各种切换动画 GameObject root = GameObject.Find("ViewManager"); Transform tFrom = root.transform.Find(_viewMap[fromView]); if (tFrom != null) { GameObject viewFrom = tFrom.gameObject; string v = _viewMap [fromView]; if (viewFrom != null) { viewFrom.SetActive(false); } } Transform tTo = root.transform.Find(_viewMap [toView]); if (tTo != null) { GameObject viewTo = tTo.gameObject; string v2 = _viewMap[toView]; if (viewTo != null) { viewTo.SetActive(true); } } }
void setAllControllerEvent(ViewManagerEvent.VIEW_TYPE fromView, ViewManagerEvent.VIEW_TYPE toView) { //remove switch (fromView) { case ViewManagerEvent.VIEW_TYPE.ACCOUNT_VIEW: AccountController.getInstance().removeAllEvent(); break; case ViewManagerEvent.VIEW_TYPE.GAME_VIEW: GameController.getInstance().removeAllEvent(); RoomController.getInstance().removeRoomGameEvent(); break; case ViewManagerEvent.VIEW_TYPE.LOBBY_VIEW: LobbyController.getInstance().removeAllEvent(); RoomController.getInstance().removeRoomLobbyEvent(); break; case ViewManagerEvent.VIEW_TYPE.START_VIEW: break; } //add switch (toView) { case ViewManagerEvent.VIEW_TYPE.ACCOUNT_VIEW: AccountController.getInstance().addAllEvent(); break; case ViewManagerEvent.VIEW_TYPE.GAME_VIEW: GameController.getInstance().addAllEvent(); RoomController.getInstance().addRoomGameEvent(); break; case ViewManagerEvent.VIEW_TYPE.LOBBY_VIEW: LobbyController.getInstance().addAllEvent(); RoomController.getInstance().addRoomLobbyEvent(); break; case ViewManagerEvent.VIEW_TYPE.START_VIEW: break; } }