Ejemplo n.º 1
0
    public void Init(BusterType in_type)
    {
        type = in_type;

        switch (in_type)
        {
        case BusterType.FLY:
            buster_name.text = TextManager.getText("booster_supercat_name");
            icon.sprite      = Resources.Load <Sprite>("Icon_booster_speed_up_01");
            counter          = FlyBuster.set_time_by_lvl(
                DataController.instance.buster_entity.getLevel(BusterType.FLY));
            counter_text.text = Helper.TextHelper.TimeFormatMinutes(counter);
            delta             = pb.GetComponent <RectTransform>().sizeDelta.x / counter;
            StartCoroutine(FlyUpdate());
            break;

        case BusterType.REBORN:
            buster_name.text = TextManager.getText("booster_reborn_name");
            icon.sprite      = Resources.Load <Sprite>("Icon_booster_heart_01");
            counter          = RebornBuster.set_cnt_by_lvl(
                DataController.instance.buster_entity.getLevel(BusterType.REBORN));
            counter_text.text = counter.ToString();
            delta             = pb.GetComponent <RectTransform>().sizeDelta.x / counter;
            break;

        case BusterType.MAGNIT:
            buster_name.text = TextManager.getText("booster_magnet_name");
            icon.sprite      = Resources.Load <Sprite>("Icon_booster_magnet_01");
            counter          = MagnitBuster.set_time_by_lvl(
                DataController.instance.buster_entity.getLevel(BusterType.MAGNIT));
            counter_text.text = Helper.TextHelper.TimeFormatMinutes(counter);
            delta             = pb.GetComponent <RectTransform>().sizeDelta.x / counter;
            StartCoroutine(MagnetUpdate());
            break;
        }

        float y = pb.GetComponent <RectTransform>().sizeDelta.y;

        pb.GetComponent <RectTransform>().sizeDelta =
            new Vector2(0, y);
    }
Ejemplo n.º 2
0
    void init_reborn(int l)
    {
        var price = DataController.instance.buster_entity.GetPrice(BusterType.REBORN);

        reborn_img.sprite    = Resources.Load <Sprite>(reborn_img.sprite.name.Replace("02", "01"));
        reborn_lvl_text.text = l.ToString();
        reborn_btn.GetComponent <Image>().color = new Color(0, 255, 0);
        reborn_btn.GetComponent <Button>().onClick.SetPersistentListenerState(0, UnityEngine.Events.UnityEventCallState.Off);
        reborn_btn.GetComponent <Button>().onClick.AddListener(() =>
        {
            OpenUpgradePanel(reborn_img.sprite.name, l + 1,
                             TextManager.getText("booster_reborn_name"),
                             TextManager.getText("booster_reborn_description"),
                             TextManager.getText("booster_reborn_upgrate_description").Replace("%N%",
                                                                                               RebornBuster.set_cnt_by_lvl(l).ToString()),
                             TextManager.getText("booster_reborn_upgrate_description").Replace("%N%",
                                                                                               RebornBuster.set_cnt_by_lvl(l + 1).ToString()),
                             price,
                             () =>
            {
                Message msg   = new Message();
                msg.Type      = MainScene.MainMenuMessageType.BUY_BUSTER_UPGRATE;
                var p         = new BuyBusterParametr();
                p.price       = price;
                p.type        = BusterType.REBORN;
                msg.parametrs = p;

                MessageBus.Instance.SendMessage(msg);

                CloseUpgratePanel();
            });
        });
    }