public void UpdateData(ProductionInfo info, DateTime time) { this.time = time; this.uid = info.uId; this.quickenCost = DataReader <XuanShangSheZhi> .Get("quickenCost").num; this.quickenTime = DataReader <XuanShangSheZhi> .Get("quickenTime").num; ShengChanJiDi shengChanJiDi = DataReader <ShengChanJiDi> .Get(info.typeId); ResourceManager.SetSprite(this.CoinIcon, GameDataUtils.GetIcon(DataReader <Items> .Get(DataReader <XuanShangSheZhi> .Get("quickenCoinType").num).littleIcon)); ResourceManager.SetSprite(this.Background, GameDataUtils.GetIcon(shengChanJiDi.baseicon)); ResourceManager.SetSprite(this.Quality, GameDataUtils.GetIcon(5050 + shengChanJiDi.baseQuality)); this.Name.set_text(shengChanJiDi.baseName); Debug.LogError(string.Concat(new object[] { "地唯一id:", info.uId, ",配置id:", info.typeId, "==========配置的名字:", shengChanJiDi.baseName, ",配置图片:", 5050 + shengChanJiDi.baseQuality, "===", GameDataUtils.GetIcon(5050 + shengChanJiDi.baseQuality) })); this.OnSecondsPast(); }
private List <ProductionInfo> SetProductionInfoList(List <Rack> racks) { List <ProductionInfo> productionInfos = new List <ProductionInfo>(); try { foreach (var rack in racks) { ProductionInfo productionInfo = new ProductionInfo(); productionInfo.AreaNo = rack.AreaNo; productionInfo.BatchNo = rack.BatchNo.ToString(); productionInfo.RackNo = rack.RackNo; productionInfo.WorkpieceType = Encoding.ASCII.GetString(rack.WorkpieceType); productionInfo.PrimerColor = $"{rack.PrimerColor}"; productionInfo.PrimerCraft = $"{rack.PrimerCraft}"; productionInfo.PrimerFirm = $"{rack.PrimerFirm}"; productionInfo.PigmentedCoatingColor = $"{rack.PigmentedCoatingColor}"; productionInfo.PigmentedCoatingCraft = $"{rack.PigmentedCoatingCraft}"; productionInfo.PigmentedCoatingFirm = $"{rack.PigmentedCoatingFirm}"; productionInfo.VarnishCraft = $"{rack.VarnishCraft}"; productionInfo.VarnishFirm = $"{rack.VarnishFirm}"; productionInfo.Validity = 1; productionInfo.RecordTimestamp = DateTime.Now; productionInfo.UID = 1; productionInfos.Add(productionInfo); } } catch (Exception ex) { //LogManager.WriteLog(LogFile.Trace, ex.Message); } return(productionInfos); }
public void UpdateData(ProductionInfo info) { this.Info = info; this.uid = info.uId; this.time = BountyManager.Instance.ProductionTimeMap.get_Item(this.uid); this.quickenCost = DataReader <XuanShangSheZhi> .Get("quickenCost").num; this.quickenTime = DataReader <XuanShangSheZhi> .Get("quickenTime").num; ShengChanJiDi shengChanJiDi = DataReader <ShengChanJiDi> .Get(info.typeId); ResourceManager.SetSprite(this.consumeIcon, GameDataUtils.GetIcon(DataReader <Items> .Get(DataReader <XuanShangSheZhi> .Get("quickenCoinType").num).littleIcon)); ResourceManager.SetSprite(this.Icon, GameDataUtils.GetIcon(shengChanJiDi.baseicon)); ResourceManager.SetSprite(this.Quality, GameDataUtils.GetIcon(5050 + shengChanJiDi.baseQuality)); this.Name.set_text(shengChanJiDi.baseName); Debug.LogError(string.Concat(new object[] { "地唯一id:", info.uId, ",配置id:", info.typeId, "==========配置的名字:", shengChanJiDi.baseName, ",配置图片:", 5050 + shengChanJiDi.baseQuality, "===", GameDataUtils.GetIcon(5050 + shengChanJiDi.baseQuality) })); this.RefreshCountdown(); }
private void OnProductionInfoNty(short state, ProductionInfoNty down = null) { if (state != 0) { StateManager.Instance.StateShow(state, 0); return; } if (down != null) { this.Info.productions.Clear(); this.Info.productions.AddRange(down.productions); this.SetProductionCountdown(); this.BroadcastRefreshEvent(); using (List <ProductionInfo> .Enumerator enumerator = this.Info.productions.GetEnumerator()) { while (enumerator.MoveNext()) { ProductionInfo current = enumerator.get_Current(); if (current.countDown <= 0) { EventDispatcher.Broadcast("GuideManager.BountyExistProduction"); } } } } }
internal HalDevice(Volume volume) { this.volume = volume; volume_info = new HalVolumeInfo(volume); production_info = new HalProductionInfo(volume); model_info = new HalModelInfo(volume); if (volume.PropertyExists(PodsleuthPrefix + "control_path")) { string relative_control = volume.GetPropertyString(PodsleuthPrefix + "control_path"); if (relative_control[0] == Path.DirectorySeparatorChar) { relative_control = relative_control.Substring(1); } ControlPath = Path.Combine(VolumeInfo.MountPoint, relative_control); } ArtworkFormats = new ReadOnlyCollection <ArtworkFormat> (LoadArtworkFormats()); if (volume.PropertyExists(PodsleuthPrefix + "firmware_version")) { FirmwareVersion = volume.GetPropertyString(PodsleuthPrefix + "firmware_version"); } if (volume.PropertyExists(PodsleuthPrefix + "firewire_id")) { FirewireId = volume.GetPropertyString(PodsleuthPrefix + "firewire_id"); } RescanDisk(); }
internal HalDevice(Volume volume) { this.volume = volume; volume_info = new HalVolumeInfo (volume); production_info = new HalProductionInfo (volume); model_info = new HalModelInfo (volume); if (volume.PropertyExists (PodsleuthPrefix + "control_path")) { string relative_control = volume.GetPropertyString (PodsleuthPrefix + "control_path"); if (relative_control[0] == Path.DirectorySeparatorChar) { relative_control = relative_control.Substring (1); } ControlPath = Path.Combine(VolumeInfo.MountPoint, relative_control); } ArtworkFormats = new ReadOnlyCollection<ArtworkFormat> (LoadArtworkFormats ()); if (volume.PropertyExists (PodsleuthPrefix + "firmware_version")) { FirmwareVersion = volume.GetPropertyString (PodsleuthPrefix + "firmware_version"); } if (volume.PropertyExists (PodsleuthPrefix + "firewire_id")) { FirewireId = volume.GetPropertyString (PodsleuthPrefix + "firewire_id"); } RescanDisk (); }
public GameObject GetUnitFactoryPrefab(GameObject unit) // This should not be unique to Commander. { ProductionInfo info = unit.GetComponent <ProductionInfo>(); if (info) { return(info.FactoryPrefab); } return(null); }
private static float ProductionScore(GameObject go) { ProductionInfo info = go.GetComponent <ProductionInfo>(); if (info) { return(info.ProductionTime); } return(120f); // magic numbers cause f**k you }
public bool HasProductionPos() { for (int i = 0; i < this.Info.productions.get_Count(); i++) { ProductionInfo productionInfo = this.Info.productions.get_Item(i); if (productionInfo.countDown <= 0) { return(true); } } return(false); }
private void SetProductionCountdown() { this.ProductionTimeMap.Clear(); using (List <ProductionInfo> .Enumerator enumerator = this.Info.productions.GetEnumerator()) { while (enumerator.MoveNext()) { ProductionInfo current = enumerator.get_Current(); this.ProductionTimeMap.Add(current.uId, TimeManager.Instance.PreciseServerTime.AddSeconds((double)current.countDown)); } } }
/// <summary> /// 初始化所有基础类的配置 /// </summary> public static void Init() { try { ResultInfo.ReadConfig(); ProductionInfo.ReadConfig(); //Server.HttpServerInfo.ReadConfig(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); Environment.Exit(0); } }
public GameObject GeneratePrefab(GameObject unitPrefab) { ProductionInfo info = unitPrefab.GetComponent <ProductionInfo>(); if (info) { UnitFactory factory = info.FactoryPrefab.GetComponent <UnitFactory>(); factory.UnitPrefab = unitPrefab; factory.SpawnDelay = info.ProductionTime; return(factory.gameObject); } else { return(unitPrefab); } }
public WithProductionOverlay(Actor self, WithProductionOverlayInfo info) { var rs = self.Trait <RenderSprites>(); var body = self.Trait <BodyOrientation>(); buildComplete = !self.Info.HasTraitInfo <BuildingInfo>(); // always render instantly for units production = self.Info.TraitInfo <ProductionInfo>(); overlay = new Animation(self.World, rs.GetImage(self)); overlay.PlayRepeating(info.Sequence); var anim = new AnimationWithOffset(overlay, () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), () => !IsProducing || !buildComplete); rs.Add(anim, info.Palette, info.IsPlayerPalette); }
private Mock <IProdInfoFactory> BuildProdInfoFactory() { var mock = new Mock <IProdInfoFactory>(); mock.Setup(factory => factory.Create(It.IsAny <string>())) .Returns((string name) => { var prodInfo = new ProductionInfo(name, _tracerMock.Object); _allProdInfo.Add(prodInfo); return(prodInfo); }); mock.Setup(factory => factory.AllProductions) .Returns(_allProdInfo); return(mock); }
public override int GetBlueprints(List <MyBlueprintDefinitionBase.ProductionInfo> blueprints) { int total = 0; for (int i = 0; i < m_blueprints.Length; ++i) { int added = m_blueprints[i].GetBlueprints(blueprints); int count = blueprints.Count(); for (int j = count - 1; j >= count - added; --j) { ProductionInfo info = blueprints[j]; info.Amount *= m_items[i].Amount; blueprints[j] = info; } total += added; } return(total); }
public void RefreshUI() { BountyProductionItem[] productionItems = this.ProductionItems; for (int i = 0; i < productionItems.Length; i++) { BountyProductionItem bountyProductionItem = productionItems[i]; bountyProductionItem.get_gameObject().SetActive(false); } for (int j = 0; j < BountyManager.Instance.Info.productions.get_Count(); j++) { ProductionInfo info = BountyManager.Instance.Info.productions.get_Item(j); this.ProductionItems[j].get_gameObject().SetActive(true); this.ProductionItems[j].GetComponent <BountyProductionItem>().UpdateData(info); } this.Score.set_text(string.Format(GameDataUtils.GetChineseContent(513631, false), BountyManager.Instance.Info.score.ToString())); this.detailDaily.UpdateUI(); this.detailUrgent.UpdateUI(); this.OnClickTagButton(); this.OnSecondsPast(); }
private (Unit unit, float productionTime) GetUnitProductionInfo(Unit potentialFactory) { Unit unit = potentialFactory; float productionTime = FallbackProductionTime; UnitFactory factory = potentialFactory.GetComponent <UnitFactory>(); if (factory) { unit = factory.UnitPrefab.GetComponent <Unit>(); productionTime = unit.GetComponent <ProductionInfo>().ProductionTime; } ProductionInfo info = potentialFactory.GetComponent <ProductionInfo>(); if (info) { productionTime = info.ProductionTime; } return(unit, productionTime); }
IEnumerator BuildUnit() { //while (queuedUnits.Count > 0) //{ // UnitVariables o = queuedUnits.Peek(); // for (float i = 0; i < o.BuildTime; i += Time.deltaTime) // { // BuildPercent = i / o.BuildTime; // // yield return null; // } // // GameObject newUnit = Instantiate(objectBase); //} while (m_UnitQueue.Count > 0) { ProductionInfo o = m_UnitQueue.Peek(); for (float i = 0; i < o.m_UnivStats.m_BuildTime; i += Time.deltaTime) { m_BuildPercent = i / o.m_UnivStats.m_BuildTime; Debug.Log("Training: " + (m_BuildPercent * 100).ToString("F2") + "%"); yield return(null); } GameObject newUnit = Instantiate(m_ObjectBase); newUnit.layer = Utils.IntToLayer_s(o.m_UnitVar.m_Dimension); //Unit unitComp = newUnit.AddComponent<Unit>(); Unit unitComp = newUnit.GetComponent <Unit>(); unitComp.SetUnitStats(o.m_UnitVar); Debug.Log("Unit created"); yield return(new WaitForSeconds(2)); unitComp.SetTargetGoal(CurrentGoal); m_UnitQueue.Dequeue(); } }
/// <summary> /// 显示物体信息详情 /// </summary> /// <param name="target"></param> public void ShowObjectInfo(Transform target) { string targetName = target.name; if (DeviceObjects.ContainsKey(targetName)) { int index = Array.IndexOf(DeviceColliders, targetName); Dialog._instance.dialog_deviceInfo.SetActive(true); DeviceInfo di = Dialog._instance.item_deviceInfo.GetComponent <DeviceInfo>(); di.InitDeviceInfo(index); } if (FlowObjects.ContainsKey(targetName)) { int flow = Array.IndexOf(FlowColliders, targetName); Dialog._instance.dialog_pdtInfo.SetActive(true); ProductionInfo pdt = Dialog._instance.productionInfo.GetComponent <ProductionInfo>(); pdt.InitFlowInfo(flow, ListManager._instance.brand); } if (LockersObjects.ContainsKey(targetName)) { int index = Array.IndexOf(LockersColliders, targetName); Dialog._instance.dialog_lockersInfo.SetActive(true); LockersInfo li = Dialog._instance.lockersInfo.GetComponent <LockersInfo>(); li.InitLockerInfo(index, ListManager._instance.brand); } if (MonitorsObjects.ContainsKey(targetName)) { int index = Array.IndexOf(MonitorColliders, targetName); //切换到故障报警界面 TopUIPanel._instance.SetCurrentTab(2); ListManager._instance.ShowInfoList(3); CameraInfo._instance.SelectCamera(index); } }
public Production(ActorInitializer init, ProductionInfo info) { Info = info; rp = Exts.Lazy(() => init.Self.IsDead ? null : init.Self.TraitOrDefault<RallyPoint>()); Race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.Race; }
public ProductionFromMapEdge(ActorInitializer init, ProductionInfo info) : base(init, info) { }
public ResearchableProduction(ActorInitializer init, ProductionInfo info) : base(init, info) { }
public Production(ActorInitializer init, ProductionInfo info) { Info = info; rp = Exts.Lazy(() => init.Self.IsDead ? null : init.Self.TraitOrDefault<RallyPoint>()); Faction = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : init.Self.Owner.Faction.InternalName; }
private ProductionInfo getProductionInfo(string infobox) { ProductionInfo result = null; //short circuit infoboxes without production info if (!infobox.Contains("|Produces Amount")) { return(result); } using (var reader = new StringReader(infobox)) { string curLine; while ((curLine = reader.ReadLine()) != null) { curLine = curLine.Replace(_commons.InfoboxTemplateEnd, string.Empty); if (curLine.StartsWith("|Produces Amount Electricity", StringComparison.OrdinalIgnoreCase)) { var productionAmountElectricity = curLine.Replace("|Produces Amount Electricity", string.Empty) .Replace("=", string.Empty) .Trim(); if (double.TryParse(productionAmountElectricity, NumberStyles.Number, cultureForParsing, out var parsedProductionAmountElectricity)) { if (result == null) { result = new ProductionInfo(); } if (result.EndProduct == null) { result.EndProduct = new EndProduct(); } result.EndProduct.AmountElectricity = parsedProductionAmountElectricity; } } else if (curLine.StartsWith("|Produces Amount", StringComparison.OrdinalIgnoreCase)) { var productionAmount = curLine.Replace("|Produces Amount", string.Empty) .Replace("=", string.Empty) .Trim(); if (double.TryParse(productionAmount, NumberStyles.Number, cultureForParsing, out var parsedProductionAmount)) { if (result == null) { result = new ProductionInfo(); } if (result.EndProduct == null) { result.EndProduct = new EndProduct(); } result.EndProduct.Amount = parsedProductionAmount; } } else if (curLine.StartsWith("|Produces Icon", StringComparison.OrdinalIgnoreCase)) { var icon = curLine.Replace("|Produces Icon", string.Empty) .Replace("=", string.Empty) .Trim(); if (string.IsNullOrWhiteSpace(icon)) { continue; } if (result == null) { result = new ProductionInfo(); } if (result.EndProduct == null) { result.EndProduct = new EndProduct(); } result.EndProduct.Icon = icon; } else if (curLine.StartsWith("|Input ", StringComparison.OrdinalIgnoreCase)) { var matchAmount = regexInputAmount.Match(curLine); if (matchAmount.Success) { var matchedCounter = matchAmount.Groups["counter"].Value; if (!int.TryParse(matchedCounter, out var counter)) { throw new Exception("could not find counter"); } //handle entry with no value e.g. "|Input 2 Amount = " var matchedValue = matchAmount.Groups["value"].Value; if (string.IsNullOrWhiteSpace(matchedValue)) { continue; } if (!double.TryParse(matchedValue, NumberStyles.Number, cultureForParsing, out var inputValue)) { throw new Exception("could not find value for input"); } if (result == null) { result = new ProductionInfo(); } var foundInputProduct = result.InputProducts.FirstOrDefault(x => x.Order == counter); if (foundInputProduct == null) { foundInputProduct = new InputProduct { Order = counter }; result.InputProducts.Add(foundInputProduct); } foundInputProduct.Amount = inputValue; continue; } var matchAmountElectricity = regexInputAmountElectricity.Match(curLine); if (matchAmountElectricity.Success) { var matchedCounter = matchAmountElectricity.Groups["counter"].Value; if (!int.TryParse(matchedCounter, out var counter)) { throw new Exception("could not find counter"); } //handle entry with no value e.g. "|Input 1 Amount Electricity = " var matchedValue = matchAmountElectricity.Groups["value"].Value; if (string.IsNullOrWhiteSpace(matchedValue)) { continue; } if (!double.TryParse(matchedValue, NumberStyles.Number, cultureForParsing, out var inputValue)) { throw new Exception("could not find value for input"); } if (result == null) { result = new ProductionInfo(); } var foundInputProduct = result.InputProducts.FirstOrDefault(x => x.Order == counter); if (foundInputProduct == null) { foundInputProduct = new InputProduct { Order = counter }; result.InputProducts.Add(foundInputProduct); } foundInputProduct.AmountElectricity = inputValue; continue; } var matchIcon = regexInputIcon.Match(curLine); if (matchIcon.Success) { var matchedCounter = matchIcon.Groups["counter"].Value; if (!int.TryParse(matchedCounter, out var counter)) { throw new Exception("could not find counter"); } //handle entry with no value e.g. "|Input 1 Icon = " var matchedFileName = matchIcon.Groups["fileName"].Value; if (string.IsNullOrWhiteSpace(matchedFileName)) { continue; } if (result == null) { result = new ProductionInfo(); } var foundInputProduct = result.InputProducts.FirstOrDefault(x => x.Order == counter); if (foundInputProduct == null) { foundInputProduct = new InputProduct { Order = counter }; result.InputProducts.Add(foundInputProduct); } foundInputProduct.Icon = matchedFileName; continue; } } } } if (result != null) { //order by number from infobox result.InputProducts = result.InputProducts.OrderBy(x => x.Order).ToList(); } return(result); }