Ejemplo n.º 1
0
        private void ProcessSkin(SmartEntity entity)
        {
            ActiveArmory  activeArmory   = (!(Service.GameStateMachine.CurrentState is HomeState)) ? null : Service.CurrentPlayer.ActiveArmory;
            CurrentBattle battle         = (activeArmory != null) ? null : Service.BattleController.GetCurrentBattle();
            SkinTypeVO    applicableSkin = this.GetApplicableSkin((TroopTypeVO)entity.TroopComp.TroopType, activeArmory, battle, entity.TeamComp.TeamType);

            if (applicableSkin != null)
            {
                entity.TroopComp.AssetName = applicableSkin.AssetName;
                entity.TroopComp.AudioVO   = applicableSkin;
                if (entity.ShooterComp != null)
                {
                    entity.ShooterComp.isSkinned = true;
                }
                if (applicableSkin.Override != null)
                {
                    entity.TroopComp.TroopShooterVO         = new SkinnedTroopShooterFacade(entity.TroopComp.TroopShooterVO, applicableSkin.Override);
                    entity.TroopComp.OriginalTroopShooterVO = new SkinnedTroopShooterFacade(entity.TroopComp.OriginalTroopShooterVO, applicableSkin.Override);
                    if (entity.ShooterComp != null)
                    {
                        entity.ShooterComp.SetVOData(new SkinnedShooterFacade(entity.ShooterComp.ShooterVO, applicableSkin.Override));
                        entity.ShooterComp.OriginalShooterVO = new SkinnedShooterFacade(entity.ShooterComp.OriginalShooterVO, applicableSkin.Override);
                    }
                }
                if (entity.WalkerComp != null)
                {
                    entity.WalkerComp.SetVOData(applicableSkin);
                }
            }
        }
Ejemplo n.º 2
0
        private void ProcessSkin(GeometryTag cookie)
        {
            if (!(cookie.geometry is TroopTypeVO))
            {
                return;
            }
            TroopTypeVO     troop         = cookie.geometry as TroopTypeVO;
            ProjectorConfig projector     = cookie.projector;
            TeamType        team          = TeamType.Attacker;
            CurrentBattle   currentBattle = Service.BattleController.GetCurrentBattle();

            if (currentBattle != null && !string.IsNullOrEmpty(currentBattle.MissionId))
            {
                CampaignMissionVO campaignMissionVO = Service.StaticDataController.Get <CampaignMissionVO>(currentBattle.MissionId);
                if (campaignMissionVO != null && campaignMissionVO.IsRaidDefense())
                {
                    team = TeamType.Defender;
                }
            }
            SkinTypeVO applicableSkin = this.GetApplicableSkin(troop, cookie.armory, cookie.battle, team);

            if (applicableSkin != null)
            {
                ProjectorConfig config = ProjectorUtils.GenerateGeometryConfig(applicableSkin, projector.FrameSprite, projector.closeup);
                projector.MakeEquivalentTo(config);
            }
        }
Ejemplo n.º 3
0
 private static void AddDeployableToList <T>(string uid, int amount, List <IAssetVO> assets, List <string> equipment, StaticDataController dc, SkinController skinController) where T : IValueObject
 {
     if (amount > 0)
     {
         IAssetVO assetVO = dc.GetOptional <T>(uid) as IAssetVO;
         if (assetVO != null)
         {
             if (assetVO is TroopTypeVO)
             {
                 TroopTypeVO troopTypeVO = (TroopTypeVO)assetVO;
                 MapDataLoaderUtils.AddSpawnEffect(troopTypeVO, assets, dc);
                 MapDataLoaderUtils.AddPlanetAttachments(troopTypeVO, assets, dc);
                 SkinTypeVO applicableSkin = skinController.GetApplicableSkin(troopTypeVO, equipment);
                 if (applicableSkin != null)
                 {
                     assetVO = applicableSkin;
                 }
             }
             for (int i = 0; i < amount; i++)
             {
                 assets.Add(assetVO);
             }
         }
     }
 }
Ejemplo n.º 4
0
        private void ProcessHologramSkin(GeometryTag cookie)
        {
            if (cookie.geometry == null || !(cookie.geometry is TroopTypeVO))
            {
                return;
            }
            SkinTypeVO applicableSkin = this.GetApplicableSkin(cookie.geometry as TroopTypeVO, Service.CurrentPlayer.ActiveArmory, null, TeamType.Undefined);

            if (applicableSkin != null && applicableSkin.MobilizationHologram != null)
            {
                cookie.assetName = applicableSkin.MobilizationHologram.AssetName;
            }
        }
Ejemplo n.º 5
0
        private void ProcessCardSkin(GeometryTag cookie)
        {
            if (!(cookie.geometry is TroopTypeVO))
            {
                return;
            }
            SkinTypeVO applicableSkin = this.GetApplicableSkin(cookie.geometry as TroopTypeVO, Service.CurrentPlayer.ActiveArmory, null, TeamType.Undefined);

            if (applicableSkin != null && applicableSkin.CardTexture != null)
            {
                cookie.assetName = applicableSkin.CardTexture.AssetName;
            }
        }
Ejemplo n.º 6
0
        private void ProcessTooltip(GeometryTag cookie)
        {
            if (!(cookie.geometry is TroopTypeVO))
            {
                return;
            }
            TroopTypeVO troop          = cookie.geometry as TroopTypeVO;
            SkinTypeVO  applicableSkin = this.GetApplicableSkin(troop, cookie.armory, cookie.battle, TeamType.Attacker);

            if (applicableSkin != null)
            {
                cookie.tooltipText = LangUtils.GetSkinDisplayName(applicableSkin);
            }
        }
Ejemplo n.º 7
0
        public SkinTypeVO GetApplicableSkin(TroopTypeVO troop, List <string> equipmentList, out string equipmentUid)
        {
            equipmentUid = null;
            if (troop == null || equipmentList == null)
            {
                return(null);
            }
            StaticDataController staticDataController = Service.StaticDataController;
            int i     = 0;
            int count = equipmentList.Count;

            while (i < count)
            {
                EquipmentVO equipmentVO = staticDataController.Get <EquipmentVO>(equipmentList[i]);
                if (equipmentVO != null)
                {
                    string[] skins = equipmentVO.Skins;
                    if (skins != null)
                    {
                        int j   = 0;
                        int num = skins.Length;
                        while (j < num)
                        {
                            SkinTypeVO skinTypeVO = staticDataController.Get <SkinTypeVO>(skins[j]);
                            if (troop.TroopID.Equals(skinTypeVO.UnitId))
                            {
                                equipmentUid = equipmentList[i];
                                return(skinTypeVO);
                            }
                            j++;
                        }
                    }
                }
                i++;
            }
            return(null);
        }
Ejemplo n.º 8
0
        public static void AddTroopProjectileAssets(string troopUid, List <IAssetVO> assets, IDataController dc)
        {
            TroopTypeVO      troopTypeVO    = dc.Get <TroopTypeVO>(troopUid);
            ProjectileTypeVO projectileType = troopTypeVO.ProjectileType;
            ActiveArmory     activeArmory   = Service.Get <CurrentPlayer>().ActiveArmory;

            if (activeArmory != null)
            {
                SkinTypeVO applicableSkin = Service.Get <SkinController>().GetApplicableSkin(troopTypeVO, activeArmory.Equipment);
                if (applicableSkin != null && applicableSkin.Override != null && applicableSkin.Override.ProjectileType != null)
                {
                    projectileType = applicableSkin.Override.ProjectileType;
                }
            }
            ProjectileUtils.AddProjectileAssets(projectileType, assets, dc);
            ProjectileUtils.AddProjectileAssets(troopTypeVO.DeathProjectileType, assets, dc);
            ProjectileUtils.AddBuffProjectileAssets(troopTypeVO.SpawnApplyBuffs, assets, dc);
            if (!string.IsNullOrEmpty(troopTypeVO.Ability))
            {
                TroopAbilityVO troopAbilityVO = dc.Get <TroopAbilityVO>(troopTypeVO.Ability);
                ProjectileUtils.AddProjectileAssets(troopAbilityVO.ProjectileType, assets, dc);
                ProjectileUtils.AddBuffProjectileAssets(troopAbilityVO.SelfBuff, assets, dc);
            }
        }
Ejemplo n.º 9
0
 public static string GetSkinDisplayName(SkinTypeVO skinfo)
 {
     return(Service.Get <Lang>().Get("skn_title_" + skinfo.Uid, new object[0]));
 }