public void OnStartPurchaseBuilding(SmartEntity buildingEntity, bool stampable) { this.EnsureLoweredLiftedBuilding(); this.buildingSelector.EnsureDeselectSelectedBuilding(); this.ResetOnPress(Vector2.zero, Vector3.zero); this.buildingSelector.SelectBuilding(buildingEntity, Vector3.zero); this.LiftSelectedBuilding(this.buildingSelector.SelectedBuilding, false); int cx = 0; int cz = 0; Service.CameraManager.MainCamera.GetLookatBoardCell(out cx, out cz); int boardX; int num; this.buildingController.FindStartingLocation(buildingEntity, out boardX, out num, cx, cz, stampable); float x; float z; EditBaseController.BuildingBoardToWorld(buildingEntity, boardX, num, out x, out z); Vector3 vector = new Vector3(x, 0f, z); this.MoveLiftedBuilding(buildingEntity, vector); UXController uXController = Service.UXController; uXController.MiscElementsManager.ShowConfirmGroup(buildingEntity, new MiscConfirmDelegate(this.OnConfirmPurchase)); uXController.HUD.ToggleExitEditModeButton(false); vector.x = Units.BoardToWorldX(boardX); vector.z = Units.BoardToWorldX(num); this.worldView.PanToLocation(vector); this.LowerLiftedBuilding(DropKind.JustDrop, false, true, true, false); }
private HealthController healthControllerClassReference; //Referencia a la clase "HealthController". void Awake() { UXControllerClassReference = GameObject.FindWithTag("GameController").GetComponent <UXController> (); spawnEnemiesClassReference = GameObject.FindWithTag("GameController").GetComponent <SpawnEnemies> (); nextSceneClass = GameObject.FindWithTag("GameController").GetComponent <NextScene>(); healthControllerClassReference = gameObject.GetComponent <HealthController>(); }
private void OnPayMeForDroidResult(object result, object cookie) { bool flag = result != null; UXController uXController = Service.UXController; uXController.HUD.ToggleExitEditModeButton(true); this.LowerLiftedBuilding((!flag) ? DropKind.CancelPurchase : DropKind.ConfirmPurchase, true, this.lifted, true, true); }
void Awake() { uxControllerClassReference = GetComponent <UXController> (); nextSceneClass = GetComponent <NextScene>(); spawnEnemiesClassReference = GameObject.FindWithTag("GameController").GetComponent <SpawnEnemies> (); playerTransformReference = GameObject.FindWithTag("Player").GetComponent <Transform>(); playerController = GameObject.FindWithTag("Player").GetComponent <PlayerController>(); }
public bool UnstashBuilding(SmartEntity buildingEntity, Position pos, bool stampable, bool panToBuilding, bool playLoweredSound) { this.EnsureLoweredLiftedBuilding(); this.buildingSelector.EnsureDeselectSelectedBuilding(); this.ResetOnPress(Vector2.zero, Vector3.zero); this.buildingSelector.SelectBuilding(buildingEntity, Vector3.zero); this.LiftSelectedBuilding(this.buildingSelector.SelectedBuilding, false); int x; int z; if (pos == null) { int cx = 0; int cz = 0; Service.CameraManager.MainCamera.GetLookatBoardCell(out cx, out cz); this.buildingController.FindStartingLocation(buildingEntity, out x, out z, cx, cz, stampable); UXController uXController = Service.UXController; if (stampable) { uXController.MiscElementsManager.ShowConfirmGroup(buildingEntity, new MiscConfirmDelegate(this.OnConfirmUnstashStamp)); } else { this.buildingController.DisableUnstashStampingState(); } } else { x = pos.X; z = pos.Z; } float x2; float z2; EditBaseController.BuildingBoardToWorld(buildingEntity, x, z, out x2, out z2); Vector3 vector = new Vector3(x2, 0f, z2); this.MoveLiftedBuilding(buildingEntity, vector); if (panToBuilding) { vector.x = Units.BoardToWorldX(x); vector.z = Units.BoardToWorldX(z); this.worldView.PanToLocation(vector); } BoardCell boardCell = Service.WorldController.AddBuildingToBoard(buildingEntity, x, z, true); if (boardCell != null) { this.LowerLiftedBuilding(DropKind.JustDrop, true, true, playLoweredSound, false); } else { this.lifted = false; this.moved = false; } return(boardCell != null); }
public GeneratorViewComponent(Entity entity) { this.viewComp = entity.Get <GameObjectViewComponent>(); this.collectButton = new CollectButton(entity); UXController uXController = Service.UXController; this.textLabel = uXController.MiscElementsManager.CreateCollectionLabel("GeneratorCollectLabel", uXController.WorldAnchor); this.textLabel.Visible = false; this.textTimerId = 0u; }
public BattleMessageView(string labelName) { UXController uXController = Service.Get <UXController>(); UXAnchor worldAnchor = uXController.WorldAnchor; this.label = uXController.MiscElementsManager.CreateGameBoardLabel(labelName, worldAnchor); this.label.Pivot = UIWidget.Pivot.Bottom; this.label.Visible = false; this.registered = false; }
public LongPressView() { this.cams = Service.Get <CameraManager>(); this.time = Service.Get <ViewTimeEngine>(); this.uxc = Service.Get <UXController>(); this.preFadeDuration = GameConstants.EDIT_LONG_PRESS_PRE_FADE; this.fadeDuration = GameConstants.EDIT_LONG_PRESS_FADE; this.longPress = this.uxc.MiscElementsManager.CreateLongPress("LongPress", this.uxc.WorldAnchor); this.longPress.Visible = false; this.longPressFill = this.uxc.MiscElementsManager.GetChildElementSprite(this.longPress, "SpriteLongPressFill"); this.longPressBkg = this.uxc.MiscElementsManager.GetChildElementSprite(this.longPress, "SpriteLongPressBkg"); this.registered = false; }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); uxInstance = uxGameObject.GetComponent <UXController>(); }
void Awake() { UXControllerClass = GameObject.FindWithTag("GameController").GetComponent <UXController> (); spawnEnemiesClass = GameObject.FindWithTag("GameController").GetComponent <SpawnEnemies> (); nextSceneClass = GameObject.FindWithTag("GameController").GetComponent <NextScene>(); if (!UXController.isGameOver) { playerCollisionControllerClass = GameObject.FindWithTag("Player").GetComponent <PlayerCollisionController>(); } healthControllerClass = gameObject.GetComponent <HealthController>(); }
public void OnEnter() { UXController uXController = Service.Get <UXController>(); uXController.MiscElementsManager.HideEventsTickerView(); uXController.HUD.ConfigureControls(new HudConfig(new string[] { "SquadScreen" })); Service.Get <UXController>().HUD.SetSquadScreenAlwaysOnTop(true); ScreenController screenController = Service.Get <ScreenController>(); screenController.CloseAll(); screenController.AddScreen(new SquadWarScreen(), false); Service.Get <WarBoardViewController>().ShowWarBoard(); }
public List <IAssetVO> GetPreloads() { List <IAssetVO> result = new List <IAssetVO>(); if (Service.UXController == null) { return(result); } UXController uXController = Service.UXController; if (uXController.MiscElementsManager != null) { uXController.MiscElementsManager.ReleaseHealthSliderPool(); } return(result); }
private void OnPickPlanetResult(object result, object cookie) { bool flag = result != null; UXController uXController = Service.UXController; uXController.HUD.ToggleExitEditModeButton(true); string tag = string.Empty; PlanetVO planetVO = (PlanetVO)cookie; if (planetVO != null) { tag = planetVO.Uid; Service.SharedPlayerPrefs.SetPref("1stPlaName", LangUtils.GetPlanetDisplayNameKey(planetVO.Uid)); } this.LowerLiftedBuildingHelper(this.buildingSelector.SelectedBuilding, (!flag) ? DropKind.CancelPurchase : DropKind.ConfirmPurchase, true, this.lifted, true, true, tag); Service.EventManager.SendEvent(EventId.BuildingPurchaseModeEnded, null); }
private void OnPayMeForCurrencyResult(object result, object cookie) { bool flag = GameUtils.HandleSoftCurrencyFlow(result, cookie); if (flag) { Entity selectedBuilding = this.buildingSelector.SelectedBuilding; BuildingTypeVO buildingType = selectedBuilding.Get <BuildingComponent>().BuildingType; if (buildingType.Type != BuildingType.DroidHut && PayMeScreen.ShowIfNoFreeDroids(new OnScreenModalResult(this.OnPayMeForDroidResult), null)) { return; } } UXController uXController = Service.UXController; uXController.HUD.ToggleExitEditModeButton(true); this.LowerLiftedBuilding((!flag) ? DropKind.CancelPurchase : DropKind.ConfirmPurchase, true, this.lifted, true, true); }
public override void Execute() { base.Execute(); ScreenController screenController = Service.Get <ScreenController>(); UXController uXController = Service.Get <UXController>(); ScreenBase highestLevelScreen = screenController.GetHighestLevelScreen <ClosableScreen>(); if (highestLevelScreen != null) { string name = highestLevelScreen.GetType().get_Name(); if (name == "PlanetDetailsScreen") { if (!Service.Get <BuildingLookupController>().HasNavigationCenter()) { Service.Get <GalaxyViewController>().GoToHome(); } else { Service.Get <GalaxyViewController>().TranstionPlanetToGalaxy(); } highestLevelScreen.Close(null); } else { highestLevelScreen.Close(null); } } if (uXController.HUD.IsSquadScreenOpenAndCloseable()) { SquadController squadController = Service.Get <SquadController>(); if (squadController.StateManager.SquadScreenState == SquadScreenState.Donation) { SquadSlidingScreen highestLevelScreen2 = screenController.GetHighestLevelScreen <SquadSlidingScreen>(); highestLevelScreen2.CloseDonationView(); } else { uXController.HUD.SlideSquadScreenClosed(); } } this.parent.ChildComplete(this); }
public void SetupElements(GameObjectViewComponent view, bool primary, bool secondary) { if (this.IsInitialized) { return; } if (this.HealthAmount >= this.MaxHealthAmount && this.SecondaryHealthAmount >= this.SecondaryMaxHealthAmount) { this.TeardownElements(); return; } this.IsInitialized = true; if (primary && TooltipHelper.WouldOverlapAnotherTooltip(view)) { return; } this.secondaryOnly = (secondary && !primary); UXController uXController = Service.Get <UXController>(); string text = "HealthSlider" + view.MainGameObject.GetInstanceID().ToString(); if (primary) { this.slider = uXController.MiscElementsManager.CreateHealthSlider(text, uXController.WorldUIParent, false); if (this.slider != null) { this.slider.Value = 1f; this.tooltipHelper.SetupElements(view, this.slider, 0f, true, true); } } if (secondary) { this.secondarySlider = uXController.MiscElementsManager.CreateHealthSlider("s_" + text, uXController.WorldUIParent, true); if (this.secondarySlider != null) { this.secondarySlider.Value = 1f; this.secondaryTooltipHelper.SetupElements(view, this.secondarySlider, 1f, true, false); } } }
private void OnConfirmUnstashStamp(bool accept) { if (this.buildingSelector.SelectedBuilding != null) { string uid = this.buildingSelector.SelectedBuilding.Get <BuildingComponent>().BuildingType.Uid; BuildingController buildingController = Service.BuildingController; BaseLayoutToolController baseLayoutToolController = Service.BaseLayoutToolController; UXController uXController = Service.UXController; if (!accept) { this.EnsureLoweredLiftedBuilding(); baseLayoutToolController.StashBuilding(this.buildingSelector.SelectedBuilding); buildingController.EnsureDeselectSelectedBuilding(); this.buildingController.DisableUnstashStampingState(); uXController.HUD.BaseLayoutToolView.RefreshStashedBuildingCount(uid); return; } baseLayoutToolController.StampUnstashBuildingByUID(uid); uXController.HUD.BaseLayoutToolView.RefreshStashedBuildingCount(uid); uXController.HUD.ShowContextButtons(buildingController.SelectedBuilding); } }
private GameController gameControllerClassReference; //Referencia a la clase "GameController". void Awake() { UXControllerClassReference = GameObject.FindWithTag("GameController").GetComponent <UXController> (); gameControllerClassReference = GameObject.FindWithTag("GameController").GetComponent <GameController> (); }
private void HandleBackButton() { IState currentState = Service.GameStateMachine.CurrentState; if (currentState is IntroCameraState) { IntroCameraAnimation intro = Service.UXController.Intro; if (intro != null) { intro.FinishUp(true); } return; } for (int i = this.backButtonHandlers.Count - 1; i >= 0; i--) { if (this.backButtonHandlers[i].HandleBackButtonPress()) { return; } } UICamera.selectedObject = null; UICamera.hoveredObject = null; if (TouchScreenKeyboard.visible) { return; } ScreenController screenController = null; if (Service.ScreenController != null) { screenController = Service.ScreenController; AlertScreen highestLevelScreen = screenController.GetHighestLevelScreen <AlertScreen>(); if (highestLevelScreen != null && highestLevelScreen.IsAlwaysOnTop) { this.HandleScreenBack(highestLevelScreen); return; } } if (Service.HoloController != null) { HoloController holoController = Service.HoloController; if (holoController.HasAnyCharacter()) { Service.EventManager.SendEvent(EventId.StoryNextButtonClicked, null); return; } } if (screenController != null) { ScreenBase highestLevelScreen2 = screenController.GetHighestLevelScreen <ScreenBase>(); ClosableScreen highestLevelScreen3 = screenController.GetHighestLevelScreen <ClosableScreen>(); if (Service.CurrentPlayer.CampaignProgress.FueInProgress || Service.UserInputInhibitor.IsDenying()) { if (highestLevelScreen2 != null && highestLevelScreen2.AllowFUEBackButton && this.HandleScreenBack(highestLevelScreen2)) { return; } this.TryQuit(); return; } else { if (highestLevelScreen2 != null && this.HandleScreenBack(highestLevelScreen2)) { return; } if (highestLevelScreen3 != null && this.HandleScreenBack(highestLevelScreen3)) { return; } } } if (currentState is EditBaseState) { HomeState.GoToHomeState(null, false); return; } if (Service.BuildingController != null) { BuildingController buildingController = Service.BuildingController; if (buildingController.SelectedBuilding != null) { buildingController.EnsureDeselectSelectedBuilding(); return; } } if (currentState is BaseLayoutToolState) { UXController uXController = Service.UXController; uXController.HUD.BaseLayoutToolView.CancelBaseLayoutTool(); return; } if (Service.GalaxyViewController != null && currentState is GalaxyState) { GalaxyViewController galaxyViewController = Service.GalaxyViewController; galaxyViewController.GoToHome(); return; } this.TryQuit(); }
private void LowerLiftedBuilding(DropKind dropKind, bool affectBoard, bool sendLoweredEvent, bool playLoweredSound, bool showContextButtons) { SmartEntity selectedBuilding = this.buildingSelector.SelectedBuilding; if (selectedBuilding == null) { this.lifted = false; this.moved = false; return; } UXController uXController = Service.UXController; if (dropKind != DropKind.JustDrop) { uXController.MiscElementsManager.HideConfirmGroup(); } if (affectBoard && dropKind == DropKind.ConfirmPurchase) { BuildingTypeVO buildingType = selectedBuilding.BuildingComp.BuildingType; int credits = buildingType.Credits; int materials = buildingType.Materials; int contraband = buildingType.Contraband; string value = StringUtils.ToLowerCaseUnderscoreSeperated(buildingType.Type.ToString()); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(value); stringBuilder.Append("|"); stringBuilder.Append(buildingType.BuildingID); stringBuilder.Append("|"); stringBuilder.Append(buildingType.Lvl); if (PayMeScreen.ShowIfNotEnoughCurrency(credits, materials, contraband, stringBuilder.ToString(), new OnScreenModalResult(this.OnPayMeForCurrencyResult))) { return; } if (buildingType.Type != BuildingType.DroidHut && PayMeScreen.ShowIfNoFreeDroids(new OnScreenModalResult(this.OnPayMeForDroidResult), null)) { return; } if (buildingType.Type == BuildingType.NavigationCenter && buildingType.Lvl == 1) { Service.UXController.HUD.InitialNavigationCenterPlanetSelect(selectedBuilding, buildingType, new OnScreenModalResult(this.OnPickPlanetResult)); return; } } BuildingTypeVO buildingType2 = selectedBuilding.Get <BuildingComponent>().BuildingType; if (buildingType2.Time == 0 && dropKind != DropKind.JustDrop) { showContextButtons = false; } if (dropKind != DropKind.JustDrop) { uXController.HUD.ToggleExitEditModeButton(true); } this.canOccupy = this.EntireSelectionIsPlaceable(); if (!this.canOccupy) { this.LiftSelectedBuilding(selectedBuilding, false, false); int i = 0; int count = this.buildingSelector.AdditionalSelectedBuildings.Count; while (i < count) { this.LiftSelectedBuilding(this.buildingSelector.AdditionalSelectedBuildings[i], false, false); i++; } } bool flag = !this.LowerLiftedBuildingHelper(selectedBuilding, dropKind, affectBoard, sendLoweredEvent, playLoweredSound, showContextButtons, string.Empty); int j = 0; int count2 = this.buildingSelector.AdditionalSelectedBuildings.Count; while (j < count2) { this.LowerLiftedBuildingHelper(this.buildingSelector.AdditionalSelectedBuildings[j], dropKind, affectBoard, false, false, false, string.Empty); j++; } if (sendLoweredEvent) { for (int k = 0; k < this.buildingSelector.AdditionalSelectedBuildings.Count; k++) { Service.EventManager.SendEvent(EventId.UserLoweredBuilding, this.buildingSelector.AdditionalSelectedBuildings[k]); } Service.EventManager.SendEvent(EventId.UserLoweredBuilding, flag ? null : selectedBuilding); } if (affectBoard && dropKind == DropKind.JustDrop && this.ShouldSaveAfterEveryMove()) { BuildingMultiMoveRequest buildingMultiMoveRequest = new BuildingMultiMoveRequest(); buildingMultiMoveRequest.PositionMap = new PositionMap(); Position position = new Position(); position.X = selectedBuilding.Get <TransformComponent>().X; position.Z = selectedBuilding.Get <TransformComponent>().Z; buildingMultiMoveRequest.PositionMap.AddPosition(selectedBuilding.Get <BuildingComponent>().BuildingTO.Key, position); for (int l = 0; l < this.buildingSelector.AdditionalSelectedBuildings.Count; l++) { Entity entity = this.buildingSelector.AdditionalSelectedBuildings[l]; position = new Position(); position.X = entity.Get <TransformComponent>().X; position.Z = entity.Get <TransformComponent>().Z; buildingMultiMoveRequest.PositionMap.AddPosition(entity.Get <BuildingComponent>().BuildingTO.Key, position); } BuildingMultiMoveCommand command = new BuildingMultiMoveCommand(buildingMultiMoveRequest); Service.ServerAPI.Sync(command); } if (dropKind == DropKind.ConfirmPurchase || dropKind == DropKind.CancelPurchase) { Service.EventManager.SendEvent(EventId.BuildingPurchaseModeEnded, null); } }
private UXController UXControllerClassReference; //Referencia a la clase "UXController". void Awake() { //nextSceneClass = GetComponent<NextScene>(); UXControllerClassReference = GameObject.FindWithTag("GameController").GetComponent <UXController> (); }
private UXController UXControllerClassReference; //Referencia a la clase "UXController". void Awake() { rigidbodyShellReference = GetComponent <Rigidbody> (); playerTransformReference = GameObject.FindWithTag("Player").GetComponent <Transform>(); UXControllerClassReference = GameObject.FindWithTag("GameController").GetComponent <UXController> (); }