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); } }
public void CreateMobilizationHolo(string unitUid, bool isStarship, bool isNavCenter) { AssetManager assetManager = Service.AssetManager; if (this.coneAssetHandle == AssetHandle.Invalid && !isNavCenter) { assetManager.Load(ref this.coneAssetHandle, "fx_summon_hologram", new AssetSuccessDelegate(this.OnEffectLoaded), null, true); } if (unitUid == null) { return; } StaticDataController staticDataController = Service.StaticDataController; IDeployableVO geometry = null; int num; string text; if (isStarship) { SpecialAttackTypeVO specialAttackTypeVO = staticDataController.Get <SpecialAttackTypeVO>(unitUid); num = specialAttackTypeVO.Order; text = specialAttackTypeVO.HologramUid; geometry = specialAttackTypeVO; } else if (isNavCenter) { text = unitUid; num = 2147483647; } else { TroopTypeVO troopTypeVO = staticDataController.Get <TroopTypeVO>(unitUid); num = troopTypeVO.Order; text = troopTypeVO.HologramUid; geometry = troopTypeVO; } if (num <= this.unitOrder) { return; } if (string.IsNullOrEmpty(text)) { return; } this.DestroyHolo(); this.unitOrder = num; this.useHoloRotation = true; MobilizationHologramVO mobilizationHologramVO = staticDataController.Get <MobilizationHologramVO>(text); GeometryTag geometryTag = new GeometryTag(geometry, mobilizationHologramVO.AssetName); Service.EventManager.SendEvent(EventId.HologramCreated, geometryTag); assetManager.Load(ref this.holoAssetHandle, geometryTag.assetName, new AssetSuccessDelegate(this.OnEffectLoaded), new AssetFailureDelegate(this.OnEffectLoadFailed), false); }
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; } }
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; } }
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); } }
public TransportTroopEffect(Entity troopEntity, TroopTypeVO troopVO, Entity starportEntity, ViewFader entityFader, TransportTroopEffect.OnEffectFinished onFinished, bool showFullEffect) { this.troopVO = troopVO; this.troopEntity = troopEntity; this.starportEntity = starportEntity; this.entityFader = entityFader; this.onFinished = onFinished; this.showFullEffect = showFullEffect; if (showFullEffect) { TextureVO optional = Service.Get <IDataController>().GetOptional <TextureVO>("unittransport_event_troop_" + troopVO.TroopID); if (optional != null) { GeometryTag geometryTag = new GeometryTag(troopVO, optional.AssetName); Service.Get <EventManager>().SendEvent(EventId.TextureCreated, geometryTag); AssetManager assetManager = Service.Get <AssetManager>(); assetManager.Load(ref this.troopHandle, geometryTag.assetName, new AssetSuccessDelegate(this.OnTroopCardLoaded), new AssetFailureDelegate(this.OnTroopCardLoadFailed), null); assetManager.Load(ref this.effectHandle, "troop_card_spawn", new AssetSuccessDelegate(this.OnEffectLoaded), new AssetFailureDelegate(this.OnEffectLoadFailed), null); this.loadedAssets = true; } else { Service.Get <StaRTSLogger>().WarnFormat("Transport troop effect error: {0} not found in TextureData", new object[] { "unittransport_event_troop_" + troopVO.TroopID }); this.showFullEffect = false; } } ShuttleAnim shuttleForStarport = Service.Get <ShuttleController>().GetShuttleForStarport(starportEntity); if (shuttleForStarport != null && shuttleForStarport.State == ShuttleState.Idle) { this.shuttle = shuttleForStarport; } else { Service.Get <EventManager>().RegisterObserver(this, EventId.ShuttleAnimStateChanged, EventPriority.Default); } Service.Get <EventManager>().RegisterObserver(this, EventId.BuildingMovedOnBoard, EventPriority.Default); Service.Get <EventManager>().RegisterObserver(this, EventId.BuildingReplaced, EventPriority.Default); this.timerId = 0u; this.pathReached = false; }
public void RegisterButtonTooltip(UXButton button, IUpgradeableVO vo, BattleEntry battle) { string tooltipText = null; if (vo is SpecialAttackTypeVO) { tooltipText = LangUtils.GetStarshipDisplayName((SpecialAttackTypeVO)vo); } else if (vo is TroopTypeVO) { tooltipText = LangUtils.GetTroopDisplayName((TroopTypeVO)vo); } GeometryTag geometryTag = new GeometryTag(vo, tooltipText, battle); Service.Get <EventManager>().SendEvent(EventId.TooltipCreated, geometryTag); if (geometryTag.tooltipText != null) { this.RegisterButtonTooltip(button, geometryTag.tooltipText); } }