public HelpMenu() { Core.Data.Common.FsmState.OnValueChanged += () => CurrentHelpTipIndex.Set(0); IsPreviousTipButtonInteractable = new CalculatedValue <bool>(() => CurrentHelpTipIndex > 0, CurrentHelpTipIndex); IsNextTipButtonInteractable = new CalculatedValue <bool>(() => CurrentHelpTipIndex + 1 < (Core.Data.Localization.CurrentTips.Get()?.Length ?? 0), Core.Data.Localization.CurrentTips, CurrentHelpTipIndex); CurrentTipCounter = new CalculatedValue <string>( () => { int totalTips = 0; if (Core.Data.Common.FsmState.Get() == FSM.States.BattleHelp) { totalTips = Core.Data.Localization.BattleHelpTips.Get().Length; } if (Core.Data.Common.FsmState.Get() == FSM.States.BuildHelp) { totalTips = Core.Data.Localization.BuildHelpTips.Get().Length; } return(string.Format(Core.Data.Localization.TipCounterFormat, CurrentHelpTipIndex + 1, totalTips)); }, Core.Data.Common.FsmState, Core.Data.Localization.BattleHelpTips, Core.Data.Localization.BuildHelpTips, Core.Data.Localization.TipCounterFormat, CurrentHelpTipIndex); CurrentTip = new CalculatedValue <string>( () => Core.Data.Localization.CurrentTips.Get()?[CurrentHelpTipIndex] ?? "", CurrentHelpTipIndex, Core.Data.Localization.CurrentTips); }
public BuildingPicker() { SelectedBuildingGoldCost = new CalculatedValue <int>(() => Core.Data.Balance.GetBuildingGoldCost(SelectedBuildingType), SelectedBuildingType); CurrentBuildingName = new CalculatedValue <string>( () => Core.Data.Localization.BuildingNames.Get()[(int)SelectedBuildingType.Get()], Core.Data.Localization.BuildingNames, SelectedBuildingType); CurrentBuildingPrice = new CalculatedValue <string>( () => Core.Data.Balance.GetBuildingGoldCost(SelectedBuildingType).ToString(), SelectedBuildingType); CurrentBuildingDescription = new CalculatedValue <string>( () => Core.Data.Localization.BuildingDescriptions.Get()[(int)SelectedBuildingType.Get()], Core.Data.Localization.BuildingDescriptions, SelectedBuildingType); }
public LocalizationData() { CurrentTips = new CalculatedValue <string[]>(() => { if (Core.Data.Common.FsmState == States.BattleHelp) { return(BattleHelpTips); } if (Core.Data.Common.FsmState == States.BuildHelp) { return(BuildHelpTips); } return(CurrentTips); }, BattleHelpTips, BuildHelpTips, Core.Data.Common.FsmState); }
/// <summary> /// Сохранить параметр /// </summary> /// <param name="doc">Документ в который сохраняется параметр</param> /// <returns>Узел в котором сохранен параметр</returns> public XmlNode Save(XmlDocument doc) { try { XmlNode root = doc.CreateElement(parameterRoot); XmlNode nameNode = doc.CreateElement(parameterName); XmlNode descNode = doc.CreateElement(descriptionName); XmlNode unitsNode = doc.CreateElement(unitsName); XmlNode alarmNode = doc.CreateElement(alarmValueName); XmlNode blockingNode = doc.CreateElement(blockingValueName); XmlNode controlAlarmNode = doc.CreateElement(controlAlarmName); XmlNode controlBlockingNode = doc.CreateElement(controlBlockingName); XmlNode rangeNode = range.Save(doc); XmlNode isSaveToDBNode = doc.CreateElement(saveToDBName); XmlNode intervalToSaveNode = doc.CreateElement(intervalToSaveName); XmlNode thresholdToBDNode = doc.CreateElement(thresholdToBDName); //XmlNode channelNumberNode = doc.CreateElement(channelNumberName); XmlNode currentValueNode = doc.CreateElement(currentValueName); XmlNode selfIndexNode = doc.CreateElement(selfIndexName); XmlNode guidNode = doc.CreateElement(guidName); XmlNode devManindexNode = doc.CreateElement(devManindexName); XmlNode devManDescriptionNode = doc.CreateElement(devManDescriptionName); XmlNode decimalPointsNode = doc.CreateElement(decimalPointsName); XmlNode transformationNode = null; if (transformation != null) { transformationNode = transformation.CreateXmlNode(doc); } nameNode.InnerText = Name; descNode.InnerText = Description; unitsNode.InnerText = Units; alarmNode.InnerText = Alarm.ToString(); blockingNode.InnerText = Blocking.ToString(); controlAlarmNode.InnerText = IsControlAlarm.ToString(); controlBlockingNode.InnerText = IsControlBlocking.ToString(); isSaveToDBNode.InnerText = SaveToDB.ToString(); intervalToSaveNode.InnerText = IntervalToSaveToDB.ToString(); thresholdToBDNode.InnerText = ThresholdToBD.ToString(); //channelNumberNode.InnerText = channelNumber.ToString(); currentValueNode.InnerText = CalculatedValue.ToString(); //selfIndexNode.InnerText = selfIndex.ToString(); guidNode.InnerText = identifier.ToString(); devManindexNode.InnerText = devManindex.ToString(); devManDescriptionNode.InnerText = devManDescription; decimalPointsNode.InnerText = decimalPoints.ToString(); root.AppendChild(nameNode); root.AppendChild(descNode); root.AppendChild(unitsNode); root.AppendChild(alarmNode); root.AppendChild(blockingNode); root.AppendChild(controlAlarmNode); root.AppendChild(controlBlockingNode); if (rangeNode != null) { root.AppendChild(rangeNode); } root.AppendChild(isSaveToDBNode); root.AppendChild(intervalToSaveNode); root.AppendChild(thresholdToBDNode); //root.AppendChild(channelNumberNode); root.AppendChild(currentValueNode); //root.AppendChild(selfIndexNode); root.AppendChild(devManindexNode); root.AppendChild(devManDescriptionNode); root.AppendChild(decimalPointsNode); root.AppendChild(guidNode); if (transformationNode != null) { root.AppendChild(transformationNode); } return(root); } catch { } return(null); }
public GameData() { IsArrowForceOverThreshold = new CalculatedValue <bool>(() => ClampedArrowForce >= Core.Data.Balance.ArrowForceThreshold, ClampedArrowForce, Core.Data.Balance.ArrowForceThreshold); }
public string Visit(CalculatedValue value) { return(HtmlGenerator.CreateHtmlAttr(value.Attribute, 5.ToString())); }
public CastleMenu() { CastleUpgradeCost = new CalculatedValue <int>(() => Core.Data.Balance.GetCastleUpgradeCost(Core.Data.Saved.VillageLevel), Core.Data.Saved.VillageLevel); }