public void BuyBoosters() { if (isActive) { libraryMenu.windowWarning.Show(TextStrings.GetString("booster_is_active")); } else { if (Bank.GetFreeBooster(boosterNum) > 0) { lastDateTime = System.DateTime.Now; PreferencesSaver.SetBoosterActivateTime(boosterNum, lastDateTime); Bank.MinusFreeBooster(boosterNum, 1); } else { if (BoosterValues.BoosterCost[boosterNum] > Bank.GetMoney()) { libraryMenu.windowWarning.Show(TextStrings.GetString("no_money")); } else { lastDateTime = System.DateTime.Now; PreferencesSaver.SetBoosterActivateTime(boosterNum, lastDateTime); Bank.MinusMoney(BoosterValues.BoosterCost[boosterNum]); } } } }
public void Update() { DateTime nowTime = System.DateTime.Now; subtractTime = nowTime.Subtract(lastDateTime); if (subtractTime.TotalSeconds < BoosterValues.BoosterTime[boosterNum] * 60) { UpdateTime(); string costText = TextStrings.GetString("is_activate"); if (!costText.Equals(cost.text)) { cost.text = costText; } if (!boosterImage.sprite.Equals(activeSprite)) { boosterImage.sprite = activeSprite; rawButton.DisableButton(); steel.sprite = activeSteel; } isActive = true; } else { string timeText = BoosterValues.BoosterTime[boosterNum] + " " + TextStrings.GetString("minutes"); if (!time.text.Equals(timeText)) { time.text = timeText; } if (Bank.GetFreeBooster(boosterNum) > 0) { string textCost = TextStrings.GetString("free"); if (!cost.text.Equals(textCost)) { cost.text = textCost; } } else { string textCost = "^ " + BoosterValues.BoosterCost[boosterNum]; if (!cost.text.Equals(textCost)) { cost.text = textCost; } } if (!boosterImage.sprite.Equals(unActiveSprite)) { boosterImage.sprite = unActiveSprite; rawButton.EnableButton(); steel.sprite = unActiveSteel; } } }
protected override void OnClick() { CarParametres carParametres = libraryMenu.carChanger.GetCurrentCarParametres(); if (carParametres.GetCost() > Bank.GetMoney()) { libraryMenu.windowWarning.Show(TextStrings.GetString("no_money") + " " + carParametres.GetName()); } else { Button buttonOk = libraryMenu.windowConfirmation.button1; buttonOk.onClick.AddListener( delegate { libraryMenu.windowConfirmation.Hide(); Bank.MinusMoney(carParametres.GetCost()); PreferencesSaver.OpenCar(carParametres.GetNumCar()); libraryMenu.carChanger.ShowCar(); } ); libraryMenu.windowConfirmation.Show("Вы уверены, что хотите купить " + carParametres.GetName() + " за " + carParametres.GetCost() + "%"); } }
// Use this for initialization void Start() { libraryMenu = GameObject.FindObjectOfType <LibraryMenu>(); type = int.Parse(transform.parent.name); // for(int i = 0; i < 6; i++) // mainSprites[i] = Resources.Load<Sprite>("Images/GUI/Menu/car_powers/car_pow_"+(i+1)); // for (int i = 0; i < 4; i++) // secondSprites[i] = Resources.Load<Sprite>("Images/GUI/Menu/car_updates/car_update_" + i); button.onClick.AddListener( delegate { Button buttonOk = libraryMenu.windowConfirmation.button1; CarParametres carParametres = libraryMenu.carChanger.GetCurrentCarParametres(); string tempStr = ""; switch (type) { case 1: tempStr = TextStrings.GetString("2"); break; case 2: tempStr = TextStrings.GetString("3"); break; case 3: tempStr = TextStrings.GetString("4"); break; } int upgradeCost = carParametres.GetUpgradeCost(valSecond + 1); buttonOk.onClick.AddListener( delegate { libraryMenu.windowConfirmation.Hide(); if (upgradeCost < Bank.GetMoney()) { Bank.MinusMoney(upgradeCost); AddPower(); } else { libraryMenu.windowWarning.Show(TextStrings.GetString("1") + " " + tempStr); } } ); libraryMenu.windowConfirmation.Show(TextStrings.GetString("5") + " " + tempStr + " " + TextStrings.GetString("6") + " ^" + upgradeCost + ". " + TextStrings.GetString("7") + "?"); } ); }
void SetDescription(int val1) { int padej = Padej.GetPadej(val1); switch (gift.type) { case Gift.GiftType.Money: description.text = "+" + val1 + " " + TextStrings.GetString("valuta"); break; case Gift.GiftType.Booster1: description.text = "+" + val1 + " " + TextStrings.GetString("tuning_set_" + padej); break; case Gift.GiftType.Booster2: description.text = "+" + val1 + " " + TextStrings.GetString("full_tank_" + padej); break; case Gift.GiftType.Booster3: description.text = "+" + val1 + " " + TextStrings.GetString("additional_rates_" + padej); break; case Gift.GiftType.Bonus: description.text = "+" + val1 + " " + TextStrings.GetString("bonus_" + padej); break; } }
// Use this for initialization public void Start() { libraryMenu = GameObject.FindObjectOfType <LibraryMenu>(); lastDateTime = PreferencesSaver.GetBoosterActivateTime(boosterNum); description.text = TextStrings.GetString("booster_" + boosterNum + "_description"); }
void SetNumDay(int numDay) { this.numDay.text = numDay + " " + TextStrings.GetString("day"); }
void SetDescription() { description.text = TextStrings.GetString("secret_box"); }
protected void MyActionComplete() { string str = TextStrings.GetString("done") + ": " + Description(); library.taskHelper.ShowWinTask(str); }