Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        reachedMaxHeight = false;
        enabled          = false;

        Debug.Log(button.Activate());
    }
Ejemplo n.º 2
0
        public override void OnEnable()
        {
            base.OnEnable();
            //var product = IAPManager.instance.GetProduct(productId);
            var resourceData = Services.ResourceService.Products.GetProduct(productId);

            Services.Inap.GetProductByResourceId(productId).Match(() => {
                //Clear();
                buyButton.Activate();
                buyButton.SetListener(() => Services.Inap.PurchaseProduct(resourceData));
                priceText.text = "0.00";

                return(F.None);
            }, product => {
                buyButton.Activate();
                buyButton.SetListener(() => Services.Inap.PurchaseProduct(resourceData));

                if (longDescriptionText != null)
                {
                    /*
                     * if(resourceData.UseCash || resourceData.UseSecurities || resourceData.UsePlayerCash) {
                     *  var value = Services.Currency.CreatePriceStringSeparated(GetSoldCurrencyValue(resourceData));
                     *  if(value.Length > 1) {
                     *      longDescriptionText.text = $"{value[0]} {value[1]}";
                     *  } else {
                     *      longDescriptionText.text = $"{value[0]}";
                     *  }
                     * } else {
                     *  longDescriptionText.text = string.Empty;
                     * }*/
                    longDescriptionText.text = string.Empty;
                }

                if (descriptionText != null)
                {
                    if (resourceData.UseCash || resourceData.UseSecurities || resourceData.UsePlayerCash)
                    {
                        var cost             = GetSoldCurrencyValue(resourceData);
                        CurrencyNumber num   = new CurrencyNumber(cost);
                        string costShortText = "$ " + BosUtils.GetCurrencyString(num, "#f0b03c", "#f9f7bc");
                        descriptionText.text = costShortText;
                    }
                    else
                    {
                        descriptionText.text = string.Empty;
                    }
                }

                priceText.text = product.metadata.localizedPriceString;
                return(F.Some(product));
            });

            AnimateIcon();
        }
        public override void OnEnable()
        {
            TryReachCashContent.SetActive(false);

            if (Services.InvestorService.TriesCount > 0)
            {
                descriptionText.text = LocalizationObj.GetString("lbl_investor_lock_2");
                raiseStatusButton.Deactivate();

                double requiredCash = Services.InvestorService.GetCompanyCashRequiredToSellInvestors();
                if (requiredCash.Approximately(0.0))
                {
                    requiredCashText.text = string.Empty;
                }
                else
                {
                    requiredCashText.text = $"{BosUtils.GetCurrencyString(new CurrencyNumber(requiredCash), "#FFE759", "#FFE759")}";
                    TryReachCashContent.SetActive(true);
                }
            }
            else
            {
                descriptionText.text = LocalizationObj.GetString("lbl_investor_locked_view");
                raiseStatusButton.Activate();
                requiredCashText.text = string.Empty;
            }

            raiseStatusButton.SetListener(() => {
                //Services.ViewService.ShowDelayed(ViewType.ProductsView, BosUISettings.Instance.ViewShowDelay);
                Services.ViewService.ShowDelayed(ViewType.ProfileView, BosUISettings.Instance.ViewShowDelay, new ViewData {
                    UserData = ProfileViewTab.StatusGoods
                });
                Services.SoundService.PlayOneShot(SoundName.click);
            });
        }
Ejemplo n.º 4
0
    void Update()
    {
        foreach (Button button in FindObjectsOfType <Button>())
        {
            button.hover = false;
        }

        RaycastHit hit;
        Ray        ray = cam.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit, Mathf.Infinity, buttonMask))
        {
            if (hit.collider != null)
            {
                Button button = hit.collider.GetComponent <Button>();

                if (button != null)
                {
                    button.hover = true;

                    if (Input.GetMouseButtonUp(0))
                    {
                        // Klickade på en knapp
                        button.Activate();

                        source.Play();
                    }
                }
            }
        }
    }
Ejemplo n.º 5
0
 public void ActivateMainButtons()
 {
     btnStart.Activate();
     btnResume.Activate();
     btnOptions.Activate();
     btnQuit.Activate();
 }
Ejemplo n.º 6
0
    private IEnumerator UseButton()
    {
        button = (Button)transform.GetComponent(buttonType);
        yield return(new WaitForSeconds(buttonDelay));

        button.Activate();
    }
Ejemplo n.º 7
0
 protected override void BeforeShow()
 {
     base.BeforeShow();
     spButton.Activate();
     mpButton.Activate();
     backButton.Activate();
 }
Ejemplo n.º 8
0
    // Update is called once per frame
    void Update()
    {
        if (!isOurTurn)
        {
            return;
        }

        if (Input.GetButtonDown("Fire1"))
        {
            Debug.Log("Someone pressed the fire button!");
            ray = cam.ScreenPointToRay(Input.mousePosition);

            Debug.DrawRay(ray.origin, ray.direction * 100f, Color.red, 3f);

            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                if (hit.transform.tag.Equals("Button"))
                {
                    Button button = hit.transform.GetComponent <Button>();
                    Debug.Log("<color=green>We hit an object!</color> " + hit.transform.gameObject.name);
                    button.Activate();
                }
            }
        }
    }
        public SearchBar(PresentSearch <T> presentSearch, Search <T> search)
        {
            present_search = presentSearch;
            Search         = search;

            search_entry = new SearchEntry()
            {
                WidthRequest = 150,
                Visible      = true,
                EmptyMessage = "Type your query"
            };

            search_entry.Activated += (o, a) => { search_button.Activate(); };

            if ((this.GetType() == typeof(SearchBar <Location>)) ||
                (this.GetType() == typeof(SearchBar <Event>) && Search is EventsByLocationSearch))
            {
                LocationProviderManager.Register(this);
            }

            PackStart(search_entry, true, true, 2);

            search_button          = new Hyena.Widgets.ImageButton(Catalog.GetString("_Search"), Stock.Find);
            search_button.Clicked += (o, a) => PerformSearch();

            PackEnd(search_button, false, false, 2);
        }
Ejemplo n.º 10
0
 protected override void BeforeShow()
 {
     base.BeforeShow();
     playButton.Activate();
     rankButton.Activate();
     profileButton.Activate();
     helpButton.Activate();
 }
Ejemplo n.º 11
0
        protected override void OnEnable()
        {
            base.OnEnable();

            Button?.Activate();
            Reset();

            Singleton <InfoManager> .instance.SetCurrentMode(InfoManager.InfoMode.None, InfoManager.SubInfoMode.Default);
        }
Ejemplo n.º 12
0
        public override void Activate()
        {
            base.Activate();

            newGameBTN.Activate();
            modulesBTN.Activate();
            settingsBTN.Activate();
            creditsBTN.Activate();
            exitBTN.Activate();
            exitBTN.ButtonPressed += Exit_ButtonPressed;
        }
Ejemplo n.º 13
0
 protected override void BeforeShow()
 {
     base.BeforeShow();
     easyButton.Activate();
     normalButton.Activate();
     hardButton.Activate();
     backButton.Activate();
     loading.Start();
     state = SceneState.Processing;
     task  = new GenerateSingleGameLogicTask(OnTaskFinished);
     task.Execute();
 }
Ejemplo n.º 14
0
        protected override void OnEnable()
        {
            Logger.LogDebug($"{nameof(NodeMarkupTool)}.{nameof(OnEnable)}");
            Button?.Activate();
            Reset();

            PrevTool = m_toolController.CurrentTool;

            base.OnEnable();

            Singleton <InfoManager> .instance.SetCurrentMode(InfoManager.InfoMode.None, InfoManager.SubInfoMode.Default);
        }
Ejemplo n.º 15
0
        private void UpdateReadytOpenPlanetView()
        {
            actionButton.Activate();
            actionButton.interactable = true;
            SetButtonGrayed(false);

            actionButtonName.Activate();
            actionButtonName.text = Services.ResourceService.Localization.GetString("btn_launch");

            progressParent.Deactivate();
            priceParent.Deactivate();
            buttonRocketImage.Activate();
            moduleCollection.Deactivate();
            //buttonRocketImage.overrideSprite = context.EndOpenedSprite;

            actionButton.SetListener(() => {
                Services.GetService <IPlanetService>().SetOpened(planetId);
                actionButton.GetComponent <Animator>()?.SetTrigger("click");
                Services.ViewService.Remove(ViewType.PlanetsView);
                GameEvents.OnTutorialEvent(new TutorialEventData(TutorialEventName.OpenPlanetClicked, Planet.Id));
            });
        }
Ejemplo n.º 16
0
        private void UpdatePromoButton()
        {
            IPromoService promoService = Services.GetService <IPromoService>();

            //promoButton.interactable = promoService.IsAllowPromo();
            if (promoService.IsAllowPromo())
            {
                promoButton.Activate();
            }
            else
            {
                promoButton.Deactivate();
            }
        }
Ejemplo n.º 17
0
 public void CheckButtonSelected(Button button)
 {
     if (queueButtons.Any() && button == queueButtons.Peek())
     {
         queueButtons.Dequeue();
         button.Activate();
         SequenceChanged?.Invoke(queueButtons.Count);
     }
     else
     {
         Debug.Log("Game was stopped by losing");
         QueueReady?.Invoke(false);
         LoseLevel?.Invoke();
     }
 }
Ejemplo n.º 18
0
        private void BuildSearchEntry()
        {
            var entry = search_entry = new Banshee.Widgets.SearchEntry()
            {
                WidthRequest = 150,
                Visible      = true,
                EmptyMessage = String.Format(Catalog.GetString("Optional Query"))
            };

            source.Properties.Set <Banshee.Widgets.SearchEntry> ("Nereid.SearchEntry", entry);

            entry.Activated += (o, a) => { search_button.Activate(); };

            // Add 'filter' items
            var filter_fields = new List <IA.Field> ();
            int i             = 0;

            foreach (var field in IA.Field.Fields.Where(f => (f != IA.Field.Collection && f != IA.Field.Identifier)))
            {
                filter_fields.Add(field);
                entry.AddFilterOption(i++, field.Name);
            }

            // Add the Help item
            entry.Menu.Append(new SeparatorMenuItem());
            var help_item = new ImageMenuItem(Catalog.GetString("_Help"))
            {
                Image = new Image("gtk-help", IconSize.Menu)
            };

            help_item.Activated += delegate { Banshee.Web.Browser.Open("http://www.archive.org/advancedsearch.php"); };
            entry.Menu.Append(help_item);
            entry.Menu.ShowAll();

            entry.FilterChanged += (o, a) => {
                // Only prepend the filter: part if the query doesn't already end in a :
                string prev_query = entry.Query.EndsWith(":") ? null : entry.Query;
                entry.Query = String.Format("{0}:{1}", filter_fields[entry.ActiveFilterID].Id, prev_query);

                var editable = entry as IEditable;
                if (editable != null)
                {
                    editable.Position = entry.Query.Length;
                }
            };

            PackStart(entry, true, true, 0);
        }
Ejemplo n.º 19
0
    // Update is called once per frame
    void Update()
    {
        /*
         * if (gameObject.transform.position.y >= 0.43f) {
         *      MaxHeight = true;
         * }
         * if ((button.Activate () == 2) && (!MaxHeight)) {
         *      Debug.Log (button.Activate ());
         *      transform.Translate (0f, 0.005f, 0f);
         * }
         * if (MaxHeight && gameObject.transform.position.y >= 0.035) {
         *      transform.Translate (0f, -0.01f, 0f);
         * }
         */
        if (enabled == false)
        {
            if (button.Activate() == 2)
            {
                enabled = true;
            }
        }

        if (enabled == true)
        {
            if (reachedMaxHeight == false)
            {
                // going up
                transform.Translate(0f, 0.005f, 0f);
            }
            else
            {
                // going down
                transform.Translate(0f, -0.01f, 0f);
            }
        }

        if (gameObject.transform.position.y >= 0.45f)
        {
            reachedMaxHeight = true;
        }

        if (gameObject.transform.position.y <= 0.01f)
        {
            reachedMaxHeight = false;
            enabled          = false;
        }
    }
Ejemplo n.º 20
0
    /// <summary>
    /// Shoot bullet
    /// </summary>
    private void Shoot()
    {
        // What did the raycast hit
        RaycastHit hit;

        // Take one ammo from the current ammo
        ammoScript.currentAmmo--;

        // If the raycast did hit something
        if (Physics.Raycast(camera.transform.position, camera.transform.forward, out hit, distance))
        {
            // Play impact particles
            Instantiate(impact, hit.point, Quaternion.LookRotation(hit.normal));

            // If the raycast hit an enemy
            if (hit.transform.tag == "Enemy")
            {
                // Get the objects ragdoll script
                Ragdoll r = hit.collider.gameObject.GetComponentInParent <Ragdoll>();

                // Turn it on
                if (r != null && !r.RagdollOn)
                {
                    r.RagdollOn = true;
                    botsKilled += 1;
                }
            }

            // If the raycast hit the button
            if (hit.transform.tag == "Button")
            {
                // Get the objects button script
                Button b = hit.collider.gameObject.GetComponentInParent <Button>();

                // Activate the platform
                if (b != null)
                {
                    b.Activate();
                }
            }
        }

        // Play the muzzle flash particles
        muzzleFlash.Play();
    }
Ejemplo n.º 21
0
 private void DefaultLeftRightManagerButtonBehaviour(int managerId)
 {
     if (HasRightManager(managerId))
     {
         rightManagerButton.Activate();
     }
     else
     {
         rightManagerButton.Deactivate();
     }
     if (HasLeftManager(managerId))
     {
         leftManagerButton.Activate();
     }
     else
     {
         leftManagerButton.Deactivate();
     }
 }
Ejemplo n.º 22
0
        private static Button Button(IWidget parent, string text, IntPtr path)
        {
            var isActivated = !(text == "резерв" || text == "");

            var contour = new VGPath(path, new VGSolidColor(new Color(0x00AEEFFF)), mClassicActiveVGPaintDefault)
            {
                StrokeWidth = 3.0f
            };

            var rv = new Button(parent, contour, new VGPath(path, null, new VGSolidColor(new Color((uint)(isActivated ? 0x3B3C3DFF : 0x3B3C3D6F)))));

            rv.Activate(isActivated);

            const int   kFontSize = 25;
            const float kBias     = 1.0f;

            SetText(rv, text, kFontSize, kBias);

            return(rv);
        }
Ejemplo n.º 23
0
        public void Setup(ProductData productData)
        {
            this.Data = productData;
            this.cachedProductData = productData;
            IResourceService        resourceService = Services.ResourceService;
            ILocalizationRepository localization    = resourceService.Localization;

            nameText.text   = localization.GetString(productData.name_id);
            pointsText.text = "profile_status".GetLocalizedString();

            var points = BosUtils.GetCurrencyStringSimple(new CurrencyNumber(productData.status_points));

            pointsCountText.text = $"+{points}";

            if (Services.PlayerService.IsProductPurchased(productData.id))
            {
                checkObject.Activate();
                buyButton.Deactivate();
            }
            else
            {
                checkObject.Deactivate();
                buyButton.Activate();
                var price = productData.price; //Services.GenerationService.CalculateProfit20Minute(productData.transport_Id, productData.transport_count, productData.planet_Id);
                priceText.text = BosUtils.GetCurrencyStringSimple(Bos.Data.Currency.CreatePlayerCash(price));
            }

            buyButton.SetListener(() => {
                if (Services.PlayerService.PurchaseProduct(productData) == TransactionState.Success)
                {
                    Services.GetService <ISoundService>().PlayOneShot(SoundName.buyUpgrade);
                    //playe buy effect
                    CreateParticles();
                    ScaleEffect();
                }
            });

            updateTimer.Setup(0.3f, (deltaTime) => {
                UpdateButtonState(productData);
            }, invokeImmediatly: true);
        }
Ejemplo n.º 24
0
        public override void Activate()
        {
            base.Activate();

            chk1024x786.Activate();
            chk1024x786.CheckedEvent += Chk1024x786_CheckedEvent;
            chk1280x720.Activate();
            chk1280x720.CheckedEvent += Chk1280x720_CheckedEvent;
            chk1920x1080.Activate();
            chk1920x1080.CheckedEvent += Chk1920x1080_CheckedEvent;
            chk1920x1200.Activate();
            chk1920x1200.CheckedEvent += Chk1920x1200_CheckedEvent;

            audio.Activate();
            sound.Activate();

            accept.Activate();
            accept.ButtonPressed += Accept_ButtonPressed;

            back.Activate();
        }
Ejemplo n.º 25
0
 private void SetupWithPlanet(PlanetInfo planet)
 {
     titleText.text = string.Format(LocalizationObj.GetString("fmt_fly2"), LocalizationObj.GetString(planet.LocalData.name));
     UpdateTimerText(planet);
     adButton.Activate();
     adButton.SetListener(() => {
         Services.AdService.WatchAd("SpeedUpPlanet", () => {
             planet.ApplySpeedMult();
         });
         Sounds.PlayOneShot(SoundName.click);
     });
     planetIds.ForEach(pi => {
         if (pi.planetId == planet.Id)
         {
             pi.icon.Activate();
         }
         else
         {
             pi.icon.Deactivate();
         }
     });
 }
Ejemplo n.º 26
0
 void Update()
 {
     if (touchID != -1)
     {
         if (Input.GetTouch(touchID).phase == TouchPhase.Ended)
         {
             if (Physics.Raycast(mainCamera.ScreenPointToRay(Input.GetTouch(touchID).position), out rayInfo, maxButtonDistance, buttonLayer))
             {
                 if (rayInfo.collider == activeButton.collider)
                 {
                     Manager.SendMessage(activeButton.activeFunction, activeButton.functionParameter);
                 }
             }
             activeButton.Activate(false);
             activeButton = null;
             touchID = -1;
         }
     }
     else
     {
         for (int i = 0; i < Input.touchCount; i++)
         {
             if (Input.GetTouch(i).phase == TouchPhase.Began)
             {
                 if (Physics.Raycast(mainCamera.ScreenPointToRay(Input.GetTouch(i).position), out rayInfo, maxButtonDistance, buttonLayer))
                 {
                     if (rayInfo.collider.GetComponent<Button>().state == Button.States.Normal)
                     {
                         touchID = Input.GetTouch(i).fingerId;
                         activeButton = rayInfo.collider.GetComponent<Button>();
                         activeButton.Activate(true);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 27
0
        public static Button DownButton(IWidget parent, string text, int x, int y, ColorStyle style = ColorStyle.Default)
        {
            InitDown();

            const int   kFontSize = 25;
            const float kBias     = 1.0f;

            var contour = new VGPath(mDownOutline, new VGSolidColor(new Color(0x00AEEFFF)), mClassicActiveVGPaintDefault)
            {
                StrokeWidth = 3.0f
            };
            var rv = new Button(parent, contour, new VGPath(mDownOutline, null, new VGSolidColor(new Color(0x3B3C3DFF))));

            if (text == "резерв")
            {
                rv.Activate(false);
            }

            SetText(rv, text, kFontSize, kBias);

            rv.Move(x, y);

            return(rv);
        }
Ejemplo n.º 28
0
 public override void Activate()
 {
     base.Activate();
     back.Activate();
 }
Ejemplo n.º 29
0
        private void Setup()
        {
            if (moduleService == null)
            {
                moduleService = Services.GetService <IShipModuleService>();
            }
            if (module == null)
            {
                module = moduleService.GetModule(moduleId);
            }

            if (moduleNameData == null)
            {
                moduleNameData = Services.ResourceService.ModuleNameRepository.GetModuleNameData(moduleId);
            }

            nameText.text            = Services.ResourceService.Localization.GetString(moduleNameData.name);
            iconImage.overrideSprite = Services.ResourceService.GetSpriteByKey(moduleNameData.icon);

            currencyIconImage.overrideSprite = Services.ResourceService.GetCurrencySprite(module.Data.Currency);
            currencyText.text = BosUtils.GetCurrencyString(module.Data.Currency);

            ModuleTransactionState status;
            bool isAllowedToBuy = moduleService.IsAllowBuyModule(moduleId, out status);

            if (isAllowedToBuy)
            {
                requirementText.text   = string.Empty;
                buyButton.interactable = true;
            }
            else
            {
                switch (status)
                {
                case ModuleTransactionState.NotEnoughCurrency: {
                    requirementText.text   = string.Empty;
                    currencyText.text      = BosUtils.GetCurrencyString(module.Data.Currency, "#FF0000");
                    buyButton.interactable = false;
                }
                break;

                case ModuleTransactionState.NotValidState: {
                    var planetData = Services.ResourceService.Planets.GetPlanet(module.Data.PlanetId);
                    if (planetData == null)
                    {
                        Debug.LogError($"not found planet for upgrade level => {module.Data.PlanetId}");
                        return;
                    }
                    PlanetNameData planetNameData = Services.ResourceService.PlanetNameRepository.GetPlanetNameData(planetData.Id);
                    requirementText.text = string.Format(Services.ResourceService.Localization.GetString("fmt_module_requirement"),
                                                         Services.ResourceService.Localization.GetString(planetNameData.name));
                    buyButton.interactable = false;
                    buyText.color          = Color.grey;
                }
                break;
                }
            }

            buyButton.SetListener(() => {
                var buyStatus = moduleService.BuyModule(moduleId);
                if (buyStatus == ModuleTransactionState.Success)
                {
                    Services.GetService <ISoundService>().PlayOneShot(SoundName.Poof);
                    buyParticles?.Play();
                }
                else
                {
                    Services.GetService <ISoundService>().PlayOneShot(SoundName.click);
                }
            });

            switch (module.State)
            {
            case ShipModuleState.Opened: {
                checkObject.Activate();
                buyButton.Deactivate();
                requirementText.text = string.Empty;
            }
            break;

            default: {
                checkObject.Deactivate();
                buyButton.Activate();
            }
            break;
            }
        }
Ejemplo n.º 30
0
        public void Setup(ShipModuleInfo module)
        {
            this.module = module;
            ModuleNameData moduleNameData = Services.ResourceService.ModuleNameRepository.GetModuleNameData(module.Id);

            moduleNameText.text = Services.ResourceService.Localization.GetString(moduleNameData.name);
            switch (module.State)
            {
            case ShipModuleState.Opened: {
                currencyIconImage.Deactivate();
                currencyText.Deactivate();
                planetImage.Deactivate();
                buyButton.Deactivate();
            }
            break;

            case ShipModuleState.Available: {
                currencyIconImage.Activate();
                currencyText.Activate();
                planetImage.Deactivate();
                buyButton.Activate();
            }
            break;

            case ShipModuleState.Locked: {
                currencyIconImage.Activate();
                currencyText.Activate();
                planetImage.Activate();
                buyButton.Activate();
            }
            break;
            }
            currencyIconImage.overrideSprite = Services.ResourceService.GetCurrencySprite(module.CurrencyType);
            currencyText.text = BosUtils.GetCurrencyString(Currency.Create(module.CurrencyType, module.Price));

            PlanetNameData planetNameData = Services.ResourceService.PlanetNameRepository.GetPlanetNameData(module.Data.PlanetId);

            if (planetNameData != null)
            {
                planetImage.overrideSprite = Services.ResourceService.GetSpriteByKey(planetNameData.icon);
            }
            else
            {
                planetImage.overrideSprite = Services.ResourceService.Sprites.FallbackSprite;
            }

            buyButton.SetListener(() => {
                var status = Services.GetService <IShipModuleService>().BuyModule(module.Id);
                switch (status)
                {
                case ModuleTransactionState.Success: {
                    Services.SoundService.PlayOneShot(SoundName.buyUpgrade);
                    Setup(module);
                }
                break;

                case ModuleTransactionState.NotEnoughCurrency:
                    {
                        if (module.CurrencyType == CurrencyType.Coins)
                        {
                            Services.ViewService.Show(ViewType.CoinRequiredView, new ViewData {
                                UserData = (int)module.Price
                            });
                        }
                    }
                    break;
                }
            });

            IShipModuleService moduleService = Services.GetService <IShipModuleService>();

            updateTimer.Setup(0.5f, (deltaTime) => {
                ModuleTransactionState moduleTransactionState;
                if (moduleService.IsAllowBuyModule(module.Id, out moduleTransactionState))
                {
                    buyButton.interactable = true;
                }
                else if (moduleTransactionState == ModuleTransactionState.NotEnoughCurrency && module.CurrencyType == CurrencyType.Coins)
                {
                    buyButton.interactable = true;
                }
                else
                {
                    buyButton.interactable = false;
                }
            }, true);

            MoveObject(module);
        }