Exemple #1
0
 public OutputItem(int inputCount, DynamicID <ItemID> id, string name = null, MachineDraw draw = null)
 {
     InputCount = inputCount;
     ID         = id;
     Name       = name;
     Draw       = draw;
 }
 /// <summary>
 /// Map game Item ID to specific class.
 /// </summary>
 public void MapItem <TObject>(DynamicID <ItemID> id) where TObject : ISmartObject, new()
 {
     _itemTypeMap.Add(id, typeof(TObject));
     if (!_itemTypeCtorCache.ContainsKey(typeof(TObject)))
     {
         _itemTypeCtorCache.Add(typeof(TObject), new Constructor <TObject>());
     }
 }
 /// <summary>
 /// Map game Craftable ID to specific class.
 /// </summary>
 public void MapCraftable <TObject>(DynamicID <CraftableID> id) where TObject : ISmartObject, new()
 {
     _craftableTypeMap.Add(id, typeof(TObject));
     if (!_craftableTypeCtorCache.ContainsKey(typeof(TObject)))
     {
         _craftableTypeCtorCache.Add(typeof(TObject), new Constructor <TObject>());
     }
 }
 public WarpTotemInformation(DynamicID <ItemID> id, string name, string description) : base(id, name, description)
 {
 }
Exemple #5
0
 public CookingRecipeInformation(DynamicID <ItemID> id, string name, params IngredientInfo[] ingredients)
 {
     ID          = id;
     Name        = name;
     Ingredients = ingredients.ToList();
 }
Exemple #6
0
 public OutputItem(DynamicID <ItemID> id, string name = null, MachineDraw draw = null) : this(1, id, name, draw)
 {
 }
        public override void Run()
        {
            // Login
            VapiAuthHelper           = new VapiAuthenticationHelper();
            SessionStubConfiguration =
                VapiAuthHelper.LoginByUsernameAndPassword(
                    Server, UserName, Password);

            // Get the cluster
            this.clusterId = new DynamicID();
            this.clusterId.SetType("ClusterComputeResource");
            this.clusterId.SetId(ClusterHelper.GetCluster(
                                     VapiAuthHelper.StubFactory, SessionStubConfiguration,
                                     DatacenterName, ClusterName));

            this.tagName = RandomIdGenerator.GetRandomString("Tag-");
            var tagDesc = "Sample tag";

            this.categoryName = RandomIdGenerator.GetRandomString("Cat-");
            var categoryDesc = "Sample category";

            // create services
            this.tagService = VapiAuthHelper.StubFactory.CreateStub <Tag>(
                SessionStubConfiguration);
            this.categoryService =
                VapiAuthHelper.StubFactory.CreateStub <Category>(
                    SessionStubConfiguration);
            this.tagAssociation =
                VapiAuthHelper.StubFactory.CreateStub <TagAssociation>(
                    SessionStubConfiguration);

            // create a category
            this.categoryId = CreateCategory(categoryService, categoryName,
                                             categoryDesc, CategoryModel.Cardinality.MULTIPLE);
            Console.WriteLine("Created category '{0}'", categoryName);

            // create a tag
            this.tagId = CreateTag(
                this.tagService, this.tagName, tagDesc, this.categoryId);
            Console.WriteLine("Created tag '{0}'", this.tagName);

            // update the category
            var newCategoryDesc = "Tag category updated at " + DateTime.Now;

            UpdateCategoryDesc(this.categoryService, this.categoryId,
                               newCategoryDesc);
            Console.WriteLine("Updated category description to '{0}'",
                              newCategoryDesc);

            // update the tag
            var newTagDesc = "Tag updated at " + DateTime.Now;

            UpdateTagDesc(tagService, tagId, newTagDesc);
            Console.WriteLine("Updated tag description to '{0}'", newTagDesc);

            // tag the Cluster with the newely created tag
            this.tagAssociation.Attach(this.tagId, this.clusterId);
            if (this.tagAssociation.ListAttachedTags(
                    this.clusterId).Contains(this.tagId))
            {
                Console.WriteLine("Cluster '{0}' tagged with '{1}'",
                                  ClusterName, tagName);
                this.tagAttached = true;
            }
            else
            {
                throw new Exception(string.Format(
                                        "Could not tag Cluster '{0}' with '{1}'",
                                        ClusterName, tagName));
            }
        }
Exemple #8
0
 public AdditionalItemInfo(DynamicID <ItemID, CategoryID> id, int count)
 {
     ID    = id;
     Count = count;
 }
 public OverridedMachineInformation(DynamicID <CraftableID> id, MachineOutputInformation output)
 {
     ID     = id;
     Output = output;
 }
Exemple #10
0
 public CropInformation(DynamicID <ItemID> seedID, DynamicID <ItemID> cropID, params int[] phases)
 {
     SeedID = seedID;
     CropID = cropID;
     Phases = phases.ToList();
 }
 public ItemInformation(DynamicID <ItemID> id, string name, string description)
 {
     ID          = id;
     Name        = name;
     Description = description;
 }