public void OnScreenSizeChanged(int width, int height) { object obj = this.screenLock; lock (obj) { this.AbandonAnchor(); this.AbandonPinch(); PlanetView view = Service.WorldInitializer.View; if (view != null) { view.ComputeCornerLocators(); } this.screenCorners[0] = new Vector3(0f, 0f, 0f); this.screenCorners[1] = new Vector3((float)width, 0f, 0f); this.screenCorners[2] = new Vector3(0f, (float)height, 0f); this.screenCorners[3] = new Vector3((float)width, (float)height, 0f); float magnitude = (this.mapNearLSuper - this.mapFarRSuper).magnitude; float num = (float)Screen.height / (float)Screen.width; if (num > 1f) { num = 1f / num; } this.mapHighYSuper = 1.5f * magnitude * num; this.mapLowYEarly = this.mapLowYSuper + 50f; this.mapHighYEarly = this.mapHighYSuper; this.mapHighYSuperTopDown = this.mapHighYSuper + 200f; this.mapHighYEarlyTopDown = this.mapHighYEarly + 200f; IState currentState = Service.GameStateMachine.CurrentState; if (currentState is EditBaseState || currentState is WarBaseEditorState) { this.mapHighYSuper = this.mapHighYSuperTopDown; this.mapHighYEarly = this.mapHighYEarlyTopDown; } if (!this.IsNonBaseCameraState(currentState)) { this.ZoomTo(0.7f, false); Vector3 zero = Vector3.zero; this.PanToLocation(zero); } } }
public BuildingMover(BuildingSelector buildingSelector) { this.buildingSelector = buildingSelector; this.lifted = false; this.canOccupy = false; this.prevValidBoardAnchorX = new Dictionary <Entity, int>(); this.prevValidBoardAnchorZ = new Dictionary <Entity, int>(); this.prevBoardAnchorX = new Dictionary <Entity, int>(); this.prevBoardAnchorZ = new Dictionary <Entity, int>(); this.pressScreenPosition = Vector2.zero; this.dragged = false; this.pressedBuilding = null; this.moved = false; this.buildingController = Service.BuildingController; this.worldView = Service.WorldInitializer.View; EventManager eventManager = Service.EventManager; eventManager.RegisterObserver(this, EventId.BuildingViewReady, EventPriority.Default); eventManager.RegisterObserver(this, EventId.GameStateChanged, EventPriority.Default); eventManager.RegisterObserver(this, EventId.UserWantedEditBaseState, EventPriority.Default); this.inhibitor = Service.UserInputInhibitor; }