private void Awake() { if (instance == null) { instance = this; } }
public void purchaseItem() { string itemInfo = ShopScreen.selectedItem; Debug.Log(itemInfo); if (itemInfo == null) { return; } Item item = itemHolder.itemConverter(itemInfo); if (checkPurchase(item)) { //Update usercurrency shopConents.changeCurrency(item); ShopScreen.displayWallet(shopConents.getCurrency()); Debug.Log("Success"); ItemControl.transferToInventory(item); } else { ShopScreen.displayInsufficentFunds(); return; } }
//bool isClosing; // Use this for initialization void Awake() { texts = GetComponentsInChildren <TMPro.TextMeshProUGUI> (); shop = FindObjectOfType <ShopScreen> (); UpdateStatus(); }
public static void addToCurrency(int amt) { shopConents.addCurrency(amt); if (GameObject.Find("wallet") != null) { ShopScreen.displayWallet(ShopControl.shopConents.getCurrency()); } }
void Awake() { stats = gameObject.transform.Find("StatsScreen").gameObject.GetComponent <StatsScreen>(); inventory = gameObject.transform.Find("InventoryScreen").gameObject.GetComponent <InventoryScreen>(); shop = gameObject.transform.Find("ShopScreen").gameObject.GetComponent <ShopScreen>(); journal = gameObject.transform.Find("JournalScreen").gameObject.GetComponent <JournalScreen>(); map = gameObject.transform.Find("MapScreen").gameObject.GetComponent <MapScreen>(); tabs = gameObject.transform.Find("GuiTabsButtons").gameObject; tabs.SetActive(false); playerAttack = GameObject.Find("MyCharacter").GetComponent <Attack>(); playerMovement = GameObject.Find("MyCharacter").GetComponent <Movement>(); playerRigidBody = GameObject.Find("MyCharacter").GetComponent <Rigidbody2D>(); }
public void Start() { toggleShop.onClick.AddListener(delegate { //this.gameObject.SetActive(false); this.gameObject.SetActive(!this.gameObject.activeSelf); if (this.gameObject.activeSelf) { ShopScreen.displayWallet(ShopControl.shopConents.getCurrency()); } }); displayWallet(ShopControl.getCurrency()); this.gameObject.SetActive(false); }
public UiSystem() { mBriefingScreen = new BriefingScreen(); mIntroScreen = new IntroScreen(); mShopScreen = new ShopScreen(); mSettingsScreen = new SettingsScreen(); mAdsScreen = new AdsScreen(); mGameScreen = new GameScreen(); mDebriefingWinScreen = new DebriefingWinScreen(); mDebriefingDefeatScreen = new DebriefingDefeatScreen(); HideAllScreens(); mScreenMode = eMode.NO_SCREEN; mProgressBar = GameObject.Find("FilledZone").GetComponent <RectTransform>(); }
public bool Process() { if (!MapLogic.Instance.IsLoaded) { return(false); } MapStructure s = MapLogic.Instance.GetStructureByTag(Tag); if (s == null || s.Class == null || !s.Class.Usable) { Debug.LogFormat("Attempted to enter nonexistent building {0}", Tag); return(false); } ShopScreen screen = Utils.CreateObjectWithScript <ShopScreen>(); screen.Shop = s; return(true); }
public void init(ShopScreen parentScreen) { this.parentScreen = parentScreen; itemDescriptor = Vars.gameplay.getItemDescriptor(); backBtn = transform.Find("BackBtn").GetComponent<Button>(); ShopItem item; for (int i = 0; i < transform.childCount; i++) { item = transform.GetChild(i).GetComponent<ShopItem>(); if (item != null) { item.init(); items.Add(item); } } Transform miscItemsTrans = transform.Find("MiscItems"); if (miscItemsTrans != null) { miscItems = new List<ShopItem>(); for (int i = 0; i < miscItemsTrans.childCount; i++) { item = miscItemsTrans.GetChild(i).GetComponent<ShopItem>(); item.init(); item.gameObject.SetActive(false); miscItems.Add(item); } } }
public override void LoadContent() { _backMenu = new GrowingMenuEntry("BACK"); MenuEntries.Add(_backMenu); _levelSelectionMenu = new GrowingMenuEntry("LEVEL"); MenuEntries.Add(_levelSelectionMenu); _shopMenu = new GrowingMenuEntry("SHOP"); MenuEntries.Add(_shopMenu); _saveMenu = new GrowingMenuEntry("SAVE"); MenuEntries.Add(_saveMenu); LevelSelection = new LevelSelectionScreen(ScreenManager.Game, this); Shop = new ShopScreen(ScreenManager.Game); _backMenu.Position = new Vector2(120, 16); _backMenu.Selected += (s, e) => LoadingScreen.Load(ScreenManager, false, new MainMenuScreen()); _levelSelectionMenu.Position = new Vector2(240, 16); _levelSelectionMenu.Selected += (s, e) => _activeTab = Tabs.LevelSelection; _shopMenu.Position = new Vector2(360, 16); _shopMenu.Selected += (s, e) => _activeTab = Tabs.Shop; _saveMenu.Position = new Vector2(480, 16); _saveMenu.Selected += (s, e) => { SavedGame.Save(SavedGame.DefaultSaveGameFile, ScreenManager.Game.Services.GetService<GameState>()); _saveMenu.IsVisible = false; _gameSaved = true; }; _gameSavedTextPosition = _saveMenu.Position + new Vector2(0, 5); LevelSelection.Initialize(); Shop.Initialize(); base.LoadContent(); }
void Awake() { instance = this; adsButton.SetActive(false); shop = Shop.Instance; }
//################################# // Handle input //################################# public override void HandleInput(InputState input) { if (input == null) { throw new ArgumentNullException("input"); } // Look up inputs for the player. KeyboardState keyboardState = input.CurrentKeyboardState; // key for the ship etc. if (input.IsNewKeyPress(Keys.B)) { if ((Vector3.Distance(_station.Position, _droneFleet.GetActiveDrone().Position) - _stationHeight) < 150 && Global.DemoMode == "Gameplay") { //playing the sound _soundEngine.Play2D("openShop", Global.SpeakerVolume / 10, false); if (shop == null) { shop = new ShopScreen(_droneFleet, _station); } ScreenManager.AddScreen(shop); } if (Global.DemoMode == "Models") { _boidsActivate = true; } } if (Global.DemoMode == "Effects") { if (_input.IsNewKeyPress(Keys.C)) { _effect++; if (_effect > 2) { _effect = 0; } } if (_input.IsNewKeyPress(Keys.E)) { explosionList.Add(new ExplosionSystem(new ShipExplosionSettings(), _input.getMouseInWorldPos(), 0.4)); switch (_effect) { case 0: explosionList.Add(new ExplosionSystem(new ShipExplosionSettings(), _input.getMouseInWorldPos(), 0.4)); break; case 1: explosionList.Add(new ExplosionSystem(new ShipExplosionSettings(), new ShipRingExplosionSettings(), _input.getMouseInWorldPos(), 0.4, 30)); break; case 2: explosionList.Add(new ExplosionSystem(new BombExplosionSettings(), new BombRingExplosionSettings(), _input.getMouseInWorldPos(), 0.4, 50, true)); break; } } } //player hits ESC it pauses the game if (input.IsPauseGame()) { //playing the sound _soundEngine.Play2D("openShop", Global.SpeakerVolume / 10, false); if (pause == null) { pause = new DemoPauseMenuScreen(); } ScreenManager.AddScreen(pause); } }
//################################# // Handle input //################################# public override void HandleInput(InputState input) { if (input == null) { throw new ArgumentNullException("input"); } // Look up inputs for the player. KeyboardState keyboardState = input.CurrentKeyboardState; TutorialText.TryGetValue(nextIndex, out tutorialMessage); if (nextIndex == 0) { if (input.IsNewKeyPress(Keys.Y)) { Global.MusicEngine.StopAllSounds(); ScreenManager.AddScreen(new DemoGameplayScreen()); ScreenManager.RemoveScreen(this); } else if (input.IsNewKeyPress(Keys.N)) { //playing the sound _engine.SetListenerPosition(new Vector3D(0, 0, 0), new Vector3D(0, 0, 1)); ISound Open; Open = _engine.Play2D(_openShop, false, true, false); Open.Volume = Global.SpeakerVolume / 10; Open.Paused = false; nextIndex++; TutorialText.TryGetValue(nextIndex, out tutorialMessage); } } else { // key for the ship etc. if (input.IsNewKeyPress(Keys.B)) { if ((Vector3.Distance(_station.Position, _droneFleet.GetActiveDrone().Position) - _stationHeight) < 150) { //playing the sound _engine.SetListenerPosition(new Vector3D(0, 0, 0), new Vector3D(0, 0, 1)); ISound Open; Open = _engine.Play2D(_openShop, false, true, false); Open.Volume = Global.SpeakerVolume / 10; Open.Paused = false; if (shop == null) { shop = new ShopScreen(_droneFleet, _station); } ScreenManager.AddScreen(shop); } } if (input.IsNewKeyPress(Keys.Space) && (nextIndex + 1) < TutorialText.Count && (nextIndex + 1) > 0) { //playing the sound _engine.SetListenerPosition(new Vector3D(0, 0, 0), new Vector3D(0, 0, 1)); ISound Open; Open = _engine.Play2D(_openShop, false, true, false); Open.Volume = Global.SpeakerVolume / 10; Open.Paused = false; nextIndex++; TutorialText.TryGetValue(nextIndex, out tutorialMessage); if (nextIndex == TutorialText.Count - 1) { movementAllowed = true; } } } if (input.IsNewKeyPress(Keys.Back) && nextIndex < TutorialText.Count && (nextIndex - 1) >= 0) { //playing the sound _engine.SetListenerPosition(new Vector3D(0, 0, 0), new Vector3D(0, 0, 1)); ISound Open; Open = _engine.Play2D(_openShop, false, true, false); Open.Volume = Global.SpeakerVolume / 10; Open.Paused = false; nextIndex--; TutorialText.TryGetValue(nextIndex, out tutorialMessage); } if (movementAllowed) { if (input.IsNewKeyPress(Keys.X)) { Global.MusicEngine.StopAllSounds(); ScreenManager.AddScreen(new DemoGameplayScreen()); ScreenManager.RemoveScreen(this); } } //player hits ESC it pauses the game if (input.IsPauseGame()) { if (pause == null) { pause = new DemoPauseMenuScreen(); } ScreenManager.AddScreen(pause); } }