Exemplo n.º 1
0
        protected override void Start()
        {
            base.Start();

            bannerTitle.text      = Game.instance.text.GetText("fusion_title");
            resultTitle.text      = Game.instance.text.GetText("fusion_most_likely");
            bestResultTitle.text  = Game.instance.text.GetText("fusion_best_value");
            successRateTitle.text = Game.instance.text.GetText("fusion_success_rate");

            startButton.gameObject.SetActive(mode == Mode.Setup);
            startButton.title = Game.instance.text.GetText("call_to_action_fuse");
            startButton.onClick.AddListener(StartFusion);

            exitButton.onClick.AddListener(OnCancelExit);
            clickCatcher.onClick.AddListener(OnCancelExit);
            clearButton.onClick.AddListener(GiveBackItems);
            shareButton.onClick.AddListener(OnShare);
            mythicButton.onToggled += OnMythic;
            upgradeButton.onClick.AddListener(OnUpgrade);
            speedUpAnimClickCatcher.onClick.AddListener(OnSpeedUpAnims);

            continueButton.onClick.AddListener(OnAcknowledgeResult);
            continueButton.text = Game.instance.text.GetText("continue");

            Module module = Game.instance.user.Modules.FirstOrDefault(x => x.Data.fusionMax > 0);

            if (module != null)
            {
                string imgName    = module.GetAssetName();
                int    assetLevel = Convert.ToInt32(Module.GetAssetLevel(module.Level) - 1);

                ImageLoader stationImg = fusionStationImages[assetLevel];
                stationImg.gameObject.SetActive(true);
                stationImg.LoadAsync(imgName);

                SpriteRendererLoader stationTopImg = fusionStationTopImages[assetLevel];
                stationTopImg.gameObject.SetActive(true);
                stationTopImg.LoadAsync(string.Format("{0}_part01", imgName));
            }

            InitIngredients();

            UpdateUI();

            if (slot.Type.value != null)
            {
                machine.TransitionTo(new FusionEndPhase1(this));

                fusedItemControl = Control.Clone(itemPrefab, true);
                fusedItemControl.SetParent(fusedItemContent);
                fusedItemControl.hasEffects = false;
                fusedItemControl.size       = ItemControl.Size.Large;
                fusedMythic.gameObject.SetActive(true);
            }

            Game.instance.playerHud.shortMenu++;
            Game.instance.playerHud.showGemsMode++;
            Game.instance.playerHud.showGoldMode++;

            Game.instance.gameScheduler.RegisterUpdate(UpdateFsm, Scheduler.Priority.Fsm);

            if (Game.instance.settingsManager.gameOptionToggles[SettingsManager.GameOption.Multicraft])
            {
                foreach (FusionItemControl fi in fusionItems)
                {
                    fi.onItemSelected   += OnInventoryItemSelected;
                    fi.onItemUnselected += OnInventoryItemUnselected;
                }
            }
        }