private void UpdateExpedition()
        {
            title.text       = expedition.name;
            description.text = expedition.description;
            vehicleAvatar.SetVehicle(vehicleService.Vehicle(expedition.vehicleId));
            hero1.SetHero(heroService.Hero(expedition.hero1Id));
            hero2.SetHero(heroService.Hero(expedition.hero2Id));
            hero3.SetHero(heroService.Hero(expedition.hero3Id));
            hero4.SetHero(heroService.Hero(expedition.hero4Id));

            lootItems.ForEach(item => Destroy(item.gameObject));
            lootItems.Clear();
            if (expedition.lootedItems?.IsEmpty() == false)
            {
                lootContainer.gameObject.SetActive(true);
                actionButton.gameObject.SetActive(false);
                expedition.lootedItems.ForEach(item =>
                {
                    if (item.type == LootedItemType.GEAR)
                    {
                        var gear = gearService.Gear(item.value);
                        gear.markedToBreakdown = forgeService.IsAutoBreakdown(gear);
                    }
                    var prefab = Instantiate(lootItemPrefab, lootContainer);
                    prefab.SetItem(item, lootContainer.rect.height);
                    lootItems.Add(prefab);
                });
            }
            else
            {
                lootContainer.gameObject.SetActive(false);
            }
        }
示例#2
0
        public void SetBattle(OfflineBattle offlineBattle, int battleNumber)
        {
            var colorConfigs = configs.Get <ColorsConfig>();

            battle     = offlineBattle;
            title.text = $"{battleNumber}. Battle";

            progress.gameObject.SetActive(!battle.cancelled && battle.battleStarted && !battle.battleFinished);
            rewardsCanvas.gameObject.SetActive(battle.battleSuccess && battle.lootedItems?.IsEmpty() == false);
            if (battle.cancelled)
            {
                resultText.text  = "aborted";
                resultText.color = colorConfigs.missionIdle;
                resultText.gameObject.SetActive(true);
            }
            else if (battle.battleFinished)
            {
                if (battle.battleSuccess)
                {
                    if (battle.lootedItems?.IsEmpty() == false)
                    {
                        resultText.gameObject.SetActive(false);
                        lootItems.ForEach(lootItem => Destroy(lootItem.gameObject));
                        lootItems.Clear();
                        battle.lootedItems.ForEach(item =>
                        {
                            if (item.type == LootedItemType.GEAR)
                            {
                                var gear = gearService.Gear(item.value);
                                gear.markedToBreakdown = forgeService.IsAutoBreakdown(gear);
                            }
                            var prefab = Instantiate(lootItemPrefab, rewardsCanvas);
                            prefab.SetItem(item, rewardsCanvas.rect.height);
                            lootItems.Add(prefab);
                        });
                    }
                    else
                    {
                        resultText.text  = "success";
                        resultText.color = colorConfigs.missionSuccess;
                        resultText.gameObject.SetActive(true);
                    }
                }
                else
                {
                    resultText.text  = "failed";
                    resultText.color = colorConfigs.missionFailed;
                    resultText.gameObject.SetActive(true);
                }
            }
            else if (battle.battleStarted)
            {
                resultText.gameObject.SetActive(false);
            }
            else
            {
                resultText.text  = "starts soon";
                resultText.color = colorConfigs.missionIdle;
                resultText.gameObject.SetActive(true);
            }
        }
示例#3
0
        public void SetLooted(Looted lootedObj)
        {
            looted = lootedObj;
            switch (looted.type)
            {
            case LootedType.CHEST:
                title.text = "Chest opened";
                break;

            case LootedType.BATTLE:
                title.text = "Battle rewards";
                break;

            case LootedType.BREAKDOWN:
                title.text = "Remnants collected";
                break;

            case LootedType.STORY:
                title.text = "Docs gift";
                break;

            case LootedType.LEVEL_UP:
                title.text = $"Rewards for reaching level {progressService.Progress.level}";
                break;

            case LootedType.VIP_LEVEL_UP:
                title.text = $"Rewards for reaching vip level {progressService.Progress.level}";
                break;

            case LootedType.MERCHANT:
            case LootedType.BLACK_MARKET:
                title.text = "You bought";
                break;

            case LootedType.UPGRADE:
                title.text = "Upgrade finished";
                break;

            case LootedType.ODD_JOB:
                title.text = "Odd job rewards";
                break;

            case LootedType.DAILY_ACTIVITY:
                title.text = "Daily activity reward";
                break;

            case LootedType.TASK:
                title.text = "Task rewards";
                break;
            }

            lootContainer.gameObject.SetActive(true);
            actionButton.gameObject.SetActive(false);
            looted.items.ForEach(item =>
            {
                if (item.type == LootedItemType.GEAR)
                {
                    var gear = gearService.Gear(item.value);
                    gear.markedToBreakdown = forgeService.IsAutoBreakdown(gear);
                }
                var prefab = Instantiate(lootItemPrefab, lootContainer);
                prefab.SetItem(item, lootContainer.rect.height);
            });
        }