コード例 #1
0
        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 SetItem(LootedItem item, float?adjustToHeight = null)
        {
            switch (item.type)
            {
            case LootedItemType.RESOURCE:
                SetResource(item.resourceType, item.value, adjustToHeight);
                break;

            case LootedItemType.PROGRESS:
                SetProgress(item.progressStat, item.value, adjustToHeight);
                break;

            case LootedItemType.JEWEL:
                SetJewel(item.jewelType, Convert.ToInt32(item.value), adjustToHeight);
                break;

            case LootedItemType.HERO:
                SetHero(heroService.Hero(item.value), adjustToHeight);
                break;

            case LootedItemType.GEAR:
                SetGear(gearService.Gear(item.value), adjustToHeight);
                break;

            case LootedItemType.VEHICLE:
                SetVehicle(vehicleService.Vehicle(item.value), adjustToHeight);
                break;

            case LootedItemType.VEHICLE_PART:
                SetVehiclePart(vehicleService.VehiclePart(item.value), adjustToHeight);
                break;
            }
        }
コード例 #3
0
        private void UpdateMission()
        {
            title.text = $"{mapService.GetMapName(mission.mapId)} {mission.posX}x{mission.posY}";
            vehicleAvatar.SetVehicle(vehicleService.Vehicle(mission.vehicleId));
            hero1.SetHero(heroService.Hero(mission.hero1Id));
            hero2.SetHero(heroService.Hero(mission.hero2Id));
            hero3.SetHero(heroService.Hero(mission.hero3Id));
            hero4.SetHero(heroService.Hero(mission.hero4Id));

            var battleNumber = 1;

            mission.battles.ForEach(battle =>
            {
                var battleView = battleViews.ContainsKey(battle.battleId) ? battleViews[battle.battleId] : null;
                if (battleView == null)
                {
                    battleView = Instantiate(missionBattlePrefab, battlesCanvas);
                    battleViews[battle.battleId] = battleView;
                }
                battleView.SetBattle(battle, battleNumber);
                battleNumber++;
            });
        }