private void OnEnable() { if (ShopUI.shopUI == null) { ShopUI.shopUI = this; } }
public void Initialize(ShopUI shopUI, ShopItem shopItem) { this.shopUI = shopUI; this.shopItem = shopItem; UpdateUI(); }
void Awake() { if (instance == null) { instance = this; } }
void BuyingGoods() { if (!isoutcoin) { FlyCoin(); //增加钱 ShopUI _shop = transform.Find("/goodBox").GetComponent <ShopUI>(); _shop.AddMoney(selectgoods.goods.Price); isoutcoin = !isoutcoin; } TimeTool.SetWaitTime(0.5f, gameObject, () => { //买东西 moveType = MoveType.Vertical; if (info.startPiont == 0) { SetTarget("finish2"); } else { SetTarget("finish1"); } ChangeCharaState(CharaState.Out); }); }
private void Awake() { player = GameObject.Find("Player"); pi = player.GetComponent <PlayerInfo>(); shop = shop.GetComponent <ShopUI>(); inven = player.transform.Find("InvenCanvas").Find("Inventory").gameObject.GetComponent <InventoryUI>(); }
public void AddSection() { ShopUI shopUI = (ShopUI)target; shopUI.sectionsToInstantiate.RemoveAll(x => x == null); shopUI.sectionsToInstantiate.Add(new ShopUI.ShopSection()); }
void AddGoodsToHead() { GameObject goods = new GameObject(); SpriteRenderer _sprite = goods.AddComponent <SpriteRenderer>(); ShopUI _shop = transform.Find("/goodBox").GetComponent <ShopUI>(); CharBag.Goods[] goodslist = _shop.GetGoods(); //如果货架上有商品,则添加道具到背包 if (goodslist[selectgoods.slotID - 1].Name != null && goodslist[selectgoods.slotID - 1].ID != 0) { //移除道具 _shop.BuyedGoods(selectgoods); } _sprite.sprite = Materiral.GetMaterialIcon(selectgoods.goods.MateriralType, selectgoods.goods.ID); _sprite.sortingLayerName = "Character"; //设定道具的为角色的子物件 goods.transform.SetParent(this.transform, false); goods.transform.position = goodsVertor; //把物体移动到头上 LeanTween.move(goods.gameObject, new Vector2(goodsVertor.x, goodsVertor.y + 0.5f), 0.5f); }
private void Awake() { Instance = this; tween = this.GetComponent<TweenPosition>(); coinScrollView = transform.Find("CoinScrollView").gameObject; diamondScrollView = transform.Find("DiamondScrollView").gameObject; diamondScrollView.SetActive(false); }
void Start() { gameObject.transform.GetChild(0).gameObject.SetActive(false); instance = this; slots = itemsParent.GetComponentsInChildren <ShopSlot>(); }
void Awake() { Instance = this; tween = this.GetComponent <TweenPosition>(); coinScrollView = transform.Find("CoinScrollView").gameObject; diamondScrollView = transform.Find("DiamondScrollView").gameObject; diamondScrollView.SetActive(false); }
private void Start() { inventory = Inventory.instance; shop = Shop.instance; shopUI = ShopUI.instance; isHub = shop.isHub; }
void Awake() { if (_instance != null) { Destroy(this.gameObject); } _instance = this; }
public static void Open() { if (Instance == null) { Instance = ResourceManager.Instance.Spawn("ShopUI", ResourceManager.Type.UI).GetComponent <ShopUI>(); } Instance.Init(); }
public void Yes() { Hide(); ShopUI shopUI = ArenaMenuUI.GetInstance().GetPanel(MenuName.SHOP) as ShopUI; shopUI.SetFromPanel(this); shopUI.Show(); }
protected override void Awake() { base.Awake(); gameObject.tag = "ShopGrid"; itemNameText = rectTransform.Find("ItemName").GetComponent <Text>(); moneyText = rectTransform.Find("MoneyText").GetComponent <Text>(); borderTrans = rectTransform.Find("GridBorder") as RectTransform; shopUI = rectTransform.GetComponentInParent <ShopUI>(); }
private void Awake() { controller = GetComponentInParent <RestController>(); statusUI = GetComponentInChildren <StatusUI>(); dialogueManager = GetComponentInChildren <DialogueManager>(); inventoryUI = GetComponentInChildren <InventoryUI>(); shopUI = GetComponentInChildren <ShopUI>(); menuUI = GetComponentInChildren <MenuUI>(); }
void OpenRecipeMenu(GameObject go) { Plane.SetActive(true); MenuUI.SetActive(true); recipeUI.SetActive(false); ShopUI.ChangeRecipeUiState(); EventTriggerListener.Get(btn_Close.gameObject).onClick = CloseRecipeMenu; GetRecipeList(); }
public void HandleEvent(UIControl control, int command, float wparam, float lparam) { if (control == returnButton) { AudioPlayer.PlayAudio(ArenaMenuUI.GetInstance().GetComponent <AudioSource>()); Hide(); ArenaMenuUI ui = GameObject.Find("ArenaMenuUI").GetComponent <ArenaMenuUI>(); ui.GetPanel(MenuName.ARENA).Show(); GameApp.GetInstance().Save(); } if (control == avatarScroller && command == (int)UIImageScroller.Command.ScrollSelect) { currentSelectionIndex = (int)wparam; SetBuyButtonText(); ChangeAvatarModel(BUTTON_NUM - 1 - currentSelectionIndex); avatarInfoPanel.SetText(AvatarInfo.AVATAR_INFO[BUTTON_NUM - 1 - currentSelectionIndex]); UpdateCashPanel(); } if (control == buyButton) { AudioPlayer.PlayAudio(ArenaMenuUI.GetInstance().GetComponent <AudioSource>()); if (GameApp.GetInstance().GetGameState().GetAvatarData((AvatarType)(BUTTON_NUM - 1 - currentSelectionIndex)) == AvatarState.ToBuy) { GameConfig gConf = GameApp.GetInstance().GetGameConfig(); if (GameApp.GetInstance().GetGameState().BuyAvatar((AvatarType)(BUTTON_NUM - 1 - currentSelectionIndex), gConf.GetAvatarConfig(BUTTON_NUM - 1 - currentSelectionIndex).price)) { SetBuyButtonText(); } else { TopDialogUI.GetInstance().ShowDialog(); } UpdateAvatarIcon(); UpdateCashPanel(); } else if (GameApp.GetInstance().GetGameState().GetAvatarData((AvatarType)(BUTTON_NUM - 1 - currentSelectionIndex)) == AvatarState.Avaliable) { GameApp.GetInstance().GetGameState().Avatar = (AvatarType)(BUTTON_NUM - 1 - currentSelectionIndex); } } else if (control == getMoreMoneyButton) { AudioPlayer.PlayAudio(ArenaMenuUI.GetInstance().GetComponent <AudioSource>()); Hide(); ShopUI shopUI = GameObject.Find("ArenaMenuUI").GetComponent <ArenaMenuUI>().GetPanel(MenuName.SHOP) as ShopUI; shopUI.SetFromPanel(this); shopUI.Show(); } }
void Awake() { if (_instance != null && _instance != this) { // If that is the case, we destroy other instances Destroy(gameObject); } // Here we save our singleton instance _instance = this; //DontDestroyOnLoad(this.gameObject); }
private void Awake() { if (instance != null) { Debug.LogWarning("More than one instance of ShopUI found"); return; } instance = this; ShopItemEvents.OnItemClick += ItemSelected; }
void Start() { shopUI = transform.GetComponent <ShopUI> (); shopNavigation = transform.GetComponent <ShopNavigation> (); shopNavigation.LoadVariables(); shopUI.LoadVariables(); SetPlayerNotReady(); for (int i = 0; i < ownedSpells.Count; i++) { shopNavigation.spellChoiceContainer.transform.Find(ownedSpells[i].spellName).GetComponent <SpellIcon> ().ownedIcon.SetActive(true); } hasStarted = true; }
public void Yes() { Debug.Log("yes"); //Hide(); AvatarUI avatarUIPanel = ArenaMenuUI.GetInstance().GetPanel(MenuName.AVATAR) as AvatarUI; avatarUIPanel.Hide(); iapDialog.Hide(); ShopUI shopUI = ArenaMenuUI.GetInstance().GetPanel(MenuName.SHOP) as ShopUI; shopUI.SetFromPanel(avatarUIPanel); shopUI.Show(); }
public void LoadVariables() { shop = transform.GetComponent <Shop> (); shopUI = transform.GetComponent <ShopUI> (); input = transform.GetComponent <ShopInputController> (); lastInputTime = Time.time; currentX = 0; currentY = 0; FillSpellIconsArray(); shop.Select(spellArray[currentX, currentY]); currentState = ShopStates.Navigating; hasStarted = true; }
void LoadMainUI() { ShopUI.SetActive(false); ProfileUI.SetActive(false); RewardsUI.SetActive(false); RateUI.SetActive(false); SettingsUI.SetActive(false); MainUI.SetActive(true); RegisterCanvas.enabled = false; MainCanvas.enabled = true; UsernameText.text = PlayerPrefs.GetString("USERNAME"); MoneyText.text = PlayerPrefs.GetInt("MONEY") + " ₹"; }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(this); } shopPanel = GameObject.Find("ShopPanel"); shopItemsArea = GameObject.Find("ShopItemsArea").transform; shopSlots = shopItemsArea.GetComponentsInChildren <ShopSlot>().ToList(); tooltip = GameObject.Find("TooltipPanel"); }
void CloseRecipeMenu(GameObject go) { Plane.SetActive(false); _fitter.enabled = false; ShopUI.ChangeRecipeUiState(); scrollList.GetComponent <ScrollRect>().enabled = false; SlotList = null; foreach (Transform obj in _fitter.transform) { Destroy(obj.gameObject); } }
public override void Load() { Instance = this; Console = this.Logger; if (!Main.dedServ) { // Custom UI m_ShopUI = new ShopUI(); m_ShopUI.Activate(); UserInterface = new UserInterface(); } Config.Load(); }
// Update is called once per frame void Update() { if (Camera.main != null && !setAudioTime) { //Camera.mainCamera.audio.time = GameApp.GetInstance().GetGameState().MenuMusicTime; setAudioTime = true; } ArenaMenuPanel panel = panels[MenuName.ARENA] as ArenaMenuPanel; if (panel != null) { panel.Update(); } for (int i = 0; i < MenuName.MENU_COUNT; i++) { if (panels[i] != null) { panels[i].UpdateLogic(); } } ShopUI shopUI = panels[MenuName.SHOP] as ShopUI; if (shopUI != null) { shopUI.GetPurchaseStatus(); } if (!ReviewDialogUI.GetInstance().IsVisible()) { foreach (UITouchInner touch in iPhoneInputMgr.MockTouches()) { if (m_UIManager != null) { if (m_UIManager.HandleInput(touch)) { continue; } } } } }
protected override void Awake() { base.Awake(); if (scriptEnv != null) { luaClick = scriptEnv.Get <Action <PointerEventData> >("Click"); luaClick = scriptEnv.Get <Action <PointerEventData> >("Click"); luaClick = scriptEnv.Get <Action <PointerEventData> >("Click"); } if (luaAwake != null) { luaAwake(); return; } gameObject.tag = "ShopGrid"; itemNameText = rectTransform.Find("ItemName").GetComponent <Text>(); moneyText = rectTransform.Find("MoneyText").GetComponent <Text>(); borderTrans = rectTransform.Find("GridBorder") as RectTransform; shopUI = rectTransform.GetComponentInParent <ShopUI>(); }
public void StartStory() { if (StoryList.Count == 0 || StoryList == null) { Debug.LogError("Can't Start Story,Don't have StoryList!"); return; } Scene scence = SceneManager.GetActiveScene(); Debug.Log("Now scence: " + scence.name); if (PlayerInfo.GetNowscene() == 0) { ShopUI.ChangeStoryState(); Character.ChangeStoryState(); } if (PlayerInfo.GetNowscene() > 0) { MapPathManager.ChangeStoryState(); } if (chatmanager == null) { GameObject newobj = new GameObject(); newobj.name = "ChatSystem"; chatmanager = newobj.AddComponent <ChatManager>(); newobj.AddComponent <AudioSource>(); } chatmanager.SetNowScene(scence.name); chatmanager.PushStoryList(StoryList); ChatEvent ct = (ChatEvent)chatmanager.GetStoryList()[0]; Loading.GetInstance().LoadingStoryScene(ct.StoryName, () => { chatmanager.LoadChatStory(ct.StoryName); }); }
void LoadComponent() { waveSpawner = this.gameObject.GetComponent <WaveSpawner>(); shopUIComponent = shopUI.GetComponent <ShopUI>(); shopUIComponent.plrdata = playerData; }