protected override void OnScreenLoaded() { BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>(); Service.Get <UXController>().HUD.Visible = false; this.InitButtons(); this.SetUIText(); this.LoadFx(); UXSprite element = base.GetElement <UXSprite>("SpriteInstructions"); BuildingTypeVO buildingTypeVO = null; if (this.isSpecialAttack) { if (buildingLookupController.HasStarshipCommand()) { FleetCommandNode head = buildingLookupController.FleetCommandNodeList.Head; buildingTypeVO = head.BuildingComp.BuildingType; } } else { buildingTypeVO = buildingLookupController.GetHighestAvailableBuildingVOForTroop((TroopTypeVO)this.subjectVO); } if (buildingTypeVO != null) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(buildingTypeVO, element, false); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; ProjectorUtils.GenerateProjector(projectorConfig); } else { element.Visible = false; } this.fadingOutSubject = false; }
public static void SetRewardIcon(UXSprite sprite, IGeometryVO config, AnimationPreference animPreference = AnimationPreference.NoAnimation) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(config, sprite); projectorConfig.AnimPreference = animPreference; ProjectorUtils.GenerateProjector(projectorConfig); }
private void SetupItemGrid() { this.itemGrid = base.GetElement <UXGrid>("UnlockItemsGrid"); this.itemGrid.SetTemplateItem("UnlockItemsTemplate"); BuildingLookupController buildingLookupController = Service.BuildingLookupController; Dictionary <BuildingTypeVO, int> buildingsUnlockedBy = buildingLookupController.GetBuildingsUnlockedBy(this.headQuarter); int num = 0; foreach (KeyValuePair <BuildingTypeVO, int> current in buildingsUnlockedBy) { BuildingTypeVO key = current.Key; int value = current.Value; if (key.Type == BuildingType.Turret && key.BuildingRequirement != this.headQuarter.Uid) { if (num == 0) { num = value; } } else { string uid = key.Uid; UXElement item = this.itemGrid.CloneTemplateItem(uid); UXSprite subElement = this.itemGrid.GetSubElement <UXSprite>(uid, "SpriteItemImage"); ProjectorConfig projectorConfig = ProjectorUtils.GenerateBuildingConfig(key, subElement); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; ProjectorUtils.GenerateProjector(projectorConfig); UXLabel subElement2 = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelUnlockCount"); if (key.Type == BuildingType.Turret) { subElement2.Visible = false; } else { subElement2.Text = this.lang.Get("TROOP_MULTIPLIER", new object[] { value }); } this.itemGrid.AddItem(item, key.Order); } } UXElement item2 = this.itemGrid.CloneTemplateItem("TURRETS"); UXSprite subElement3 = this.itemGrid.GetSubElement <UXSprite>("TURRETS", "SpriteItemImage"); subElement3.Visible = false; UXLabel subElement4 = this.itemGrid.GetSubElement <UXLabel>("TURRETS", "LabelUnlockCount"); subElement4.Visible = false; UXLabel subElement5 = this.itemGrid.GetSubElement <UXLabel>("TURRETS", "LabelTurrets"); subElement5.Visible = true; subElement5.Text = this.lang.Get("HQ_UPGRADE_TURRETS_UNLOCKED", new object[] { num }); this.itemGrid.AddItem(item2, 99999999); this.itemGrid.RepositionItems(); this.itemGrid.Scroll((this.itemGrid.Count <= 7) ? 0.5f : 0f); }
public static void SetupGeometryForIcon(UXSprite itemIconSprite, ProjectorConfig config) { itemIconSprite.SpriteName = "bkgClear"; config.AnimPreference = AnimationPreference.NoAnimation; ProjectorUtils.GenerateProjector(config); itemIconSprite.GetUIWidget.enabled = false; }
private void SetupShardRewardItemElements(string itemUID, CrateSupplyVO crateSupply) { ShardVO shardVO = Service.Get <IDataController>().Get <ShardVO>(crateSupply.RewardUid); int quality = (int)shardVO.Quality; string name = string.Format("SpriteTroopImageBkgGridQ{0}", new object[] { quality }); this.rewardsGrid.GetSubElement <UXElement>(itemUID, name).Visible = false; UXSprite subElement = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteIconFragmentLootTable"); UXUtils.SetupFragmentIconSprite(subElement, quality); UXSprite subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteRewardItemImage"); IDeployableVO deployableVOFromShard = Service.Get <DeployableShardUnlockController>().GetDeployableVOFromShard(shardVO); if (deployableVOFromShard == null) { Service.Get <StaRTSLogger>().Error("SetupShardRewardItemElements Unable to find deployable"); return; } ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(deployableVOFromShard, subElement2, true); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; GeometryProjector item = ProjectorUtils.GenerateProjector(projectorConfig); this.projectors.Add(item); this.SetupDeployableShardProgress(itemUID, shardVO); UXUtils.SetCardQuality(this, this.rewardsGrid, itemUID, quality, "RewardItemCardQ{0}"); }
protected void AddTroopItem(IUpgradeableVO troop, int troopCount, string tooltipText) { TroopUpgradeTag troopUpgradeTag = new TroopUpgradeTag(troop as IDeployableVO, true); this.troopList.Add(troopUpgradeTag); string uid = troop.Uid; UXElement item = this.storageItemGrid.CloneTemplateItem(uid); UXLabel subElement = this.storageItemGrid.GetSubElement <UXLabel>(uid, "LabelStorageCount"); subElement.Text = LangUtils.GetMultiplierText(troopCount); UXSprite subElement2 = this.storageItemGrid.GetSubElement <UXSprite>(uid, "SpriteStorageItemImageTroops"); ProjectorConfig config = ProjectorUtils.GenerateGeometryConfig(troop as IDeployableVO, subElement2); Service.EventManager.SendEvent(EventId.ButtonCreated, new GeometryTag(troop, config, Service.CurrentPlayer.ActiveArmory)); ProjectorUtils.GenerateProjector(config); UXLabel subElement3 = this.storageItemGrid.GetSubElement <UXLabel>(uid, "LabelTroopLevel"); subElement3.Text = LangUtils.GetLevelText(troop.Lvl); UXElement subElement4 = this.storageItemGrid.GetSubElement <UXElement>(uid, "BtnRequestTroops"); subElement4.Visible = false; UXButton subElement5 = this.storageItemGrid.GetSubElement <UXButton>(uid, "StorageItemsCard"); if (tooltipText != null) { this.troopTooltipHelper.RegisterButtonTooltip(subElement5, tooltipText); } else { subElement5.Tag = troopUpgradeTag; subElement5.OnClicked = new UXButtonClickedDelegate(this.OnTroopItemClicked); } this.storageItemGrid.AddItem(item, troop.Order); }
private bool AddTroopItem(KeyValuePair <string, InventoryEntry> unit, TroopTypeVO troop) { string itemUid = "troop_" + troop.Uid; UXButton uXButton = this.troopDonateGrid.CloneItem(itemUid, this.troopTemplateItem) as UXButton; uXButton.Tag = unit; uXButton.OnClicked = new UXButtonClickedDelegate(this.OnTroopToDonateClicked); UXLabel subElement = this.troopDonateGrid.GetSubElement <UXLabel>(itemUid, "LabelDonateTroops"); subElement.Text = string.Format("x{0}", unit.Value.Amount); UXLabel subElement2 = this.troopDonateGrid.GetSubElement <UXLabel>(itemUid, "LabelTroopLevel"); subElement2.Text = LangUtils.GetLevelText(troop.Lvl); UXElement subElement3 = this.troopDonateGrid.GetSubElement <UXElement>(itemUid, "WidgetTroopsCardBgDefault"); UXElement subElement4 = this.troopDonateGrid.GetSubElement <UXElement>(itemUid, "WidgetTroopsCardBgQ10"); if (string.IsNullOrEmpty(troop.UpgradeShardUid)) { subElement3.Visible = true; subElement4.Visible = false; } else { subElement3.Visible = false; subElement4.Visible = true; } UXSprite subElement5 = this.troopDonateGrid.GetSubElement <UXSprite>(itemUid, "SpriteDonateTroopsItem"); ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement5); projectorConfig.AnimPreference = AnimationPreference.NoAnimation; ProjectorUtils.GenerateProjector(projectorConfig); this.troopDonateGrid.AddItem(uXButton, troop.Order); return(troop.Size <= this.totalCapacity - this.alreadyDonatedSize); }
private void SetConfigPath(string configPath) { if (projectorConfigFile != "") { config = new ProjectorConfig(projectorConfigFile); } }
private void InitCrateProjector(UXSprite sprite, CrateVO crateVO) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(crateVO, sprite); projectorConfig.AnimState = AnimState.Closed; ProjectorUtils.GenerateProjector(projectorConfig); }
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); } }
protected override void InitImages() { IGeometryVO imageGeometryConfig = this.GetImageGeometryConfig(); ProjectorConfig config = ProjectorUtils.GenerateBuildingConfig(imageGeometryConfig as BuildingTypeVO, base.GetElement <UXSprite>("BldgImageBottomFrame")); this.projector = ProjectorUtils.GenerateProjector(config); base.GetElement <UXSprite>("SpriteSquadSymbol").Visible = false; }
private void Init(IGeometryVO geometry, ProjectorConfig projector, string assetName, string tooltipText, BattleEntry battle, ActiveArmory armory) { this.geometry = geometry; this.projector = projector; this.assetName = assetName; this.tooltipText = tooltipText; this.battle = battle; this.armory = armory; }
private void SetupProjectorWithUpdatedConfig(IGeometryVO geometryVO) { UXSprite frameSprite = this.projector.Config.FrameSprite; this.projector.Destroy(); ProjectorConfig config = ProjectorUtils.GenerateBuildingConfig(geometryVO as BuildingTypeVO, frameSprite); this.projector = ProjectorUtils.GenerateProjector(config); }
protected virtual void InitImages() { IGeometryVO imageGeometryConfig = this.GetImageGeometryConfig(); UXSprite element = base.GetElement <UXSprite>((!this.useStorageGroup) ? "BldgImageFrame" : "BldgImageFrameStorage"); ProjectorConfig projectorConfig = ProjectorUtils.GenerateBuildingConfig(imageGeometryConfig as BuildingTypeVO, element); projectorConfig.AnimPreference = AnimationPreference.AnimationAlways; this.projector = ProjectorUtils.GenerateProjector(projectorConfig); base.GetElement <UXSprite>("SpriteSquadSymbol").Visible = false; }
public void CleanUp() { this.RenderTexture = null; this.Config = null; if (this.Projector != null) { this.Projector.Destroy(); } this.Projector = null; this.CrateSupply = null; }
public IEnumerator IE_PowerAnd3DOnHandler() { bool isInit = port != null || Init(); if (isInit) { DispatchAction(ProjectorConfig.ConfigCommandPowerOn); DispatchAction(ProjectorConfig.FloatToWaitString(30)); DispatchAction(ProjectorConfig.ConfigCommand3DOn); } yield return(0); }
public static void SetupAnimatedCharacter(UXSprite charSprite, string imageName, ref GeometryProjector geom) { if (charSprite != null && !string.IsNullOrEmpty(imageName)) { StaticDataController staticDataController = Service.StaticDataController; TroopTypeVO vo = staticDataController.Get <TroopTypeVO>(imageName); if (geom == null) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(vo, charSprite); projectorConfig.AnimPreference = AnimationPreference.AnimationAlways; geom = ProjectorUtils.GenerateProjector(projectorConfig); } } }
private void RenderTextureCompleteCallback(RenderTexture renderTexture, ProjectorConfig config) { int i = 0; int count = this.supplyCrateDataList.Count; while (i < count) { SupplyCrateTag supplyCrateTag = this.supplyCrateDataList[i]; if (config == supplyCrateTag.Config) { supplyCrateTag.RenderTexture = renderTexture; break; } i++; } }
public void SetIconAsset(IUpgradeableVO iconAsset) { if (this.iconSprite != null) { bool flag = iconAsset != null; this.iconSprite.Visible = flag; this.DestroyIconGeometry(); if (flag) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(iconAsset, this.iconSprite); Service.EventManager.SendEvent(EventId.ButtonCreated, new GeometryTag(iconAsset, projectorConfig, Service.CurrentPlayer.ActiveArmory)); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; projectorConfig.Sharpness = 4f; this.iconGeometry = ProjectorUtils.GenerateProjector(projectorConfig); } } }
protected override void OnScreenLoaded() { Service.Get <UXController>().HUD.Visible = false; this.InitButtons(); this.SetUIText(); this.LoadFx(); UXSprite element = base.GetElement <UXSprite>("SpriteInstructions"); ArmoryNode head = Service.Get <BuildingLookupController>().ArmoryNodeList.Head; if (head != null) { BuildingTypeVO buildingType = head.BuildingComp.BuildingType; ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(buildingType, element, false); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; ProjectorUtils.GenerateProjector(projectorConfig); } this.fadingOutSubject = false; }
public Projector(Frame frame, ProjectorPlugin projectorPlugin) { mProjectorPlugin = projectorPlugin; mFrame = frame; mTargetH = frame.Height; ProjectorConfig cfg = new ProjectorConfig(frame.Name); mOrientation = new Rotation(cfg.ProjectorPitch, cfg.ProjectorYaw); //Constants mThrowRatio = cfg.ThrowRatio; mUpsideDown = cfg.UpsideDown; mVOffset = cfg.VOffset; mNativeAspectRatio = cfg.NativeAspectRatio; SetAspectRatio(cfg.AspectRatio); CalculateAngles(); mLock = cfg.Lock; if (mLock == LockedVariable.Position /* || mLock == LockedVariable.Nothing*/) { mPosition = cfg.ProjectorPosition; mD = cfg.WallDistance; mFrame.Orientation.Yaw = mOrientation.Yaw; } else { mD = mLock == LockedVariable.Width ? CalculateDFromW() :CalculateDFromH(); mPosition = CalculatePositionFromH(); mOrientation.Yaw = mFrame.Orientation.Yaw; } mOldW = mFrame.Width; mOldH = mFrame.Height; mDraw = cfg.Draw; mDrawLabels = cfg.DrawLabels; mProjectorPlugin.RoomChanged += new Action(mProjectorPlugin_RoomChanged); mOrientation.Changed += new EventHandler(mOrientation_Changed); frame.Changed += new Action <Frame, EventArgs>(frame_Changed); }
public static void SetCrateIcon(UXSprite sprite, CrateVO crateVO, AnimState animState) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(crateVO, sprite); if (GameConstants.CRATE_SHOW_VFX && !string.IsNullOrEmpty(crateVO.VfxAssetName) && animState == AnimState.Idle) { projectorConfig.AttachmentAssets = new string[] { crateVO.VfxAssetName }; projectorConfig.AnimPreference = AnimationPreference.AnimationAlways; } else { projectorConfig.AnimPreference = AnimationPreference.NoAnimation; } projectorConfig.AnimState = animState; ProjectorUtils.GenerateProjector(projectorConfig); }
private void SetupEquipmentShardRewardItemElements(string itemUID, CrateSupplyVO crateSupply) { EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(crateSupply.RewardUid); int quality = (int)currentEquipmentDataByID.Quality; string name = string.Format("SpriteTroopImageBkgGridQ{0}", quality); this.rewardsGrid.GetSubElement <UXElement>(itemUID, name).Visible = true; UXSprite subElement = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteIconFragmentLootTable"); UXUtils.SetupFragmentIconSprite(subElement, quality); this.SetupEquipmentShardProgress(itemUID, currentEquipmentDataByID); UXSprite subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteRewardItemImage"); ProjectorConfig projectorConfig = ProjectorUtils.GenerateEquipmentConfig(currentEquipmentDataByID, subElement2, true); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; GeometryProjector item = ProjectorUtils.GenerateProjector(projectorConfig); this.projectors.Add(item); UXUtils.SetCardQuality(this, this.rewardsGrid, itemUID, quality, "RewardItemCardQ{0}"); }
private UXElement CreateDeployableUXElement(UXGrid grid, string uid, string assetName, int amount, IDeployableVO troop, BattleEntry battle) { UXElement result = grid.CloneTemplateItem(uid); UXSprite subElement = grid.GetSubElement <UXSprite>(uid, this.TroopCardIconName); ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement); Service.EventManager.SendEvent(EventId.ButtonCreated, new GeometryTag(troop, projectorConfig, battle)); projectorConfig.AnimPreference = AnimationPreference.NoAnimation; ProjectorUtils.GenerateProjector(projectorConfig); UXLabel subElement2 = grid.GetSubElement <UXLabel>(uid, this.TroopCardAmountName); subElement2.Text = LangUtils.GetMultiplierText(amount); UXLabel subElement3 = grid.GetSubElement <UXLabel>(uid, this.TroopCardLevelName); subElement3.Text = LangUtils.GetLevelText(troop.Lvl); FactionDecal.UpdateDeployableDecal(uid, grid, troop, this.TroopHeroDecalName); string text = null; if (troop is TroopTypeVO) { TroopTypeVO troop2 = troop as TroopTypeVO; Service.SkinController.GetApplicableSkin(troop2, battle.AttackerEquipment, out text); } int qualityInt; if (!string.IsNullOrEmpty(text)) { StaticDataController staticDataController = Service.StaticDataController; EquipmentVO equipmentVO = staticDataController.Get <EquipmentVO>(text); qualityInt = (int)equipmentVO.Quality; } else { qualityInt = Service.DeployableShardUnlockController.GetUpgradeQualityForDeployable(troop); } UXUtils.SetCardQuality(this, this.troopGrid, uid, qualityInt, this.TroopCardQualityName, this.TroopCardDefaultName); UXButton subElement4 = grid.GetSubElement <UXButton>(uid, this.TroopCardName); this.troopTooltipHelper.RegisterButtonTooltip(subElement4, troop, battle); return(result); }
protected void AddTroopItem(IUpgradeableVO troop, int troopCount) { TroopUpgradeTag item = new TroopUpgradeTag(troop as IDeployableVO, true); this.troopList.Add(item); string uid = troop.Uid; UXElement item2 = this.storageItemGrid.CloneTemplateItem(uid); UXLabel subElement = this.storageItemGrid.GetSubElement <UXLabel>(uid, "LabelDonateTroops"); subElement.Text = LangUtils.GetMultiplierText(troopCount); UXSprite subElement2 = this.storageItemGrid.GetSubElement <UXSprite>(uid, "SpriteDonateTroopsItem"); ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop as IDeployableVO, subElement2); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; ProjectorUtils.GenerateProjector(projectorConfig); UXLabel subElement3 = this.storageItemGrid.GetSubElement <UXLabel>(uid, "LabelTroopLevel"); subElement3.Text = LangUtils.GetLevelText(troop.Lvl); this.storageItemGrid.GetSubElement <UXSprite>(uid, "SpriteCardEmpty").Visible = false; this.storageItemGrid.AddItem(item2, troop.Order); }
private void CreateUnlockCards <T>(List <T> deployableList) where T : IDeployableVO { this.troopListForInfoScreen = new List <TroopUpgradeTag>(); int i = 0; int count = deployableList.Count; while (i < count) { IDeployableVO deployableVO = deployableList[i]; if (deployableVO is TroopTypeVO) { int level = Service.CurrentPlayer.UnlockedLevels.Troops.GetLevel(deployableVO.UpgradeGroup); deployableVO = Service.TroopUpgradeCatalog.GetByLevel(deployableVO.UpgradeGroup, level); } else { int level2 = Service.CurrentPlayer.UnlockedLevels.Starships.GetLevel(deployableVO.UpgradeGroup); deployableVO = Service.StarshipUpgradeCatalog.GetByLevel(deployableVO.UpgradeGroup, level2); } if (deployableVO.PlayerFacing) { TroopUpgradeTag troopUpgradeTag = new TroopUpgradeTag(deployableVO, true); this.troopListForInfoScreen.Add(troopUpgradeTag); UXElement item = this.unlockGrid.CloneTemplateItem(deployableVO.Uid); UXButton subElement = this.unlockGrid.GetSubElement <UXButton>(deployableVO.Uid, "BuildingUnlockCard"); subElement.OnClicked = new UXButtonClickedDelegate(this.OnUnlockCardClicked); subElement.Tag = troopUpgradeTag; UXSprite subElement2 = this.unlockGrid.GetSubElement <UXSprite>(deployableVO.Uid, "SpriteItemImageTroops"); ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(deployableVO, subElement2); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; ProjectorUtils.GenerateProjector(projectorConfig); UXLabel subElement3 = this.unlockGrid.GetSubElement <UXLabel>(deployableVO.Uid, "LabelUnlockCount"); subElement3.Text = LangUtils.GetMultiplierText(1); this.unlockGrid.AddItem(item, deployableVO.Order); } i++; } }
IEnumerator ConsumeAction() { if (!lockFlag) { lockFlag = true; string nextAction = actions.Dequeue(); Debug.Log("Next action: " + nextAction); if (nextAction.StartsWith(ProjectorConfig.ConfigCommandPrefix)) { string reply = port.SendCommand(config.Get(nextAction), ProjectorConfig.ConfigCommandSeparators); Debug.Log("Got (" + reply.Length + ") : " + reply); } else if (nextAction.StartsWith(ProjectorConfig.ConfigWaitPrefix)) { yield return(new WaitForSeconds(ProjectorConfig.WaitStringToFloat(nextAction))); Debug.Log("Done: " + nextAction); } lockFlag = false; } }
private void CreateBuildingTrayItem(BuildingTypeVO vo, int count) { UXElement uXElement = this.stashedBuildingsGrid.CloneTemplateItem(vo.Uid); UXCheckbox subElement = this.stashedBuildingsGrid.GetSubElement <UXCheckbox>(vo.Uid, "CheckboxStash"); subElement.Tag = vo.Uid; subElement.OnSelected = new UXCheckboxSelectedDelegate(this.OnStashedBuildingClicked); subElement.Selected = false; uXElement.Tag = vo; UXLabel subElement2 = this.stashedBuildingsGrid.GetSubElement <UXLabel>(vo.Uid, "LabelQuantityStash"); subElement2.Tag = vo.Uid; subElement2.Text = count.ToString(); UXLabel subElement3 = this.stashedBuildingsGrid.GetSubElement <UXLabel>(vo.Uid, "LabelBldgLevelStash"); subElement3.Text = LangUtils.GetLevelText(vo.Lvl); UXSprite subElement4 = this.stashedBuildingsGrid.GetSubElement <UXSprite>(vo.Uid, "SpriteBldgStash"); ProjectorConfig projectorConfig = ProjectorUtils.GenerateBuildingConfig(vo, subElement4); projectorConfig.AnimPreference = AnimationPreference.NoAnimation; ProjectorUtils.GenerateProjector(projectorConfig); this.stashedBuildingsGrid.AddItem(uXElement, vo.Lvl + vo.StashOrder); }
public bool Init() { if (portName == "") { return(false); } // ensure the config file path if (config == null || config.configFilePath != projectorConfigFile) { Debug.Log("Not same config path. Parse again."); config = new ProjectorConfig(projectorConfigFile); } if (!config.IsReady) { return(false); } port = new ProjectorPort( portName, config.GetInt(ProjectorConfig.ConfigAttrBuadrate, ProjectorPort.PROJECTOR_BAUD_RATE), config.Get(ProjectorConfig.ConfigAttrParityCheck, ProjectorPort.PROJECTOR_PARITY_CHECK), config.GetInt(ProjectorConfig.ConfigAttrDataBits, ProjectorPort.PROJECTOR_DATA_BITS), config.Get(ProjectorConfig.ConfigAttrStopBit, ProjectorPort.PROJECTOR_STOP_BIT) ); bool isOpen = port.Open(); ColorBlock colorBlock = statusConnection.colors; Color nextColor = port.IsWorking ? Color.green : Color.red; colorBlock.normalColor = nextColor; colorBlock.highlightedColor = nextColor; statusConnection.colors = colorBlock; return(isOpen); }
private void AddExpendedItem(UXGrid expendedGrid, string entryItemUid, string troopUid, IUpgradeableVO troop, int count, int unitQuality, BattleEntry battleEntry) { if (expendedGrid.Count == 8) { return; } if (count <= 0) { return; } UXElement uXElement = expendedGrid.CloneTemplateItem(troopUid); uXElement.Root.name = UXUtils.FormatAppendedName(uXElement.Root.name, entryItemUid); UXLabel subElement = expendedGrid.GetSubElement <UXLabel>(troopUid, UXUtils.FormatAppendedName("LabelTroopsExpended", entryItemUid)); subElement.Text = ((count <= 0) ? string.Empty : this.lang.Get("TROOP_MULTIPLIER", new object[] { count })); UXLabel subElement2 = expendedGrid.GetSubElement <UXLabel>(troopUid, UXUtils.FormatAppendedName("LabelTroopLevel", entryItemUid)); subElement2.Text = LangUtils.GetLevelText(troop.Lvl); UXSprite subElement3 = expendedGrid.GetSubElement <UXSprite>(troopUid, UXUtils.FormatAppendedName("SpriteTroopsImage", entryItemUid)); ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement3); Service.EventManager.SendEvent(EventId.ButtonCreated, new GeometryTag(troop, projectorConfig, battleEntry)); UXUtils.SetupGeometryForIcon(subElement3, projectorConfig); string defaultCardName = UXUtils.FormatAppendedName("TroopsExpendBgDefault", entryItemUid); string cardName = UXUtils.FormatAppendedName("TroopsExpendBgQ{0}", entryItemUid); UXUtils.SetCardQuality(this, expendedGrid, troopUid, unitQuality, cardName, defaultCardName); FactionDecal.UpdateDeployableDecal(troopUid, entryItemUid, expendedGrid, (IDeployableVO)troop); UXButton subElement4 = expendedGrid.GetSubElement <UXButton>(troopUid, UXUtils.FormatAppendedName("TroopsExpendedCard", entryItemUid)); this.troopTooltipHelper.RegisterButtonTooltip(subElement4, troop, battleEntry); expendedGrid.AddItem(uXElement, troop.Order); }