/// <summary> /// Imports records from source database to target database/template /// </summary> /// <param name="selectedNids"></param> /// <param name="allSelected">Set true to import all records</param> public override void ImportValues(List <string> selectedNids, bool allSelected) { UnitBuilder UnitBuilderObj = new UnitBuilder(this._TargetDBConnection, this._TargetDBQueries); UnitInfo SourceDBUnit; DataRow Row; int ProgressBarValue = 0; foreach (string Nid in selectedNids) { try { //get unit from source table Row = this.SourceTable.Select(Unit.UnitNId + "=" + Nid)[0]; SourceDBUnit = new UnitInfo(); SourceDBUnit.Name = DICommon.RemoveQuotes(Row[Unit.UnitName].ToString()); SourceDBUnit.GID = Row[Unit.UnitGId].ToString(); SourceDBUnit.Global = Convert.ToBoolean(Row[Unit.UnitGlobal]); SourceDBUnit.Nid = Convert.ToInt32(Row[Unit.UnitNId]); //import into target database UnitBuilderObj.ImportUnit(SourceDBUnit, SourceDBUnit.Nid, this.SourceDBQueries, this.SourceDBConnection); } catch (Exception ex) { ExceptionFacade.ThrowException(ex); } this.RaiseIncrementProgessBarEvent(ProgressBarValue); ProgressBarValue++; } }
public void handleClick() { if (Input.GetMouseButtonUp(0) && this.isSpaceFree()) { // Pick the builder to use. UnitBuilder builder = Util.closestToPoint(this.transform.position, this.cachedBuilders, (entity) => { return(entity.isTaskCancelable()); }); if (builder != null) { this.player.sendMessageToServer(new MessageConstructBuilding( this.player.getTeam(), this.buildingToPlace, new Vector3(this.transform.position.x, this.transform.position.y), builder)); this.disableOutline(); } } if (Input.GetKeyDown(KeyCode.Escape)) { this.disableOutline(); } }
public void Composites() { var metaPopulation = new MetaPopulation(); var domain = new Domain(metaPopulation, Guid.NewGuid()); var superdomain = new Domain(metaPopulation, Guid.NewGuid()); domain.AddDirectSuperdomain(superdomain); Assert.AreEqual(0, metaPopulation.Composites.Count()); var @class = new ClassBuilder(domain, Guid.NewGuid()).WithSingularName("Class").WithPluralName("Classes").Build(); Assert.AreEqual(1, metaPopulation.Composites.Count()); var superclass = new ClassBuilder(superdomain, Guid.NewGuid()).WithSingularName("Superclass").WithPluralName("Superclasses").Build(); Assert.AreEqual(2, metaPopulation.Composites.Count()); var @interface = new InterfaceBuilder(domain, Guid.NewGuid()).WithSingularName("i1").WithPluralName("i1s").Build(); Assert.AreEqual(3, metaPopulation.Composites.Count()); var superinterface = new InterfaceBuilder(superdomain, Guid.NewGuid()).WithSingularName("i2").WithPluralName("i2s").Build(); Assert.AreEqual(4, metaPopulation.Composites.Count()); var unit = new UnitBuilder(domain, UnitIds.StringId).WithSingularName("AllorsString").WithPluralName("AllorsStrings").WithUnitTag(UnitTags.AllorsString).Build(); Assert.AreEqual(4, metaPopulation.Composites.Count()); var superunit = new UnitBuilder(domain, UnitIds.IntegerId).WithSingularName("AllorsInteger").WithPluralName("AllorsIntegers").WithUnitTag(UnitTags.AllorsString).Build(); Assert.AreEqual(4, metaPopulation.Composites.Count()); }
List <string> GetSavedUnitNames() { m_unitBuilder = GetComponent <UnitBuilder>(); string fullSaveDirectory = Directory.GetCurrentDirectory() + m_unitSaveFolder; return(new List <string>(Directory.GetFiles(fullSaveDirectory))); }
private IEnumerable <Unit> SetupPlayerTeam() { yield return(UnitBuilder.Create() .WithId(UnitIdPool.AllocateInstance()) .WithName("Gooch") .WithFaction(FactionTypes.Player) .WithClass(ClassLookups.Fighter) .WithInitiative(6) .WithPosition(3, 2) .Build()); yield return(UnitBuilder.Create() .WithId(UnitIdPool.AllocateInstance()) .WithName("Kate") .WithFaction(FactionTypes.Player) .WithClass(ClassLookups.Priest) .WithInitiative(6) .WithPosition(1, 1) .Build()); yield return(UnitBuilder.Create() .WithId(UnitIdPool.AllocateInstance()) .WithName("Le Grandé Tudge") .WithFaction(FactionTypes.Player) .WithClass(ClassLookups.Rogue) .WithInitiative(6) .WithWeapon(ItemTemplateLookups.DeadlySosig) .WithPosition(1, 4) .Build()); }
public void BuyItemOrEquip(int id) { DataPassing.Instance.mGoldConsumeCallBack = () => { AddInventory(id); }; eShopItemType type = TransformIDtoEnum(id); switch (type) { case eShopItemType.Consume: DataPassing.Instance.Gold -= mItemDataArr[id - 11].Cost; break; case eShopItemType.Equip: DataPassing.Instance.Gold -= mEquipDataArr[id - 21].Cost; break; default: Debug.LogError("Wrong Item or Equip type : " + type); break; } mGoldText.text = "Gold : " + UnitBuilder.GetUnitStr(DataPassing.Instance.Gold); }
// Use this for initialization void Start() { GameObject gameUtils = GameObject.Find("GameUtils"); m_saveLoadHandler = gameUtils.GetComponent <SaveLoadHandler>(); m_unitBuilder = gameUtils.GetComponent <UnitBuilder>(); List <ModuleTypeMap> modulePrefabs = new List <ModuleTypeMap>(m_unitBuilder.m_modulePrefabs); List <Dropdown.OptionData> options = new List <Dropdown.OptionData>(); // Add all hulls to menu (this seems possibly silly) options.Add(new Dropdown.OptionData()); foreach (ModuleTypeMap modulePair in modulePrefabs) { string moduleName = modulePair.prefab.name; if (moduleName.ToLower().Contains("hull")) { options.Add(new Dropdown.OptionData(moduleName)); } } m_hullDropDown.ClearOptions(); m_hullDropDown.AddOptions(options); m_hullDropDown.onValueChanged.AddListener(delegate { HullSelected(m_hullDropDown); }); m_moduleDropdown.ClearOptions(); m_moduleDropdown.onValueChanged.AddListener(delegate { ModuleSelected(m_moduleDropdown); }); m_saveButton.onClick.AddListener(delegate { SaveToFile(); }); //m_loadButton.onClick.AddListener(delegate { LoadFromFile(); }); }
public void Renew(string contents, string purchaseText, int level, double value, double cost, double time, eValueType valuetype = eValueType.Exp) { string valueStr = ""; switch (valuetype) { case eValueType.Percent: valueStr = (value * 100).ToString("N0") + "%"; break; case eValueType.Numeric: case eValueType.Exp: valueStr = UnitBuilder.GetUnitStr(value); break; default: Debug.LogError("Wrong Value type" + valuetype); break; } mContentsText.text = string.Format(contents, valueStr, time.ToString("N1")); mCostText.text = UnitBuilder.GetUnitStr(cost); mPurchaseText.text = purchaseText; mLevelText.text = "LV." + level.ToString("N0"); }
private static Unit getUnit() { UnitBuilder ub = new UnitBuilder(); ub.SetRequiredParameters(UnitType.Human, "Raider", 75, 20, 20, new LAS.Range(100, 150), 1.2f); return(ub.GetUnit()); }
private static Unit getUnit() { UnitBuilder ub = new UnitBuilder(); ub.SetRequiredParameters(UnitType.Mutant, "FatMan", 500, 25, 25, new LAS.Range(450, 600), 0.8f); return(ub.GetUnit()); }
public void ShowPlayerGaugeBar(double current, double max) { float progress = (float)(current / max); string gaugetext = string.Format("{0} / {1}", UnitBuilder.GetUnitStr(current), UnitBuilder.GetUnitStr(max)); mPlayerGaugeBar.ShowHPGauge(progress, gaugetext); }
/// <summary> /// Inserts IUS into database /// </summary> /// <param name="indicatorGId"></param> /// <param name="unitGId"></param> /// <param name="subgroupGId"></param> /// <returns></returns> public int InsertIUSIntoDB(string indicatorGId, string unitGId, string subgroupGId) { int RetVal = -1; IndicatorBuilder IndicatorBuilderObj = new IndicatorBuilder(this.DBConnection, this.DBQueries); UnitBuilder UnitBuilderObj = new UnitBuilder(this.DBConnection, this.DBQueries); DI6SubgroupValBuilder SGBuilder = new DI6SubgroupValBuilder(this.DBConnection, this.DBQueries); IUSBuilder IUSObj = new IUSBuilder(this.DBConnection, this.DBQueries); int IndicatorNID = -1; int UnitNID = -1; int SubgroupValNID = -1; try { IndicatorNID = IndicatorBuilderObj.GetIndicatorNid(indicatorGId, string.Empty); UnitNID = UnitBuilderObj.GetUnitNid(unitGId, string.Empty); SubgroupValNID = SGBuilder.GetSubgroupValNid(subgroupGId, string.Empty); if (IndicatorNID > 0 & UnitNID > 0 & SubgroupValNID > 0) { RetVal = IUSObj.InsertIUS(IndicatorNID, UnitNID, SubgroupValNID, 0, 0); } } catch (Exception ex) { throw new ApplicationException(ex.ToString()); } return(RetVal); }
public void Units() { var metaPopulation = new MetaPopulation(); var domain = new Domain(metaPopulation, Guid.NewGuid()); var superdomain = new Domain(metaPopulation, Guid.NewGuid()); domain.AddDirectSuperdomain(superdomain); Assert.AreEqual(0, metaPopulation.Units.Count()); var unit = new UnitBuilder(domain, UnitIds.StringId).WithSingularName("AllorsString").WithPluralName("AllorsStrings").WithUnitTag(UnitTags.AllorsString).Build(); Assert.AreEqual(1, metaPopulation.Units.Count()); var superunit = new UnitBuilder(domain, UnitIds.IntegerId).WithSingularName("AllorsInteger").WithPluralName("AllorsIntegers").WithUnitTag(UnitTags.AllorsInteger).Build(); Assert.AreEqual(2, metaPopulation.Units.Count()); var @class = new ClassBuilder(domain, Guid.NewGuid()).WithSingularName("Class").WithPluralName("Classes").Build(); Assert.AreEqual(2, metaPopulation.Units.Count()); var superclass = new ClassBuilder(superdomain, Guid.NewGuid()).WithSingularName("Superclass").WithPluralName("Superclasses").Build(); Assert.AreEqual(2, metaPopulation.Units.Count()); var @interface = new InterfaceBuilder(domain, Guid.NewGuid()).WithSingularName("i1").WithPluralName("i1s").Build(); Assert.AreEqual(2, metaPopulation.Units.Count()); var superinterface = new InterfaceBuilder(superdomain, Guid.NewGuid()).WithSingularName("i2").WithPluralName("i2s").Build(); Assert.AreEqual(2, metaPopulation.Units.Count()); }
public void Build_IncludedInnerWorkflowWithArguments_EnsureOutputType() { var workflowBuilder = LoadEmbeddedWorkflow("IncludeWorkflowInner.bonsai"); var unitArgument = new UnitBuilder().Build(); var result = workflowBuilder.Workflow.Build(unitArgument); Assert.AreEqual(unitArgument.Type, result.Type); }
public void Renew(string contents, string purchaseText, int level, double value, double cost, double time) { mLevelText.text = "LV. " + level.ToString(); mContentsText.text = string.Format(contents, UnitBuilder.GetUnitStr(value), time.ToString("N1")); mCostText.text = UnitBuilder.GetUnitStr(cost); mPurchaseText.text = purchaseText; }
private static Unit getUnit() { UnitBuilder ub = new UnitBuilder(); ub.SetRequiredParameters(UnitType.Mutant, "Savage", 150, 25, 15, new LAS.Range(150, 200), 1.0f); ub.SetMelee(); return(ub.GetUnit()); }
/// <summary> /// Returns true if the object was destroyed. /// </summary> public virtual bool harvest(UnitBuilder builder) { int remainingSpace = builder.getHoldLimit() - builder.getHeldResources(); int amountToHarvest = Mathf.Min(builder.collectPerStrike, remainingSpace); this.map.transferResources(builder.getTeam(), amountToHarvest); // Extra is discarded. return(this.damage(builder, amountToHarvest)); }
/// <summary> /// Returns true if the object was destroyed. /// </summary> public virtual bool harvest(UnitBuilder builder) { int remainingSpace = Constants.BUILDER_MAX_CARRY - builder.getHeldResources(); int amountToHarvest = Mathf.Min(Constants.BUILDER_COLLECT_PER_STRIKE, remainingSpace); builder.increaseResources(amountToHarvest); return(this.damage(builder, amountToHarvest)); }
public IUSBuilder(DIConnection connection, DIQueries queries) { this.DBConnection = connection; this.DBQueries = queries; this.DIIndicator = new IndicatorBuilder(connection, queries); this.DIUnit = new UnitBuilder(connection, queries); this.DISubgroupVal = new DI6SubgroupValBuilder(connection, queries); DIConnection.ConnectionType = this.DBConnection.ConnectionStringParameters.ServerType; }
public override void Import(string selectedNids) { DataTable Table = null; int ProgressCounter = 0; UnitBuilder TrgUnitBuilderObj = null; UnitBuilder SourceUnitBuilderObj = null; UnitInfo SrcUnitInfoObj = null; DIConnection SourceDBConnection = null; DIQueries SourceDBQueries = null; //-- Step 1: Get TempTable with Sorted SourceFileName Table = this._TargetDBConnection.ExecuteDataTable(this.ImportQueries.GetImportUnits(selectedNids)); //-- Step 2:Initialise Indicator Builder with Target DBConnection TrgUnitBuilderObj = new UnitBuilder(this.TargetDBConnection, this.TargetDBQueries); // Initialize progress bar this.RaiseProgressBarInitialize(selectedNids.Split(',').GetUpperBound(0) + 1); //-- Step 3: Import Nids for each SourceFile foreach (DataRow Row in Table.Copy().Rows) { try { string SourceFileWPath = Convert.ToString(Row[MergetTemplateConstants.Columns.COLUMN_SOURCEFILENAME]); SourceDBConnection = new DIConnection(DIServerType.MsAccess, String.Empty, String.Empty, SourceFileWPath, String.Empty, MergetTemplateConstants.DBPassword); SourceDBQueries = DataExchange.GetDBQueries(SourceDBConnection); SourceUnitBuilderObj = new UnitBuilder(SourceDBConnection, SourceDBQueries); SrcUnitInfoObj = SourceUnitBuilderObj.GetUnitInfo(FilterFieldType.NId, Convert.ToString(Row[MergetTemplateConstants.Columns.COLUMN_SRCNID])); // Import Unit from Source TrgUnitBuilderObj.ImportUnit(SrcUnitInfoObj, Convert.ToInt32(Row[MergetTemplateConstants.Columns.COLUMN_SRCNID]), SourceDBQueries, SourceDBConnection); ProgressCounter += 1; this.RaiseProgressBarIncrement(ProgressCounter); } catch (Exception ex) { ExceptionFacade.ThrowException(ex); } finally { if (SourceDBConnection != null) { SourceDBConnection.Dispose(); } if (SourceDBQueries != null) { SourceDBQueries.Dispose(); } } } this._AvailableTable = this.GetAvailableTable(); this._UnmatchedTable = this.GetUnmatchedTable(); // Close ProgressBar this.RaiseProgressBarClose(); }
public void Build_CombinatorTransformError_ThrowsRuntimeException() { var source = new UnitBuilder(); var combinator = new TransformErrorCombinator(); var builder = new CombinatorBuilder { Combinator = combinator }; RunInspector(source, builder); }
#pragma warning restore public void Init(int id, string name, double hpcurrent, double hpmax, double atk, double def, double heal, StaticValue.OneIntParameter callback) { mNameText.text = name; mHPText.text = "HP : " + string.Format("{0}/{1}", UnitBuilder.GetUnitStr(hpcurrent), UnitBuilder.GetUnitStr(hpmax)); mAtkText.text = "Atk : " + UnitBuilder.GetUnitStr(atk); mDefText.text = "Def : " + UnitBuilder.GetUnitStr(def); mHealText.text = "Heal : " + UnitBuilder.GetUnitStr(heal); mApplyButton.onClick.AddListener(() => { callback(id); }); }
//////////////////////////////////////////////// //////////////////////////////////////////////// void Awake() { if (_instance != null && _instance != this) { Destroy(gameObject); } else { _instance = this; } }
public void ShowPlayerInfo(eBattleType state, double atk, double def, double heal, double hpCurrent, double hpMax, int conditionCurrent) { mPlayerInfoObj.SetActive(true); mPlayerInfoText[0].text = state.ToString(); mPlayerInfoText[1].text = "ATK : " + UnitBuilder.GetUnitStr(atk); mPlayerInfoText[2].text = "DEF : " + UnitBuilder.GetUnitStr(def); mPlayerInfoText[3].text = "HEAL : " + UnitBuilder.GetUnitStr(heal); mPlayerInfoText[4].text = string.Format("HP : {0}/{1}", UnitBuilder.GetUnitStr(hpCurrent), UnitBuilder.GetUnitStr(hpMax)); mPlayerInfoText[5].text = string.Format("Field : {0}", conditionCurrent); }
public void ShowProgress(double current, double max) { //TODO calc GuageBar progress float value float progress = (float)(current / max); //hack Build Gauge progress string //string progressString = progress.ToString("P0"); string progressString = string.Format("{0} / {1}", UnitBuilder.GetUnitStr(current), UnitBuilder.GetUnitStr(max)); mProgressBar.ShowGaugeBar(progress, progressString); }
/// <summary> /// Load a Unit item at selected path. /// </summary> /// <param name="UnitPath">Path from which to open the Unit.</param> private void LoadUnit(string UnitPath) { string Name = UnitPath.Substring(0, UnitPath.Length - 4).Substring(21); UnitBuilder NewUnit = new UnitBuilder(Name, null, DicUnitType, DicRequirement, DicEffect); txtOriginalUnit.Text = NewUnit.OriginalUnitName; for (int U = 0; U < NewUnit.ListUnitToBuild.Count; ++U) { lstUnits.Items.Add(NewUnit.ListUnitToBuild[U]); } }
/// <summary> /// Determines whether the specified value is within the interval. /// </summary> /// <typeparam name="TQuantity">The type of the quantity.</typeparam> /// <typeparam name="TUnitSelector">The type of the unit selector.</typeparam> /// <param name="quantity">The quantity.</param> /// <param name="min">The minimum.</param> /// <param name="max">The maximum.</param> /// <param name="unitSelector">The unit selector.</param> /// <param name="intervalMode">The interval mode.</param> /// <returns> /// <c>true</c> if the specified quantity is within the interval, otherwise <c>false</c>. /// </returns> public static bool IsWithin <TQuantity, TUnitSelector>( this IQuantity <TQuantity, TUnitSelector> quantity, double min, double max, SelectUnit <TUnitSelector> unitSelector, IntervalMode intervalMode = IntervalMode.Inclusive) where TQuantity : IQuantity { var unit = UnitBuilder.BuildUnit(unitSelector(quantity.CreateUnitSelector())); return(quantity.ToDouble(unit).IsWithinInterval(min, max, intervalMode)); }
// Use this for initialization void Start() { GameObject gameUtils = GameObject.Find("GameUtils"); m_saveLoadHandler = gameUtils.GetComponent <SaveLoadHandler>(); m_unitBuilder = gameUtils.GetComponent <UnitBuilder>(); string unitToLoad = m_thisUnit.ToString(); SavedModule savedUnit = m_saveLoadHandler.M_LoadUnitFromFile(unitToLoad); GameObject spawnedUnit = m_unitBuilder.M_BuildUnit(savedUnit, transform); spawnedUnit.GetComponent <BaseUnit>().m_alignment = m_alignment; }
public LevelEnemyUnitSetupProcessor(AgentFactory agentFactory, IItemTemplateRepository itemTemplateRepository, IRandomizer randomizer, IUnitIdPool unitIdPool, UnitBuilder unitBuilder, IAbilityRepository abilityRepository, ISpellRepository spellRepository, ICardEffectsRepository cardEffectsRepository) { AgentFactory = agentFactory; ItemTemplateRepository = itemTemplateRepository; Randomizer = randomizer; UnitIdPool = unitIdPool; UnitBuilder = unitBuilder; AbilityRepository = abilityRepository; SpellRepository = spellRepository; CardEffectsRepository = cardEffectsRepository; GlobalLootTable = GenerateLootTable(); }
/// <summary> /// Called to enable the outline effect. /// </summary> public void enableOutline(RegisteredObject registeredBuilding, UnitBuilder builder) { // Note, this could be called multiple times if multiple builders are in the same party. this.gameObject.SetActive(true); this.buildingToPlace = registeredBuilding; this.cachedBuilders.Add(builder); this.setSize(this.buildingToPlace.getPrefab().GetComponent <BuildingBase>()); // Gray out the action buttons while the outline is being shown. CameraMover.instance().actionButtons.setForceDisabled(true); }
public UnitsController() { _unitsData = Resources.LoadAll <UnitScriptable>(PathConstants.UnitsDataPath).ToList(); //_unitsCaps = Resources.LoadAll<LevelCapsScriptable>(PathConstants.UnitsDataPath).First(); _unitsDictionary = new Dictionary <string, UnitObject>(); var builder = new UnitBuilder(); foreach (var data in _unitsData) { var unit = builder.Create(data); _unitsDictionary.Add(unit.Key, unit); } }
public void Awake() { if (get == null) { get = this; } else { if (get != this) { Destroy(this); } } if (allowBuildAll) { unitsAvailbleToPlayer.AddRange(unitPrefabs); } }
// Use this for initialization void Awake() { stats = this.gameObject.GetComponent<IRtsUnit>(); builder = this.gameObject.GetComponent<UnitBuilder>(); }