public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            MainImageView.Image = Images.PurchaseIcon;
            MainImageView.Layer.CornerRadius  = 32f;
            MainImageView.Layer.MasksToBounds = true;

            PurchaseButton.SetBackgroundImage(Images.GreyButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);
            PurchaseButton.Layer.ShadowColor   = UIColor.Black.CGColor;
            PurchaseButton.Layer.ShadowOffset  = new CGSize(0, 1);
            PurchaseButton.Layer.ShadowOpacity = 0.3f;
            PurchaseButton.TouchUpInside      += (sender, e) => ViewModel.PurchaseCommand.ExecuteIfCan();

            CancelButton.TouchUpInside  += (sender, e) => ViewModel.DismissCommand.ExecuteIfCan();
            RestoreButton.TouchUpInside += (sender, e) => ViewModel.RestoreCommand.ExecuteIfCan();

            Observable.Merge(ViewModel.PurchaseCommand.IsExecuting, ViewModel.RestoreCommand.IsExecuting).Skip(1).Subscribe(x =>
            {
                if (x)
                {
                    _statusIndicatorService.Show("Enabling...");
                }
                else
                {
                    _statusIndicatorService.Hide();
                }
            });

            ViewModel.WhenAnyValue(x => x.Price)
            .Where(x => x != null)
            .Subscribe(x => PurchaseButton.SetTitle("Purchase! (" + x + ")", UIControlState.Normal));
        }
Exemple #2
0
 void OnGUI()
 {
     if (!PurchaseButton.Hidden)
     {
         GLCanvas.DrawBox(PurchaseButton.QuickRect(), Color.cyan, 2f);
     }
 }
Exemple #3
0
    public void Init(string itemId, string itemName, string itemDescription, double price, Vector2 basePos)
    {
        this.itemId          = itemId;
        this.itemName        = itemName;
        this.itemDescription = itemDescription;
        this.price           = price;

        baseCoords = basePos;

        ItemFrame = (GameObject)Instantiate(Resources.Load("Prefabs/" + "itemFrame"));
        ItemFrame.transform.position = baseCoords;

        ItemPreview = (GameObject)Instantiate(Resources.Load("Prefabs/" + itemId));
        //Need to change to Indexing way of positioning
        ItemPreview.transform.position = baseCoords;

        purchaseButton = (PurchaseButton)ScriptableObject.CreateInstance("PurchaseButton");
        purchaseButton.init(itemId);
        purchaseButton.InstantiateGameObject();
        //Need to change to Indexing way of positioning
        purchaseButton.SetButtonPosition(baseCoords.x + (float)2.5, baseCoords.y - (float)1.2);

        /* Text */
        TextItemName = (GameObject)Instantiate(Resources.Load("Prefabs/" + "generic_gui_text"));
        TextItemName.GetComponent <GUIText>().text      = itemName;
        TextItemName.GetComponent <GUIText>().fontSize  = 16;
        TextItemName.GetComponent <GUIText>().fontStyle = FontStyle.Bold;
        TextItemName.transform.position =
            Camera.main.WorldToViewportPoint(new Vector2(
                                                 baseCoords.x + (float)1.75, baseCoords.y + (float)1.65));

//		TextItemDescription = (GameObject)Instantiate (Resources.Load ("Prefabs/" + "generic_gui_text"));
//		TextItemDescription.guiText.text = itemDescription;
//		TextItemDescription.guiText.fontSize = 10;
//		TextItemDescription.transform.position =
//			Camera.main.WorldToViewportPoint(new Vector2(baseCoords.x + 2, baseCoords.y + (float)0.5));

//		TextPrice = (GameObject)Instantiate (Resources.Load ("Prefabs/" + "generic_gui_text"));
//		TextPrice.guiText.text = "price: $" + price.ToString ("F");
//		TextPrice.guiText.fontSize = 10;
//		TextPrice.guiText.fontStyle = FontStyle.Bold;
//		TextPrice.transform.position =
//			Camera.main.WorldToViewportPoint(new Vector2(baseCoords.x + (float)2, baseCoords.y));


        screenPointCoords = Camera.main.WorldToScreenPoint(
            new Vector2(baseCoords.x, baseCoords.y));
    }
Exemple #4
0
    public void Init(string itemId, string itemName, string itemDescription, double price, Vector2 basePos)
    {
        this.itemId = itemId;
        this.itemName = itemName;
        this.itemDescription = itemDescription;
        this.price = price;

        baseCoords = basePos;

        ItemFrame = (GameObject)Instantiate (Resources.Load ("Prefabs/" + "itemFrame"));
        ItemFrame.transform.position = baseCoords;

        ItemPreview = (GameObject)Instantiate (Resources.Load ("Prefabs/" + itemId));
        //Need to change to Indexing way of positioning
        ItemPreview.transform.position = baseCoords;

        purchaseButton = (PurchaseButton)ScriptableObject.CreateInstance ("PurchaseButton");
        purchaseButton.init (itemId);
        purchaseButton.InstantiateGameObject ();
        //Need to change to Indexing way of positioning
        purchaseButton.SetButtonPosition (baseCoords.x + (float)2.5, baseCoords.y - (float)1.2);

        /* Text */
        TextItemName = (GameObject)Instantiate (Resources.Load ("Prefabs/" + "generic_gui_text"));
        TextItemName.GetComponent<GUIText>().text = itemName;
        TextItemName.GetComponent<GUIText>().fontSize = 16;
        TextItemName.GetComponent<GUIText>().fontStyle = FontStyle.Bold;
        TextItemName.transform.position =
            Camera.main.WorldToViewportPoint(new Vector2(
                baseCoords.x + (float)1.75, baseCoords.y + (float)1.65));

        //		TextItemDescription = (GameObject)Instantiate (Resources.Load ("Prefabs/" + "generic_gui_text"));
        //		TextItemDescription.guiText.text = itemDescription;
        //		TextItemDescription.guiText.fontSize = 10;
        //		TextItemDescription.transform.position =
        //			Camera.main.WorldToViewportPoint(new Vector2(baseCoords.x + 2, baseCoords.y + (float)0.5));

        //		TextPrice = (GameObject)Instantiate (Resources.Load ("Prefabs/" + "generic_gui_text"));
        //		TextPrice.guiText.text = "price: $" + price.ToString ("F");
        //		TextPrice.guiText.fontSize = 10;
        //		TextPrice.guiText.fontStyle = FontStyle.Bold;
        //		TextPrice.transform.position =
        //			Camera.main.WorldToViewportPoint(new Vector2(baseCoords.x + (float)2, baseCoords.y));

        screenPointCoords = Camera.main.WorldToScreenPoint(
            new Vector2(baseCoords.x, baseCoords.y));
    }
Exemple #5
0
    public void AddPurchaseButton <T>(T purchaseAble) where T : Item, IPurchaseAble
    {
        GameObject     obj            = Instantiate(PurchaseButtonPrefab, Vector3.zero, Quaternion.identity);
        PurchaseButton purchaseButton = obj.GetComponent <PurchaseButton>();

        purchaseButton.GoodsPrice         = purchaseAble.PurchasePrice;
        purchaseButton.Goods              = purchaseAble;
        purchaseButton.GoodsItem          = purchaseAble;
        purchaseAble.PurchaseButtonObject = purchaseButton;
        purchaseAble.UpdatePurchaseButton();
        purchaseAble.IsPurchaseAble = false;
        purchaseButton.gameObject.SetActive(false);
        purchaseAbles.Add(purchaseAble);
        purchaseButton.GetComponent <Button>().onClick.AddListener(() => { Purchase(purchaseAble); });
        categories[purchaseAble.Category].AddPurchaseButton(purchaseButton);
        Debug.Log("PurchaseButton Added");
    }
Exemple #6
0
 public void CompletePurchase()
 {
     if (IsElementDisplayed(IAgreeButton))
     {
         IAgreeButton.Click();
     }
     PurchaseButton.Click();
     try
     {
         WebDriverWait newWait = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30));
         newWait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("div[class='jp-acct-block1']")));
     }
     catch (Exception)
     {
         if (ExpectedConditions.AlertIsPresent().Invoke(Driver.WebDriver) != null)
         {
             Driver.WebDriver.SwitchTo().Alert().Dismiss();
         }
         WebDriverWait newWait = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30));
         newWait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("div[class='jp-acct-block1']")));
     }
 }
Exemple #7
0
        /// <summary>
        /// Verifies that all buttons display the correct values.
        /// </summary>
        private void RevalidateShop()
        {
            GameObject ItemTemplate = Resources.Load(GameConstants.PREFAB_PATH_STORE_ITEM_TEMPLATE, typeof(GameObject)) as GameObject;
            GameObject ItemDisplay  = GameObject.Find(GameConstants.UI_STORE_NAME_ITEM_DISPLAY);

            FileMgr FileManager = FileMgr.GetInstance();

            foreach (Button PurchaseButton in ItemDisplay.GetComponentsInChildren <Button>())
            {
                ItemDataHolder DataHolder = PurchaseButton.GetComponent <ItemDataHolder>();
                WeaponStats    Stats      = FileManager.LoadWeaponStats(DataHolder.GUID);
                PurchaseButton.GetComponent <Button>().onClick.RemoveAllListeners();
                if ((Stats.DefaultWeapon || CurrentLevel.IsPurchased(DataHolder.GUID)))
                {
                    if (CurrentLevel.PlayerState.SelectedWeapon.WeaponGUID.Equals(Stats.WeaponGUID))
                    {
                        PurchaseButton.GetComponentInChildren <Text>().text = "Selected";
                        PurchaseButton.GetComponent <Button>().interactable = false;
                        DataHolder.Selected = true;
                    }
                    else
                    {
                        PurchaseButton.GetComponentInChildren <Text>().text = "Select Item";
                        PurchaseButton.GetComponent <Button>().interactable = true;
                        DataHolder.Selected = false;
                        PurchaseButton.GetComponent <Button>().onClick.AddListener(SelectItem);
                    }
                }
                else if (!Stats.Purchased && (CurrentLevel.CanPurchase(Stats.Price)))
                {
                    PurchaseButton.GetComponent <Button>().onClick.AddListener(Purchase);
                }
                else
                {
                    PurchaseButton.GetComponentInChildren <Text>().text = "Too Expensive";
                    PurchaseButton.GetComponent <Button>().interactable = false;
                }
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (CancelButton != null)
            {
                CancelButton.Dispose();
                CancelButton = null;
            }

            if (DescriptionLabel != null)
            {
                DescriptionLabel.Dispose();
                DescriptionLabel = null;
            }

            if (MainImageView != null)
            {
                MainImageView.Dispose();
                MainImageView = null;
            }

            if (PurchaseButton != null)
            {
                PurchaseButton.Dispose();
                PurchaseButton = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }

            if (RestoreButton != null)
            {
                RestoreButton.Dispose();
                RestoreButton = null;
            }
        }
Exemple #9
0
 void InitButtons()
 {
     LoginButton = InstantiateChild <LMS_GuiBaseButton>(new LMS_GuiConfig
     {
         Rect = new Rect(165f, 295f, 452f, 154f)
     }, 93);
     PurchaseButton = InstantiateChild <LMS_GuiBaseButton>(new LMS_GuiConfig
     {
         Rect = new Rect(363f, 125f, 402f, 374f)
     }, 93);
     LoginButton.SetTexture((int)E_Texture.IDLE, LoginButton.GeneratePlainTexture(new Color(200f / 255f, 220f / 255f, 35f / 255f, 0.3f)));
     LoginButton.SetTexture((int)E_Texture.DOWN, LoginButton.GeneratePlainTexture(new Color(200f / 255f, 220f / 255f, 35f / 255f, 1f)));
     LoginButton.AllowInput = true;
     LoginButton.Hidden     = true;
     LoginButton.OnClick   += () => { LMS_SessionServerPeer.Instance.Authenticate(UserTextField.Text, PassTextField.Text); };
     PurchaseButton.SetTexture((int)E_Texture.IDLE, PurchaseButton.GeneratePlainTexture(Color.clear));
     PurchaseButton.SetTexture((int)E_Texture.DOWN, PurchaseButton.GeneratePlainTexture(Color.blue.AlterAlpha(0.8f)));
     PurchaseButton.AllowInput = true;
     PurchaseButton.OnClick   += () => { LMS_Main.Instance.ShowPopup(0, "Would you like to join\nour discord server?", "Discord Server", Color.blue, (res, popup) => { if (res == E_PopupCallback.YES)
                                                                                                                                                                       {
                                                                                                                                                                           Application.OpenURL(LMS_Meta.getMetaValue("DISCORD_URL"));
                                                                                                                                                                       }
                                                                     }); };
 }
Exemple #10
0
        public override void Initialize()
        {
            Manager.Scene.AddEntity(new PlayerSignedOut());

            Manager.Vars["CMYK_Ammo"] = 0;
            Manager.Vars["score"]     = 0;

            MusicPlayer.Play(MusicPlayer.MenuTheme);

            Manager.Scene.AddEntity(new GreyInfectiontitleScene());

            // Opciones del menu:
            menu = new ButtonGroup();
            Manager.Scene.AddEntity(menu);
            menu.Location     = new Vector2(Manager.Graphics.ScreenSafeArea.Right - 240, 360);
            menu.ButtonHeight = 70;

            Button button;

            button                    = new Button();
            button.Caption            = Session.Strings["mainmenu_play"];
            button.ConfirmFXWaitToEnd = true;
            button.OnEnter           += OnEnterPlay;
            menu.Add(button);

            button                    = new Button();
            button.Caption            = Session.Strings["mainmenu_options"];
            button.ConfirmFXWaitToEnd = true;
            button.OnEnter           += OnEnterOptions;
            menu.Add(button);

            button                    = new Button();
            button.Caption            = Session.Strings["mainmenu_credits"];
            button.ConfirmFXWaitToEnd = true;
            button.OnEnter           += OnEnterCredits;
            menu.Add(button);

            button          = new Button();
            button.Caption  = Session.Strings["mainmenu_exit"];
            button.OnEnter += OnEnterExit;
            menu.Add(button);

            // Si es modo Trial se activa el boton de compra:
            if (Guide.IsTrialMode)
            {
                purchase = new PurchaseButton();
                Manager.Scene.AddEntity(purchase);
            }

            // Indicaciones de input:
            InputHintLabel inputHint = new InputHintLabel();

            Manager.Scene.AddEntity(inputHint);
            inputHint.Button   = InputHintLabel.GamepadButtonChar.A;
            inputHint.Caption  = Session.Strings["button_select"];
            inputHint.Location = new Vector2(475, Manager.Graphics.ScreenSafeArea.Bottom - 14);

            inputHint = new InputHintLabel();
            Manager.Scene.AddEntity(inputHint);
            inputHint.Button   = InputHintLabel.GamepadButtonChar.LeftThumb;
            inputHint.Caption  = Session.Strings["button_move"];
            inputHint.Location = new Vector2(750, Manager.Graphics.ScreenSafeArea.Bottom - 14);

            base.Initialize();
        }
Exemple #11
0
 public void AddPurchaseButton(PurchaseButton purchaseButton)
 {
     purchaseButton.gameObject.transform.SetParent(goodsList.transform, true);
     purchaseButton.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1);
 }
Exemple #12
0
 public void Purchase()
 {
     // Sleeper.Delay(500);
     PurchaseButton.Click();
     Sleeper.Delay(500);
 }
Exemple #13
0
 void PurchaseButtonSetActive(PurchaseButton _pb, bool _act)
 {
     if (_act) {
         _pb.buttonSr.color = Color.white;
     } else {
         _pb.buttonSr.color = Color.gray;
     }
     _pb.active = _act;
 }