void Handle_ClickOnMenuScreen() { WorldState.currentLevel.ResetFinal(); Camera cameraObj = Camera.main; if (cameraObj == null) { Debug.Log("Unable to access main Camera"); return; } BuildMenu buildMenu = cameraObj.GetComponent <BuildMenu>(); if (buildMenu == null) { Debug.Log("Unable to access BuildMenu"); return; } Destroy(buildMenu.splashScreen_instance); Destroy(buildMenu.credits_instance); buildMenu.HideNavigationButtons(); Intermission intermission = cameraObj.GetComponent <Intermission>(); if (intermission == null) { Debug.Log("Unable to access Intermission"); return; } intermission.SendMessage("PerformBuildIntermission"); WorldState.gameState = WorldState.GameState.Intermission_FloraIn; }
protected override void OnSpawn() { base.OnSpawn(); ConsumeMouseScroll = true; initTime = KTime.Instance.UnscaledGameTime; bool flag = UseHotkeyBuildMenu(); if (flag) { Instance = this; productInfoScreen = Util.KInstantiateUI <ProductInfoScreen>(productInfoScreenPrefab, base.gameObject, true); productInfoScreen.rectTransform().pivot = new Vector2(0f, 0f); productInfoScreen.onElementsFullySelected = OnRecipeElementsFullySelected; productInfoScreen.Show(false); buildingsScreen = Util.KInstantiateUI <BuildMenuBuildingsScreen>(buildingsMenuPrefab.gameObject, base.gameObject, true); BuildMenuBuildingsScreen buildMenuBuildingsScreen = buildingsScreen; buildMenuBuildingsScreen.onBuildingSelected = (Action <BuildingDef>)Delegate.Combine(buildMenuBuildingsScreen.onBuildingSelected, new Action <BuildingDef>(OnBuildingSelected)); buildingsScreen.Show(false); Game.Instance.Subscribe(288942073, OnUIClear); Game.Instance.Subscribe(-1190690038, OnBuildToolDeactivated); Initialize(); this.rectTransform().anchoredPosition = Vector2.zero; } else { base.gameObject.SetActive(flag); } }
/* * hintBoard = GameObject.Find ("HintBoard"); * hintBoardScript = hintBoard.GetComponent<HintBoard>(); * Acquire object like this. * */ void Update() { if (!gameOver) { time += Time.deltaTime; //Debug.Log (time); if (spawnedLastPredator) { GameObject[] arr = GameObject.FindGameObjectsWithTag("Carnivore"); if (arr.Length == 0) { buildMenu = GameObject.Find("MainCamera"); buildMenuScript = buildMenu.GetComponent <BuildMenu>(); drawYouWon = true; gameOver = true; buildMenuScript.endGame(); } } } }
private GameEntityTypeData InnerPickNextBuy(ArcenSimContext Context, List <BuildMenu> Menus) { bag.Clear(); for (int i = 0; i < Menus.Count; i++) { BuildMenu menu = Menus[i]; for (int j = 0; j < menu.List.Count; j++) { int timesToAdd = 0; GameEntityTypeData buyableType = menu.List[j]; if (buyableType.Balance_MarkLevel.RequiredAIPLevel > World_AIW2.Instance.AIProgress_Effective) { continue; } if (World_AIW2.Instance.CorruptedAIDesigns.Contains(buyableType)) { continue; } if (!buyableType.AICanUseThisWithoutUnlockingIt && !World_AIW2.Instance.UnlockedAIDesigns.Contains(buyableType)) { continue; } timesToAdd = 1; if (timesToAdd <= 0) { continue; } bag.AddItem(buyableType, timesToAdd); } } GameEntityTypeData result = bag.PickRandomItemAndReplace(Context.QualityRandom); bag.Clear(); return(result); }
// If not occupies, opens a build menu void OnMouseDown() { if (!HouseManager.houses.ContainsKey(gridIndex)) { BuildMenu.Open(this); } }
void Interact() { RaycastHit hitInfo; if (Physics.Raycast(fpsCamera.transform.position, fpsCamera.transform.forward, out hitInfo, range)) { //This is where we'll check if it's a hittable game object that can take damage. if (hitInfo.transform.name == "BuildTile") { BuildMenu tile = hitInfo.transform.GetComponent <BuildMenu>(); GameObject hitObj = hitInfo.transform.gameObject; tile.Menu(hitObj); } if (hitInfo.transform.name == "RegTurret(Clone)" || hitInfo.transform.name == "AirTurret(Clone)") { BuildMenu tile = hitInfo.transform.GetComponent <BuildMenu>(); GameObject hitObj = hitInfo.transform.gameObject; tile.Upgrade(hitObj); } if (hitInfo.transform.name == "SlowTurret(Clone)") { BuildMenu tile = hitInfo.transform.GetComponent <BuildMenu>(); GameObject hitObj = hitInfo.transform.gameObject; tile.UpgradeSlow(hitObj); } } }
protected override void OnSpawn() { base.OnSpawn(); initTime = KTime.Instance.UnscaledGameTime; if (BuildMenu.UseHotkeyBuildMenu()) { base.gameObject.SetActive(false); } else { Instance = this; base.onSelect += OnClickCategory; Refresh(); foreach (KToggle toggle in toggles) { toggle.group = GetComponent <ToggleGroup>(); } GetBuildableStates(true); Game.Instance.Subscribe(288942073, OnUIClear); } copyBuildingButton.GetComponent <MultiToggle>().onClick = delegate { OnClickCopyBuilding(); }; RefreshCopyBuildingButton(null); Game.Instance.Subscribe(-1503271301, RefreshCopyBuildingButton); copyBuildingButton.GetComponent <ToolTip>().SetSimpleTooltip(GameUtil.ReplaceHotkeyString(UI.COPY_BUILDING_TOOLTIP, Action.CopyBuilding)); }
public override void OnUpdate() { WorldSide localSide = World_AIW2.Instance.GetLocalSide(); if (localSide == null) { return; } Planet planet = Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed(); ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element; Window_InGameBuildMenu windowController = (Window_InGameBuildMenu)Element.Window.Controller; if (windowController.EntityChangedSinceLastButtonSetUpdate_Menu) { elementAsType.ClearButtons(); GameEntity entity = World_AIW2.Instance.GetEntityByID(windowController.EntityID); if (entity != null) { List <BuildMenu> menus = entity.TypeData.BuildMenus; int x = 0; for (int i = 0; i < menus.Count; i++) { BuildMenu item = menus[i]; if (item.RequiresPresenceOf != null) { bool foundIt = false; planet.Combat.DoForEntities(EntityRollupType.SpecialBuildMenuEnablers, delegate(GameEntity enabler) { if (enabler.TypeData != item.RequiresPresenceOf) { return(DelReturn.Continue); } foundIt = true; return(DelReturn.Break); }); if (!foundIt) { continue; } } bMenuSelectionItem newButtonController = new bMenuSelectionItem(entity.TypeData, i); Vector2 offset; offset.x = x * elementAsType.ButtonWidth; offset.y = 0; Vector2 size; size.x = elementAsType.ButtonWidth; size.y = elementAsType.ButtonHeight; elementAsType.AddButton(newButtonController, size, offset); x++; } } elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared(); windowController.EntityChangedSinceLastButtonSetUpdate_Menu = false; windowController.MenuIndexChangedSinceLastButtonSetUpdate = true; } }
void Awake() { if (instance != null) { Debug.LogError("More than 1 instance in scene"); } instance = this; }
public static void LoadCategoriesPatch(ref BuildMenu __instance) { BuildCategoryType customCategory = ModdedBuilding.buildCategoryType; MethodInfo AddCategory = AccessTools.Method(typeof(BuildMenu), "AddCategory"); AddCategory.Invoke(__instance, new object[] { customCategory }); }
public void Setup() { window = GetComponent<LSUIWindow> (); instance = this; for (int i = 0; i < _tiles.Length; i++) { _tiles[i].Setup (i); } }
public void Setup() { window = GetComponent <LSUIWindow> (); instance = this; for (int i = 0; i < _tiles.Length; i++) { _tiles[i].Setup(i); } }
void Awake() { buttonObjects = new List <GameObject>(); _instance = this; if (roundButtonPrefab.GetComponentInChildren <RoundButton>() == false) { throw new System.Exception("Round Button prefab has no RoundButton Component"); } }
private static void Init() { try { if (Orbwalker.MovementDelay < 200) { Orbwalker.MovementDelay += new Random().Next(200, 400); } if (AutoShop.Setup.CurrentChampionBuild.BuildData.Length > 0) { var i = 0; foreach (var item in AutoShop.Setup.CurrentChampionBuild.BuildData) { i++; BuildMenu.AddLabel(i + " - " + item); } } if (EnableCustomPlugins) { try { if ((Base)Activator.CreateInstance(null, "AramBuddy.Plugins.Champions." + Player.Instance.Hero + "." + Player.Instance.Hero).Unwrap() != null) { CustomChamp = true; Logger.Send("Loaded Custom Champion " + Player.Instance.Hero); } } catch (Exception) { CustomChamp = false; Logger.Send("There Is No Custom Plugin For " + Player.Instance.Hero, Logger.LogLevel.Warn); } } // Sends Start / End Msg Chatting.Init(); // Initialize Bot Functions. Brain.Init(); // Inits Activator if (EnableActivator) { Plugins.Activator.Load.Init(); } Chat.Print("AramBuddy Loaded !"); Chat.Print("AramBuddy Version: " + version); } catch (Exception ex) { Logger.Send("Program Error At Init", ex, Logger.LogLevel.Error); } }
private void Awake() { _player = FindObjectOfType <Player>(); _player.OnEntitySelected += UpdateMenuType; _player.OnEntityDeselected += () => { ChangeMenu(PlayerMenuType.Build); }; _buildMenu = transform.Find("BuildMenu").GetComponent <BuildMenu>(); _useMenu = transform.Find("UseMenu").GetComponent <UseMenu>(); _currentType = PlayerMenuType.Build; _currentMenu = _buildMenu; }
protected void StartParametrs() // Параметры задаваемые при старте { Main = GameObject.FindGameObjectWithTag("MainGo").GetComponent <MainScripts>(); Menu = GameObject.FindGameObjectWithTag("MainGo").GetComponent <BuildMenu>(); HP = maxHP; if (gameObject.tag == "Complete" && Main != null) { Main.Building.Add(this); } }
void Awake() { if (instance != null) { Destroy(gameObject); return; } instance = this; buildMenu = GetComponentInChildren <BuildMenu>(); }
public void PerformCraft(IPerformCraftEvent evt) { var menu = new BuildMenu(Blueprint, Blueprint.isUpgrade() ? ActionType.Upgrade : ActionType.Build, evt, Mod); var old_menu = Game1.activeClickableMenu; Game1.activeClickableMenu = menu; menu.exitFunction = () => { Game1.activeClickableMenu = old_menu; evt.Cancel(); }; }
// Use this for initialization void Start() { icons = new GameObject[4]; icons[0] = farmIcon; icons[1] = workshopIcon; icons[2] = schoolIcon; icons[3] = sanitationIcon; toggleItems(); menuScript = (BuildMenu)menu.GetComponent(typeof(BuildMenu)); menu.SetActive(false); }
public void OpenMenu() { BuildMenu.SetActive(true); TB.SetActive(false); DB.SetActive(false); MB.SetActive(false); Menu.SetActive(true); Cursor.visible = true; Cursor.lockState = CursorLockMode.None; PlayerControl.GetComponent <PlayerControler>().mouseSpeed = 0; GameObject.Find("Main Camera").GetComponent <Interact>().enabled = false; }
public void ChangeEvoProgress(Player player, float amount) { // if the player enters a new era if (playerEvoProgressDick[player] + amount / eraTimeStatsDick[player.Era][0] >= eraTimeStatsDick[player.Era][1]) { float excessRes = (playerEvoProgressDick[player] + amount / eraTimeStatsDick[player.Era][0] - eraTimeStatsDick[player.Era][1]) * eraTimeStatsDick[player.Era][0]; float newAmount = amount - excessRes; playerEvoProgressDick [player] += newAmount / eraTimeStatsDick[player.Era][0]; Eras nextEra = GameManager.orderEraDick[GameManager.eraOrderDick[player.Era] + 1]; playerEvoProgressDick [player] += excessRes / eraTimeStatsDick[nextEra][0]; } else { playerEvoProgressDick [player] += amount / eraTimeStatsDick[player.Era][0]; } if (player == GameManager.HumanPlayer && playerEvoProgressDick[player] < player.GetMaxTotalUnique()) { evoProgressBar.rectTransform.anchorMax = new Vector2(playerEvoProgressDick[player], evoProgressBar.rectTransform.anchorMax.y); for (int i = nextUnlockableEPB; i < evoPanButts.Length; i++) { SpecializationButton sp = evoPanButts[i] as SpecializationButton; if (evoPanButts[i].position <= playerEvoProgressDick[player] && (sp == null || !sp.disabled && (sp.Era == Eras.StoneAge || sp.initiated))) { evoPanButts[i].button.interactable = true; } else if (evoPanButts[i].position > playerEvoProgressDick[player]) { nextUnlockableEPB = i; break; } } } // if New Era if (playerEvoProgressDick[player] >= eraTimeStatsDick[player.Era][1] && player.Era != Eras.Information) { player.NewEra(); if (player == GameManager.HumanPlayer) { GameManager.Hud.EraText.text = player.Era.ToString(); BuildMenu.NextEra(player.Era); LocalUpgradesMenu.NewEra(); if (gameObject.activeSelf) { StartCoroutine(newEraAnnouncement.NewEraBitches(player.Era)); } else { openNewEraOnNextEnable = true; GameManager.Hud.StartFlashButton(evolutionButton.image, new BoolMethod(delegate { return(openNewEraOnNextEnable); })); } } } }
void Cancel() { if (canCancel) { Destroy(curInstantiated); infoCamera.enabled = false; curSelected = null; inBuildMode = false; Camera.main.GetComponent <CameraController>().SetHaveControl(true); instantHere.SetActive(false); BuildMenu.Hide(); } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } gameObject.SetActive(false); }
public void CloseMenu() { BuildMenu.SetActive(false); Menu.SetActive(false); TB.SetActive(false); DB.SetActive(false); MB.SetActive(false); mainCamera.GetComponent <Interact>().showBuild = false; Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; PlayerControl.GetComponent <PlayerControler> ().mouseSpeed = 3; GameObject.Find("Main Camera").GetComponent <Interact>().enabled = true; }
public UIController(GameSystem gameSystem) : base(gameSystem) { _cashLabel = gameSystem.CashLabel; _buildMenu = gameSystem.BuildMenu; _upgradeMenu = gameSystem.UpgradeMenu; _startButton = gameSystem.StartButton; _startButton.onClick.AddListener(() => { gameSystem.GameController.StartGame(); _startButton.gameObject.SetActive(false); }); }
void Start() { //Finds container that has all the building GameObjects. m_BuildMenuScript = GameObject.FindObjectOfType(typeof(BuildMenu)) as BuildMenu; buildList = new GameObject[transform.childCount]; //fill array with building models for (int i = 0; i < transform.childCount; i++) { buildList[i] = transform.GetChild(i).gameObject; } }
private int NumUnboundActions() { int num = 0; for (int i = 0; i < GameInputMapping.KeyBindings.Length; i++) { BindingEntry bindingEntry = GameInputMapping.KeyBindings[i]; if (bindingEntry.mKeyCode == KKeyCode.None && (BuildMenu.UseHotkeyBuildMenu() || !bindingEntry.mIgnoreRootConflics)) { num++; } } return(num); }
public void Execute(ArcenSimContext Context, GameEntity BuildingEntity) { List <GameEntityTypeData> turretTypes = new List <GameEntityTypeData>(); List <GameEntityTypeData> shieldTypes = new List <GameEntityTypeData>(); for (int menuIndex = 0; menuIndex < BuildingEntity.TypeData.BuildMenus.Count; menuIndex++) { BuildMenu menu = BuildingEntity.TypeData.BuildMenus[menuIndex]; for (int i = 0; i < menu.List.Count; i++) { GameEntityTypeData entityData = menu.List[i]; if (entityData.Balance_FuelCost.FuelMultiplier > 0) { continue; } if (entityData.Balance_PowerCost.PowerMultiplier <= 0) { continue; } if (!entityData.CapIsPerPlanet) { continue; } List <GameEntityTypeData> listToAddTo = null; if (entityData.RollupLookup[EntityRollupType.Combatants]) { listToAddTo = turretTypes; } else if (entityData.RollupLookup[EntityRollupType.ProjectsShield]) { listToAddTo = shieldTypes; } if (listToAddTo == null) { continue; } ArcenRejectionReason rejectionReason = BuildingEntity.Side.GetCanBuildAnother(entityData); if (rejectionReason != ArcenRejectionReason.Unknown) { continue; } listToAddTo.Add(entityData); } } int remainingBudget = BuildingEntity.Side.NetPower; remainingBudget -= SpendBudgetOnItemsInList(Context, BuildingEntity.Side, BuildingEntity.WorldLocation, BuildingEntity.TypeData.Radius * 2, shieldTypes, (remainingBudget * 25) / 100); remainingBudget -= SpendBudgetOnItemsInList(Context, BuildingEntity.Side, BuildingEntity.WorldLocation, BuildingEntity.TypeData.Radius * 2, turretTypes, remainingBudget); }
public override void GetTextToShow(ArcenDoubleCharacterBuffer Buffer) { base.GetTextToShow(Buffer); BuildMenu menu = this.GetMenu(); if (menu == null) { Buffer.Add("NULL"); } else { Buffer.Add(menu.Abbreviation); } }
public void CheckForSpendingUnlockPoints(ArcenSimContext Context) { while (true) { int availablePoints = World_AIW2.Instance.AIProgress_Effective.IntValue - World_AIW2.Instance.SpentAIUnlockPoints; if (availablePoints < World_AIW2.Instance.Setup.Difficulty.AIPNeededPerUnlock) { break; } List <GameEntityTypeData> eligibleUnlocks = new List <GameEntityTypeData>(); List <BuildMenu> menus = World_AIW2.Instance.Setup.MasterAIType.BudgetItems[AIBudgetType.Reinforcement].NormalMenusToBuyFrom; for (int i = 0; i < menus.Count; i++) { BuildMenu menu = menus[i]; for (int j = 0; j < menu.List.Count; j++) { GameEntityTypeData buyableType = menu.List[j]; if (buyableType.AICanUseThisWithoutUnlockingIt) { continue; } if (buyableType.CopiedFrom != null && buyableType.CopiedFrom != buyableType) { continue; } if (World_AIW2.Instance.CorruptedAIDesigns.Contains(buyableType)) { continue; } if (World_AIW2.Instance.UnlockedAIDesigns.Contains(buyableType)) { continue; } eligibleUnlocks.Add(buyableType); } } if (eligibleUnlocks.Count <= 0) { break; } GameEntityTypeData typeToUnlock = eligibleUnlocks[Context.QualityRandom.Next(0, eligibleUnlocks.Count)]; World_AIW2.Instance.UnlockEntityTypeForAI(typeToUnlock, Context); } }
void Handle_ClickOnIntermissionScreen() { Counters.movementWarmupCounter = Consts.MOVEMENT_WARMUP; Camera cameraObj = Camera.main; if (cameraObj == null) { Debug.Log("Unable to access main Camera"); return; } Intermission intermission = cameraObj.GetComponent <Intermission>(); if (intermission == null) { Debug.Log("Unable to access Intermission"); return; } intermission.SendMessage("PerformDestroyIntermission"); if (WorldState.currentLevel.ReachedFinal()) { WorldState.currentLevel.Set(1); BuildMenu buildMenu = cameraObj.GetComponent <BuildMenu>(); if (buildMenu == null) { Debug.Log("Unable to access BuildMenu"); return; } buildMenu.Start(); WorldState.gameState = WorldState.GameState.SplashScreen; } else { WorldState.gameState = WorldState.GameState.Game; BuildLevel buildLevel = cameraObj.GetComponent <BuildLevel>(); if (buildLevel == null) { Debug.Log("Unable to access BuildLevel"); return; } buildLevel.PerformBuild(); WorldState.DisableGravity(); WorldState.build_virtual_level_representation(); WorldState.debug_print_virtual_level(); } }
void OnGUI() { if (GameIsOver) { spawnPredator = GameObject.Find ("PredatorSpawner"); spawnPredatorScript = spawnPredator.GetComponent<SpawnPredator>(); spawnPredatorScript.stopRunTime(); // draw resource menu GUILayout.BeginArea (new Rect (350, 350, 600, 600)); GUILayout.BeginHorizontal ("box"); GUILayout.Label("You Lost!", largeFont); // end GUI for resource menu GUILayout.EndHorizontal (); GUILayout.EndArea (); if (GUI.Button (new Rect (360, 420, 140, 30), "Return to Lobby")) { Destroy (this); Game.SwitchScene("World"); } } if (GameIsOver && !endedGame) { endedGame = true; buildMenu = GameObject.Find ("MainCamera"); buildMenuScript = buildMenu.GetComponent<BuildMenu>(); buildMenuScript.endGame(); } }