Example #1
0
    protected override void Awake()
    {
        base.Awake();
        era        = Eras.StoneAge;
        namesArray = new string[] { "Nature", "Stick", "The Wheel" };
        chronologicalOrderArray = new int[] { 5, 1, 8 };
        methodArray             = new UnityEngine.Events.UnityAction[] { delegate { Nature(); }, delegate { Stick(); }, delegate { Wheel(); } };
        costVariablesList.Add(natureCostArray);
        costVariablesList.Add(stickCostArray);
        costVariablesList.Add(wheelCostArray);
        rewardVariablesDickList.Add(new Dictionary <StatsType, float[]> {
            { StatsType.NotSetYet, natureRewardArray }
        });
        rewardVariablesDickList.Add(new Dictionary <StatsType, float[]> {
            { StatsType.NotSetYet, stickRewardArray }
        });
        rewardVariablesDickList.Add(new Dictionary <StatsType, float[]> {
            { StatsType.ResourceStats, wheelMainRewardArray }, { StatsType.MobileStats, wheelSecondaryRewardArray }
        });
        messageArray = new string[]
        {
            "-Unlocks: Nature Monument",

            "-Unlocks: Stick Monument",

            "-Decreases the Gathering Times at your Gold Mines and Lumberyards" +
            "\n-Increase Movement Speed of Siege Weapons for All Species" +
            "\n-Unlocks: " + MonumentSelectionMenu.monSpecNameDick[SpecType.Wheel] +
            "\n-Disables: " + MonumentSelectionMenu.monSpecNameDick[SpecType.Fire]
        };
        specTypeArray = new SpecType[] { SpecType.Nature, SpecType.Stick, SpecType.Wheel };
    }
Example #2
0
        public override void Build(nspec unused = null)
        {
            BuildMethodLevelBefore();

            BuildMethodLevelBeforeAll();

            BuildMethodLevelAct();

            BuildMethodLevelAfter();

            BuildMethodLevelAfterAll();

            try
            {
                var nspec = SpecType.CreateInstanceAs <nspec>();

                nspec.tagsFilter = tagsFilter ?? new Tags();

                base.Build(nspec);
            }
            catch (Exception ex)
            {
                cantCreateInstance = true;

                AddFailingExample(ex);
            }
        }
Example #3
0
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as ProductionSpecificationComponent;

                if (dest != null)
                {
                    base.CopyTo(dest);
                    if (SpecType != null)
                    {
                        dest.SpecType = (Hl7.Fhir.Model.CodeableConcept)SpecType.DeepCopy();
                    }
                    if (ComponentId != null)
                    {
                        dest.ComponentId = (Hl7.Fhir.Model.Identifier)ComponentId.DeepCopy();
                    }
                    if (ProductionSpecElement != null)
                    {
                        dest.ProductionSpecElement = (Hl7.Fhir.Model.FhirString)ProductionSpecElement.DeepCopy();
                    }
                    return(dest);
                }
                else
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }
            }
Example #4
0
        public override void Build(nspec unused = null)
        {
            BeforeAllChain.BuildMethodLevel(classHierarchy);

            BeforeChain.BuildMethodLevel(classHierarchy);

            ActChain.BuildMethodLevel(classHierarchy);

            AfterChain.BuildMethodLevel(classHierarchy);

            AfterAllChain.BuildMethodLevel(classHierarchy);

            try
            {
                var nspec = SpecType.CreateInstanceAs <nspec>();

                nspec.tagsFilter = tagsFilter ?? new Tags();

                base.Build(nspec);
            }
            catch (Exception ex)
            {
                cantCreateInstance = true;

                AddFailingExample(ex);
            }
        }
 public void SelectMonument(Button selectionButton, SpecType monSpecType, int popCost)
 {
     if (buttonIsSelected[selectionButton])
     {
         if ((int)selectedMonument.population >= popCost && (int)Pop_Dynamics_Model.modelStatsDick[selectedMonument.GetSpecies()][StatsType.Population] > popCost)
         {
             Pop_Dynamics_Model.modelStatsDick [GameManager.HumanPlayer.species][StatsType.Population] -= popCost;
             selectedMonument.ChangeLocalPopulation(-popCost);
             selectedMonument.SetMonumentType(monSpecType);
             gameObject.SetActive(false);
             GameManager.Hud.ClosePanel();
         }
         else if ((int)selectedMonument.population >= popCost)
         {
             HUD.StartChangeTextColorToRed(new Text[] { monSelectionPanel.popText, GameManager.Hud.populationText });
         }
         else
         {
             HUD.StartChangeTextColorToRed(new Text[] { monSelectionPanel.popText, GameManager.Hud.Infotext.popText });
         }
         buttonIsSelected[selectionButton] = false;
     }
     else
     {
         for (int i = 0; i < monSelectionPanel.selectionButtons.Length; i++)
         {
             buttonIsSelected[monSelectionPanel.selectionButtons[i]] = false;
         }
         buttonIsSelected[selectionButton] = true;
         StartCoroutine(HighLightSelectionButton(selectionButton));
     }
 }
        public static List <UserAccount> GetSpec(SpecType spec)
        {
            IEnumerable <UserAccount> result = null;

            switch (spec)
            {
            case SpecType.DPS:
                result = from a in accounts
                         where a.MainSpec.ToLower() == "dps"
                         select a;
                break;

            case SpecType.Healer:
                result = from a in accounts
                         where a.MainSpec.ToLower() == "healer"
                         select a;
                break;

            case SpecType.Tank:
                result = from a in accounts
                         where a.MainSpec.ToLower() == "tank"
                         select a;
                break;

            default:
                break;
            }
            return(result.ToList());
        }
Example #7
0
    protected override void Awake()
    {
        base.Awake();
        era        = Eras.StoneAge;
        namesArray = new string[] { "Sun", "Rock", "Fire" };
        chronologicalOrderArray = new int[] { 5, 1, 2 };
        disasterNamesArray      = new string[] { "", "", "" };
        methodArray             = new UnityEngine.Events.UnityAction[] { delegate { Sun(); }, delegate { Rock(); }, delegate { Fire(); } };
        costVariablesList.Add(sunCostArray);
        costVariablesList.Add(rockCostArray);
        costVariablesList.Add(fireCostArray);
        rewardVariablesDickList.Add(new Dictionary <StatsType, float[]> {
            { StatsType.NotSetYet, sunRewardArray }
        });
        rewardVariablesDickList.Add(new Dictionary <StatsType, float[]> {
            { StatsType.Defense, rockRewardArray }
        });
        rewardVariablesDickList.Add(new Dictionary <StatsType, float[]> {
            { StatsType.Attack, mainFireRewardArray }, { StatsType.ProtectionRates, secondaryFireRewardArray }
        });;
        messageArray = new string[]
        {
            "-Unlocks Monument: Sun Monument",

            "-Unlocks: Quarry",

            "-Increases the Attack Damage of your Incendiary Units" +
            "\n-Increases the Protection level for Sheep, Bunnies, and Deer" +
            "\n-Unlocks: " + MonumentSelectionMenu.monSpecNameDick[SpecType.Fire] +
            "\n-Disables: " + MonumentSelectionMenu.monSpecNameDick[SpecType.Wheel]
        };
        specTypeArray = new SpecType[] { SpecType.Sun, SpecType.Rock, SpecType.Fire };
    }
        public ActionResult DeleteConfirmed(int id)
        {
            SpecType specType = db.specTypes.Find(id);

            db.specTypes.Remove(specType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public void CheckBinaryOperations(string op, SpecType expected)
        {
            var binary = new BinaryOperation (op, new NumberLiteral (1), new NumberLiteral (2));

            var type = binary.Walk (new TypeChecker ());

            Assert.AreEqual (expected, type.Type);
        }
Example #10
0
 public void OpenPanel(UnoccupiedMonument newMonument)
 {
     if (newMonument.GetPlayer().unlockedMonumentsDick[newMonument.era].Count < 2)
     {
         popImage.gameObject.SetActive(true);
         popText.gameObject.SetActive(true);
         popImage.sprite = HUD.speciesPopSpriteDick[newMonument.GetSpecies()];
         otherTexts [2].rectTransform.anchorMin = new Vector2(0f, 0.55f);
         otherTexts [2].rectTransform.anchorMax = new Vector2(1f, 0.65f);
         if (newMonument.GetPlayer().unlockedMonumentsDick[newMonument.era].Count == 0)
         {
             otherTexts [1].rectTransform.anchorMin = new Vector2(0f, 0.65f);
             otherTexts [1].rectTransform.anchorMax = new Vector2(1f, 0.9f);
             for (int i = 0; i < selectionButtons.Length; i++)
             {
                 selectionButtons[i].GetComponent <RectTransform>().anchorMin = new Vector2(0.15f, 0.25f - i * 0.2f);
                 selectionButtons[i].GetComponent <RectTransform>().anchorMax = new Vector2(0.85f, 0.4f - i * 0.2f);
                 AddSelectMonumentListener(newMonument, selectionButtons[i], monSelectionMenu.lockedPopCost);
             }
         }
         else
         {
             otherTexts[1].gameObject.SetActive(false);
             for (int i = 0; i < selectionButtons.Length; i++)
             {
                 SpecType monumentSpec = MonumentSelectionMenu.speciesMonumentTypeDick[newMonument.GetSpecies()][newMonument.era][selectionButtons[i].GetComponentInChildren <Text>().text];
                 if (newMonument.GetPlayer().unlockedMonumentsDick[newMonument.era].Contains(monumentSpec))
                 {
                     selectionButtons[i].GetComponent <RectTransform>().anchorMin = new Vector2(0.15f, 0.7f);
                     selectionButtons[i].GetComponent <RectTransform>().anchorMax = new Vector2(0.85f, 0.85f);
                     AddSelectMonumentListener(newMonument, selectionButtons[i], 0);
                 }
                 else
                 {
                     selectionButtons[i].GetComponent <RectTransform>().anchorMin = new Vector2(0.15f, 0.25f);
                     selectionButtons[i].GetComponent <RectTransform>().anchorMax = new Vector2(0.85f, 0.4f);
                     AddSelectMonumentListener(newMonument, selectionButtons[i], monSelectionMenu.lockedPopCost);
                 }
             }
         }
     }
     else
     {
         popImage.gameObject.SetActive(false);
         popText.gameObject.SetActive(false);
         for (int i = 0; i < selectionButtons.Length; i++)
         {
             selectionButtons[i].GetComponent <RectTransform>().anchorMin = new Vector2(0.15f, 0.7f - i * 0.2f);
             selectionButtons[i].GetComponent <RectTransform>().anchorMax = new Vector2(0.85f, 0.85f - i * 0.2f);
             AddSelectMonumentListener(newMonument, selectionButtons[i], 0);
         }
         otherTexts[2].rectTransform.anchorMax = new Vector2(1f, 0.4f);
         otherTexts[2].rectTransform.anchorMin = new Vector2(0f, 0.3f);
         otherTexts[1].text = "None";
         otherTexts[1].rectTransform.anchorMax = new Vector2(1f, 0.3f);
         otherTexts[1].rectTransform.anchorMin = new Vector2(0f, 0.1f);
     }
 }
        /// <summary>
        /// Create and add <see cref="AttributeDefinition"/>s to a <see cref="SpecType"/>
        /// </summary>
        /// <param name="specType">
        /// The <see cref="SpecType"/> to add the <see cref="AttributeDefinition"/>s to
        /// </param>
        /// <param name="reqIfContent">
        /// An instance of <see cref="ReqIFContent"/>
        /// </param>
        private void CreateAndAddAttributeDefinitionsToSpecType(SpecType specType, ReqIFContent reqIfContent)
        {
            var attributeDefinitionBoolean = new AttributeDefinitionBoolean();

            attributeDefinitionBoolean.LongName   = "boolean attribute";
            attributeDefinitionBoolean.Identifier = "specification-boolean-attribute";
            attributeDefinitionBoolean.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionBoolean.Type       = (DatatypeDefinitionBoolean)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionBoolean));
            specType.SpecAttributes.Add(attributeDefinitionBoolean);

            var attributeDefinitionDate = new AttributeDefinitionDate();

            attributeDefinitionDate.LongName   = "date attribute";
            attributeDefinitionDate.Identifier = "specification-date-attribute";
            attributeDefinitionDate.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionDate.Type       = (DatatypeDefinitionDate)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionDate));
            specType.SpecAttributes.Add(attributeDefinitionDate);

            var attributeDefinitionEnumeration = new AttributeDefinitionEnumeration();

            attributeDefinitionEnumeration.LongName   = "enumeration attribute";
            attributeDefinitionEnumeration.Identifier = "specification-enumeration-attribute";
            attributeDefinitionEnumeration.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionEnumeration.Type       = (DatatypeDefinitionEnumeration)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionEnumeration));
            specType.SpecAttributes.Add(attributeDefinitionEnumeration);

            var attributeDefinitionInteger = new AttributeDefinitionInteger();

            attributeDefinitionInteger.LongName   = "integer attribute";
            attributeDefinitionInteger.Identifier = "specification-integer-attribute";
            attributeDefinitionInteger.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionInteger.Type       = (DatatypeDefinitionInteger)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionInteger));
            specType.SpecAttributes.Add(attributeDefinitionInteger);

            var attributeDefinitionReal = new AttributeDefinitionReal();

            attributeDefinitionReal.LongName   = "real attribute";
            attributeDefinitionReal.Identifier = "specification-real-attribute";
            attributeDefinitionReal.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionReal.Type       = (DatatypeDefinitionReal)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionReal));
            specType.SpecAttributes.Add(attributeDefinitionReal);

            var attributeDefinitionString = new AttributeDefinitionString();

            attributeDefinitionString.LongName   = "string attribute";
            attributeDefinitionString.Identifier = "specification-string-attribute";
            attributeDefinitionString.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionString.Type       = (DatatypeDefinitionString)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionString));
            specType.SpecAttributes.Add(attributeDefinitionString);

            var attributeDefinitionXhtml = new AttributeDefinitionXHTML();

            attributeDefinitionXhtml.LongName   = "xhtml attribute";
            attributeDefinitionXhtml.Identifier = "specification-xhtml-attribute";
            attributeDefinitionXhtml.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionXhtml.Type       = (DatatypeDefinitionXHTML)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionXHTML));
            specType.SpecAttributes.Add(attributeDefinitionXhtml);
        }
Example #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SpecTypeMap"/> class
        /// </summary>
        /// <param name="specType">The <see cref="SpecType"/></param>
        /// <param name="rules">The <see cref="ParameterizedCategoryRule"/> associated</param>
        /// <param name="categories">The <see cref="Category"/> associated</param>
        /// <param name="attributeDefMap">The <see cref="AttributeDefinitionMap"/>s for this <see cref="SpecType"/></param>
        public SpecTypeMap(SpecType specType, IEnumerable <ParameterizedCategoryRule> rules, IEnumerable <Category> categories, IEnumerable <AttributeDefinitionMap> attributeDefMap)
        {
            this.SpecType = specType;
            this.Rules    = rules != null?rules.ToArray() : new ParameterizedCategoryRule[0];

            this.Categories = categories != null?categories.ToArray() : new Category[0];

            this.AttributeDefinitionMap = attributeDefMap != null?attributeDefMap.ToArray() : new AttributeDefinitionMap[0];
        }
Example #13
0
        public void ReadBody()
        {
            if (SpecType == SpecType.full)
            {
                return;
            }

            XmlReader.FillBody(this);
            SpecType = SpecType.full;
        }
 public ActionResult Edit([Bind(Include = "SpecTypeID,TypeName")] SpecType specType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(specType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(specType));
 }
        public TypeSpecifier(string table)
        {
            if (table == null || table.Length == 0)
            {
                throw new OracularException ("table name invalid");
            }

            this.Type = SpecType.Table;
            this.Table = table;
        }
        public ActionResult Create([Bind(Include = "SpecTypeID,TypeName")] SpecType specType)
        {
            if (ModelState.IsValid)
            {
                db.specTypes.Add(specType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(specType));
        }
Example #17
0
 private static void CheckField(String[] parts)
 {
     if (parts.Length == 2)
     {
         var p1 = parts[1];
         if (SpecType.TryParse(p1, out SpecType st))
         {
             // A special type is specified, but there are only two parts in the field name
             throw new DataLoaderException($"Invalid field name '{String.Join("!", parts)}'");
         }
     }
 }
Example #18
0
 public MachineInfo()
 {
     type                       = "REAL";
     maxQueueSize               = -1;
     maxQueueSizeAssumed        = false;
     initStateName              = null;
     stateNameToStateInfo       = new Dictionary <string, StateInfo>();
     localVariableToVarInfo     = new Dictionary <string, VariableInfo>();
     observesEvents             = new List <string>();
     funNameToFunInfo           = new Dictionary <string, FunInfo>();
     specType                   = SpecType.SAFETY;
     funNameToFunInfo["ignore"] = new FunInfo(false, null, PToZing.PTypeNull, null, Factory.Instance.AddArg(Factory.Instance.MkFuncTerm(PData.Con_NulStmt), PData.Cnst_Skip).Node);
 }
        public TypeSpecifier(SpecType type)
        {
            if (type == SpecType.Table)
            {
                throw new OracularException ("table type specifier requires a table name");
            }

            if (type == SpecType.Function)
            {
                throw new OracularException ("function type specifier requires parameter and return types");
            }

            this.Type = type;
        }
        // GET: SpecTypes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SpecType specType = db.specTypes.Find(id);

            if (specType == null)
            {
                return(HttpNotFound());
            }
            return(View(specType));
        }
        public TypeSpecifier(TypeSpecifier returnType, TypeSpecifier[] parameterTypes)
        {
            if (returnType == null)
            {
                throw new OracularException ("return type invalid");
            }

            if (parameterTypes == null)
            {
                throw new OracularException ("parameter types invalid");
            }

            this.Type = SpecType.Function;
            this.ReturnType = returnType;
            this.ParameterTypes = parameterTypes;
        }
Example #22
0
    public void SetMonumentType(SpecType monSpecType)
    {
        if (!player.unlockedMonumentsDick[era].Contains(monSpecType))
        {
            player.unlockedMonumentsDick[era].Add(monSpecType);
        }
        Monument newMonument = ((GameObject)Instantiate(GameManager.GetGameObject(MonumentSelectionMenu.monSpecNameDick [monSpecType]), transform.position, Quaternion.identity)).GetComponent <Monument> ();

        newMonument.name = MonumentSelectionMenu.monSpecNameDick [monSpecType];
        newMonument.Initiate(this);
        isAlive  = false;
        occupied = false;
        player   = null;
        SetLayer();
        population = 0f;
        flag.GetComponent <SpriteRenderer> ().color = Color.white;
        flag.gameObject.SetActive(false);
        gameObject.SetActive(false);
    }
        //rentcar_setting_enable
        //window_num (Used only in runviewer.adc..?)
        //time_limit - demo seconds
        //leave_limit
        //no_instant_replay

        public void WriteToXml(XmlWriter xml)
        {
            xml.WriteStartElement("play_style");
            {
                xml.WriteElementValue("bspec_type", SpecType.ToString());

                if (PlayType != PlayType.RACE)
                {
                    xml.WriteElementValue("play_type", PlayType.ToString());
                }

                xml.WriteElementBoolIfTrue("no_quickmenu", NoQuickMenu);

                if (!ReplayRecordEnable)
                {
                    xml.WriteElementBool("replay_record_enable", ReplayRecordEnable);
                }
            }
            xml.WriteEndElement();
        }
Example #24
0
        private void Bind()
        {
            var annotation = SpecType.GetCustomAttributes(typeof(SpecOptionAnnotationAttribute), false);

            if (annotation != null && annotation.Length > 0)
            {
                var attribute = (SpecOptionAnnotationAttribute)annotation[0];
                if (!string.IsNullOrEmpty(attribute.PropertyName))
                {
                    SupportsFlat = true;
                    var bindProperty = SpecType.GetProperty(attribute.PropertyName);
                    if (bindProperty == null)
                    {
                        throw new Exception($"Option type does not have the specified property: {attribute.PropertyName}");
                    }

                    // Create a lambda to convert and set the property
                    _DefaultPropertySetter = (Spec option, string value) =>
                                             SetDefaultProperty(bindProperty.SetValue, bindProperty.PropertyType, option, value);
                }
            }
        }
Example #25
0
        /// <summary>
        /// Add the common <see cref="AttributeDefinition"/>s to the <see cref="SpecType"/>
        /// </summary>
        /// <param name="spectType">The <see cref="SpecType"/></param>
        private void AddCommonAttributeDefinition(SpecType spectType)
        {
            // set the attribute-definitions
            var shortNameAttributeDef = new AttributeDefinitionString
            {
                Identifier  = Guid.NewGuid().ToString(),
                Type        = this.TextDatatypeDefinition,
                Description = "The Short-Name Attribute",
                LastChange  = DateTime.UtcNow,
                LongName    = ShortNameAttributeDefName
            };

            spectType.SpecAttributes.Add(shortNameAttributeDef);

            var nameAttributeDef = new AttributeDefinitionString
            {
                Identifier  = Guid.NewGuid().ToString(),
                Type        = this.TextDatatypeDefinition,
                Description = "The Name Attribute",
                LastChange  = DateTime.UtcNow,
                LongName    = NameAttributeDefName
            };

            spectType.SpecAttributes.Add(nameAttributeDef);

            var catAttributeDef = new AttributeDefinitionString
            {
                Identifier  = Guid.NewGuid().ToString(),
                Type        = this.TextDatatypeDefinition,
                Description = "The Categories Attribute",
                LastChange  = DateTime.UtcNow,
                LongName    = CategoryAttributeDefName
            };

            spectType.SpecAttributes.Add(catAttributeDef);
        }
Example #26
0
        private Suite addSuite(string name, Action specDefinition, bool enabled, SpecType specType)
        {
            if (Registry.CurrentSuite.ExecutionStatus == ExecStatus.Running)
              {
            throw new Exception("Cannot add Suite in Spec block, please push this block to a parent Suite");
              }

              var suite = Registry.SuiteFactory(name, specDefinition);
              suite.Enabled = enabled && suite.Parent.Enabled;
              Registry.AddSpecToSuites(suite, specDefinition);
              return suite;
        }
Example #27
0
 public SpecialTile(SpecType t) :
     base(TileType.SPECIAL, null, 0, null)
 {
     SType = t;
 }
Example #28
0
        private void addSpec(string name, Action operation, bool enabled, SpecType specType)
        {
            if (name == String.Empty)
              {
              throw new Exception("Please specify a name for the spec");
              }
              var index = 2;
              var stackFrame = new System.Diagnostics.StackTrace(true).GetFrame(index);
              var codeBase = stackFrame.GetFileName();
              var lineNumber = stackFrame.GetFileLineNumber();
              var columnNumber = stackFrame.GetFileColumnNumber();
              var fileName = Path.GetFileName(codeBase);
              var className = this.GetType().FullName;
              //var className = this.GetType().Name;

              var spec = Registry.SpecFactory(name, operation, Registry.CurrentSuite, codeBase, lineNumber, columnNumber,
              fileName, className);
              spec.Enabled = enabled && spec.Parent.Enabled;
              Registry.CurrentSuite.AddChild(spec);
        }
Example #29
0
 public Spec(SpecType specType, string sentence, Action step = null)
 {
     _specType = specType;
     _sentence = sentence;
     Step      = step;
 }
Example #30
0
        public void ReadBody()
        {
            if (SpecType == SpecType.full) return;

            XmlReader.FillBody(this);
            SpecType = SpecType.full;
        }
Example #31
0
        static bool LoadAreaFiles()
        {
            string listContents;

            try
            {
                listContents = Encoding.ASCII.GetString(File.ReadAllBytes(Path.Combine(areaPath, areaList)));
            }
            catch (Exception e)
            {
                log.Error(e.Message);
                return(false);
            }

            using (var sr = new StringReader(listContents))
            {
                for (;;)
                {
                    var curFile = sr.ReadLine().Trim();
                    if (string.IsNullOrWhiteSpace(curFile))
                    {
                        continue;
                    }
                    if (curFile.StartsWith("$"))
                    {
                        break;
                    }

                    if (curFile.StartsWith("-"))
                    {
                        // ??????
                        // fpArea = stdin;
                        continue;
                    }

                    log.Info($"loadding {curFile}");
                    string areaContents;
                    try
                    {
                        areaContents = Encoding.ASCII.GetString(File.ReadAllBytes(Path.Combine(areaPath, curFile)));
                    }
                    catch (Exception e)
                    {
                        log.Error(e.Message);
                        return(false);
                    }


                    using (var ar = new StringReader(areaContents))
                    {
                        AreaData lastArea = null;
                        for (;;)
                        {
                            var word = ar.ReadWord();
                            if (!word.StartsWith("#"))
                            {
                                return(false);
                            }

                            word = word.Substring(1);
                            if (word.StartsWith("$"))
                            {
                                break;
                            }

                            switch (word)
                            {
                            case "AREA":
                                lastArea = AreaData.Load(ar, curFile);
                                break;

                            case "HELPS":
                                HelpData.LoadFromArea(ar);
                                break;

                            case "MOBILES":
                                MobileDef.LoadFromArea(ar, lastArea);
                                break;

                            case "OBJECTS":
                                ObjectDef.LoadFromArea(ar, lastArea);
                                break;

                            case "RESETS":
                                ResetData.LoadFromArea(ar);
                                break;

                            case "ROOMS":
                                RoomDef.LoadFromArea(ar, lastArea);
                                break;

                            case "SHOPS":
                                ShopData.LoadFromArea(ar);
                                break;

                            case "SPECIALS":
                                SpecType.LoadFromArea(ar);
                                break;

                            // OLC
                            case "AREADATA":
                                lastArea = AreaData.NewLoad(ar, curFile);
                                break;

                            // OLC 1.1b
                            case "ROOMDATA":
                                RoomDef.NewLoadFromArea(ar, lastArea);
                                break;

                            default:
                                log.Error($"Boot_db: bad section name '{word}'.");
                                return(false);
                            }
                        }
                    }
                }

                return(true);
            }
        }
Example #32
0
    private void AddSelectMonumentListener(UnoccupiedMonument newMonument, Button selectionButton, int popCost)
    {
        SpecType monumentSpec = MonumentSelectionMenu.speciesMonumentTypeDick[newMonument.GetSpecies()][newMonument.era][selectionButton.GetComponentInChildren <Text>().text];

        selectionButton.onClick.AddListener(delegate { monSelectionMenu.SelectMonument(selectionButton, monumentSpec, popCost); });
    }
Example #33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AttributeDefinition"/> class.
 /// </summary>
 /// <param name="specType">
 /// The owning <see cref="SpecType"/>.
 /// </param>
 internal AttributeDefinition(SpecType specType)
 {
     this.SpecType = specType;
     specType.SpecAttributes.Add(this);
 }
Example #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AttributeDefinitionSimple"/> class.
 /// </summary>
 /// <param name="specType">
 /// The owning <see cref="SpecType"/>.
 /// </param>
 internal AttributeDefinitionSimple(SpecType specType)
     : base(specType)
 {
 }
        public void ReferenceTypesFromTable(FieldType fieldType, SpecType specType)
        {
            var fieldConfig = new List<FieldConfig>
            {
                new FieldConfig("Id", null),
                new FieldConfig("Test", fieldType)
            };
            var tables = new List<OracularTable>
            {
                new OracularTable ("Foobar", null, null, fieldConfig)
            };
            var config = new OracularConfig (tables, new List<OracularSpec> ());

            var reference = new Reference (new string[]{ "Foobar", "Test" });

            var refType = reference.Walk (new TypeChecker (config));

            Assert.AreEqual (specType, refType.Type);
        }
        /// <summary>
        /// Create <see cref="AttributeValue"/> For <see cref="SpecElementWithAttributes"/>
        /// </summary>
        /// <param name="specElementWithAttributes">
        /// The <see cref="SpecElementWithAttributes"/> to which <see cref="AttributeValue"/>s need to be added.
        /// </param>
        /// <param name="specType">
        /// The <see cref="SpecType"/> of the <see cref="specElementWithAttributes"/>
        /// </param>
        private void CreateValuesForSpecElementWithAttributes(SpecElementWithAttributes specElementWithAttributes, SpecType specType)
        {
            var attributeValueBoolean = new AttributeValueBoolean();

            attributeValueBoolean.Definition = (AttributeDefinitionBoolean)specType.SpecAttributes.SingleOrDefault(x => x.GetType() == typeof(AttributeDefinitionBoolean));
            attributeValueBoolean.TheValue   = true;
            specElementWithAttributes.Values.Add(attributeValueBoolean);

            var attributeValueDate = new AttributeValueDate();

            attributeValueDate.Definition = (AttributeDefinitionDate)specType.SpecAttributes.SingleOrDefault(x => x.GetType() == typeof(AttributeDefinitionDate));
            attributeValueDate.TheValue   = XmlConvert.ToDateTime("2015-12-01", XmlDateTimeSerializationMode.Utc);
            specElementWithAttributes.Values.Add(attributeValueDate);

            var attributeValueEnumeration = new AttributeValueEnumeration();

            attributeValueEnumeration.Definition = (AttributeDefinitionEnumeration)specType.SpecAttributes.SingleOrDefault(x => x.GetType() == typeof(AttributeDefinitionEnumeration));
            var enumValue = attributeValueEnumeration.Definition.Type.SpecifiedValues.FirstOrDefault();

            attributeValueEnumeration.Values.Add(enumValue);
            specElementWithAttributes.Values.Add(attributeValueEnumeration);

            var attributeValueInteger = new AttributeValueInteger();

            attributeValueInteger.Definition = (AttributeDefinitionInteger)specType.SpecAttributes.SingleOrDefault(x => x.GetType() == typeof(AttributeDefinitionInteger));
            attributeValueInteger.TheValue   = 1;
            specElementWithAttributes.Values.Add(attributeValueInteger);

            var attributeValueReal = new AttributeValueReal();

            attributeValueReal.Definition = (AttributeDefinitionReal)specType.SpecAttributes.SingleOrDefault(x => x.GetType() == typeof(AttributeDefinitionReal));
            attributeValueReal.TheValue   = 100;
            specElementWithAttributes.Values.Add(attributeValueReal);

            var attributeValueString = new AttributeValueString();

            attributeValueString.Definition = (AttributeDefinitionString)specType.SpecAttributes.SingleOrDefault(x => x.GetType() == typeof(AttributeDefinitionString));
            attributeValueString.TheValue   = "a string value";
            specElementWithAttributes.Values.Add(attributeValueString);

            var attributeValueXhtml = new AttributeValueXHTML();

            attributeValueXhtml.Definition = (AttributeDefinitionXHTML)specType.SpecAttributes.SingleOrDefault(x => x.GetType() == typeof(AttributeDefinitionXHTML));
            attributeValueXhtml.TheValue   = this.xhtmlcontent;
            specElementWithAttributes.Values.Add(attributeValueXhtml);
        }