• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Items类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Items的典型用法代码示例。如果您正苦于以下问题:C# Items类的具体用法?C# Items怎么用?C# Items使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Items类属于命名空间,在下文中一共展示了Items类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Start

    void Start()
    {
        player = gameObject.transform.parent.GetComponentInChildren<Player>();

        //let's create the player
        items = new Items();
        characters = new Characters();
        if (items.LoadItems() && characters.LoadCharacters())
        {
            prefab = Resources.Load(characters.GetCharacter("Guy").GetDirectory(), typeof(GameObject));
            PlayerObject = Instantiate(prefab) as GameObject;
            PlayerObject.transform.position = new Vector3(0, 0.5f, 0);
            PlayerObject.transform.SetParent(gameObject.transform.parent.FindChild("PlayerObject").transform);

            for (int i = -4; i <= 4; i++) //initial 8 tiles
            {
                int rand = Random.Range(0, 2);
                item = items.GetItem(TilesArray[rand]);
                prefab = Resources.Load(item.GetDirectory(), typeof(GameObject));
                ObjectI = Instantiate(prefab, Vector3.zero, Quaternion.identity) as GameObject;
                ObjectI.transform.position = new Vector3(i * 9, 0, 0) + item.GetBasePosition();
                ObjectI.transform.SetParent(gameObject.transform.FindChild("Tiles").transform);
                tiles.Add(ObjectI);
            }
        }
    }
开发者ID:edumntg,项目名称:jump-dodge,代码行数:26,代码来源:Generation.cs


示例2: getZipWithLocalO2Scripts

        public static string getZipWithLocalO2Scripts()
        {
            var tempDir = "_TempScriptsFolder".tempDir();
            var localScriptsFolder = PublicDI.config.LocalScriptsFolder;
            var tempScriptsFolder = tempDir.pathCombine("O2.Platform.Scripts");
            var zipFile = tempDir.pathCombine("O2.Platform.Scripts.zip");

            "[getZipWithLocalO2Scripts] Step 1: Copying files".debug();
            Files.copyFolder(localScriptsFolder, tempDir, true, false, ".git");

            "[getZipWithLocalO2Scripts] Step 2: calculating Hashes".debug();
            var files = tempScriptsFolder.files(true);
            var items = new Items();
            foreach (var file in files)
            {
                var hash = file.fileContents_AsByteArray().hash();
                items.add(file.remove(tempScriptsFolder + "\\"), hash.str());
            }
            var hashesFile = tempScriptsFolder.pathCombine("ScriptHashes-{0}.xml".format(DateTime.Now.safeFileName()));
            items.saveAs(hashesFile);

            "[getZipWithLocalO2Scripts] Step 3: Creating Zip".debug();
            tempScriptsFolder.zip_Folder(zipFile);

            return zipFile;
        }
开发者ID:sempf,项目名称:FluentSharp,代码行数:26,代码来源:O2Scripts.cs


示例3: Interact

    // Called when an object is interacted with.
    public override Items.Item Interact(Items.Item item = null)
    {
        Items.Item toReturn = null;

        if (tags.Contains("CARROT"))
        {
            World.textbox.Write("You got some carrots.");
            toReturn = Items.getItemWithName("carrot");
            TurnInto(afterInteraction[Random.Range(0, afterInteraction.Length)]);
            World.AddChaos(World.STEAL);
        }
        else if (tags.Contains("CORN"))
        {
            World.textbox.Write("You got some corn.");
            toReturn = Items.getItemWithName("corn");
            TurnInto(afterInteraction[Random.Range(0, afterInteraction.Length)]);
            World.AddChaos(World.STEAL);
        }
        else if (tags.Contains("LETTUCE"))
        {
            World.textbox.Write("You got some lettuce.");
            toReturn = Items.getItemWithName("lettuce");
            TurnInto(afterInteraction[Random.Range(0, afterInteraction.Length)]);
            World.AddChaos(World.STEAL);
        }
        else if (tags.Contains("TOMATO"))
        {
            World.textbox.Write("You got some tomato.");
            toReturn = Items.getItemWithName("tomato");
            TurnInto(afterInteraction[Random.Range(0, afterInteraction.Length)]);
            World.AddChaos(World.STEAL);
        }

        return toReturn;
    }
开发者ID:IzumiMirai,项目名称:CSSeniorProject,代码行数:36,代码来源:Crop.cs


示例4: SetItems

        /// <summary>
        /// Sets the items to be used in the comparison.
        /// </summary>
        /// <param name="properties"></param>
        /// <param name="item1"></param>
        /// <param name="item2"></param>
        public void SetItems(
            Items.ItemProperty[] properties,
            Items.Item item1,
            Items.Item item2)
        {
            // clear out any prior contents
            RowHost.Children.Clear();
            RowHost.RowDefinitions.Clear();

            // set up our row/column definitions
            for (int index = 0; index < properties.Length; ++index)
            {
                RowHost.RowDefinitions.Add(new RowDefinition());
            }

            // add our columns
            for (int index = 0; index < properties.Length; ++index)
            {
                ComparisonRow row = new ComparisonRow();
                Grid.SetRow(row, index);
                RowHost.Children.Add(row);                
                row.HeadingLabel.Text = properties[index].Name;
                row.Cell1.SetValue(item1.Values[index], properties[index].PropertyType);
                row.Cell2.SetValue(item2.Values[index], properties[index].PropertyType);
            }

            ItemBrand1.Text = item1.Brand;
            ItemBrand2.Text = item2.Brand;
            ItemName1.Text = item1.Name;
            ItemName2.Text = item2.Name;
        }
开发者ID:AnthonyB28,项目名称:Marist_Map,代码行数:37,代码来源:ComparisonTable.xaml.cs


示例5: Start

 // Use this for initialization
 void Start()
 {
     activeboublecolor = bouble.color;
     item = Items.EMPTY;
     bouble.color = Color.clear;
     coloritem = Color.white;
 }
开发者ID:hydro-team,项目名称:hydro,代码行数:8,代码来源:Inventory.cs


示例6: EquipWeapon

        public void EquipWeapon(Items thing)
        {
            if(thing is Weapon)
            {
                if(weaponCapacity>0)
                {
                    this.Equiped.Add(thing);

                    if (thing is Saber)
                    {
                        var temp = (Saber)thing;

                        attacks.Add(new LightAttackAbility(temp,this));
                    }
                    else if(thing is DarkStaff)
                    {
                        var temp = (DarkStaff)thing;
                        attacks.Add(new LightMagicAbility(temp,this));
                    }
                    weaponCapacity--;
                    this.Inventory.Remove(thing);
                }

                //else { Console.WriteLine("Not Allowed"); }
            }
        }
开发者ID:GeorgiNik,项目名称:TelerikAcademy,代码行数:26,代码来源:Player.cs


示例7: UneqipWeapon

        public void UneqipWeapon(Items thing)
        {
            if (thing is Weapon)
            {
                Equiped.Remove(thing);
                Inventory.Add(thing);

                if (thing is Saber)
                {
                    var temp = (Saber)thing;
                    LightAttackAbility tempAbility = new LightAttackAbility(temp,this);
                    var tempR=attacks.Find(o=>o.Name==thing.Name+" Light Attack");
                    attacks.Remove(tempR);
                }
                else
                {
                    var temp=(DarkStaff)thing;
                    LightMagicAbility tempAbility = new LightMagicAbility(temp,this);
                    var tempR = attacks.Find(o => o.Name == thing.Name + " Light Magic Attack");
                    attacks.Remove(tempR);
                }

                weaponCapacity++;
            }
        }
开发者ID:GeorgiNik,项目名称:TelerikAcademy,代码行数:25,代码来源:Player.cs


示例8: AddToInventory

 /// <summary>
 /// Adds item to the inventory, keeps already existing items
 /// </summary>
 /// <param name="items">Items.</param>
 public void AddToInventory(Items items, Texture texture)
 {
     float __x = _xPos - inventoryItem.Count * _xOffset;
     Rect __rect = new Rect(__x, _outYPos,_sizeButton,_sizeButton);
     inventoryItem.Add( new InventoryItem(items, texture,__rect));
     StartCoroutine(_MoveItemDown(inventoryItem[inventoryItem.Count-1]));
 }
开发者ID:hilvi,项目名称:MimmitAndroid,代码行数:11,代码来源:Inventory.cs


示例9: EquipItem

        public bool EquipItem(Items.Iitem item, Inventory inventory)
        {
            bool result = false;

            Items.Iweapon weaponItem = item as Items.Iweapon;
            if (weaponItem != null && weaponItem.IsWieldable) {
                //can't equip a wieldable weapon
            }
            else {
                if (!equipped.ContainsKey(item.WornOn)) {
                    equipped.Add(item.WornOn, item);
                    if (inventory.inventory.Any(i => i.Id == item.Id)) {//in case we are adding it from a load and not moving it from the inventory
                        inventory.inventory.RemoveWhere(i => i.Id == item.Id); //we moved the item over to equipped so we need it out of inventory
                    }
                    result = true;
                }
                else if (item.WornOn == Items.Wearable.WIELD_LEFT || item.WornOn == Items.Wearable.WIELD_RIGHT) { //this item can go in the free hand
                    Items.Wearable freeHand = Items.Wearable.WIELD_LEFT; //we default to right hand for weapons
                    if (equipped.ContainsKey(freeHand)) freeHand = Items.Wearable.WIELD_RIGHT; //maybe this perosn is left handed
                    if (!equipped.ContainsKey(freeHand)) { //ok let's equip this
                        item.WornOn = freeHand;
                        item.Save();
                        equipped.Add(freeHand, item);
                        if (inventory.inventory.Any(i => i.Id == item.Id)) {//in case we are adding it from a load and not moving it from the inventory
                            inventory.inventory.RemoveWhere(i => i.Id == item.Id); //we moved the item over to equipped so we need it out of inventory
                        }
                        result = true;
                    }
                }
            }

            return result;
        }
开发者ID:vadian,项目名称:Novus,代码行数:33,代码来源:Equipment.cs


示例10: InitializeData

    /// <summary>
    /// Initialize interface with default data. 
    /// </summary>
    /// <param name="result"></param>
    public void InitializeData( Items.BaseItem result )
    {
      var res = result as Items.TestResult;

      if( null == res )
      {
        throw new ArgumentException( "Invalid argument type." );
      }

      var isExecuted = res.IsExecuted;

      lblAsserts.Visible = isExecuted;
      lblTime.Visible = isExecuted;
      lblAssertsCap.Visible = isExecuted;
      lblTimeCap.Visible = isExecuted;
      lblErrors.Text = res.Errors ?? "";
      lblFailures.Text = res.Failures ?? "";
      if( isExecuted )
      {
        lblAsserts.Text = res.Asserts.Value.ToString();
        lblTime.Text = res.Time;
      }

      lblExecuted.Text = res.IsExecuted.ToString();
      lblName.Text = res.Name;
      lblresult.Text = res.TestResultValue.ToString();
      lblresult.ForeColor = ( res.TestResultValue == Items.TestResultsEnum.Error ||
        res.TestResultValue == Items.TestResultsEnum.Failure ||
        res.TestResultValue == Items.TestResultsEnum.Invalid ) ? Color.Red : Color.Black;
    }
开发者ID:buonan,项目名称:NUnitTestResultsViewerCode,代码行数:34,代码来源:CompTestResult.cs


示例11: SetItem

        /// <summary>
        /// Sets the item and properties to display.
        /// </summary>
        /// <param name="properties">An array of properties to display.</param>
        /// <param name="item">The item to display.</param>
        public void SetItem(
            Items.ItemProperty[] properties,
            Items.Item item)
        {
            // clear out any prior contents
            RowHost.Children.Clear();
            RowHost.RowDefinitions.Clear();

            // set up our row definitions
            for (int index = 0; index < properties.Length; ++index)
            {
                RowHost.RowDefinitions.Add(new RowDefinition());
            }

            // add our rows
            for (int index = 0; index < properties.Length; ++index)
            {
                InformationPanelRow row = new InformationPanelRow();
                Grid.SetRow(row, index);
                RowHost.Children.Add(row);              
                row.HeadingLabel.Text = properties[index].Name;                
                row.Cell.SetValue(item.Values[index], properties[index].PropertyType);
            }

            ItemBrandPanel.Text = item.Brand;
            ItemNamePanel.Text = item.Name;
        }
开发者ID:AnthonyB28,项目名称:Marist_Map,代码行数:32,代码来源:ItemVisualization.xaml.cs


示例12: addToInventory

 public void addToInventory(Items.seeds seed,int amount)
 {
     Items.seeds s = null;
     bool found = false;
     if (seeds.Count == 0)
     {
         seeds.Add(seedcnt, list.cloneSeed(seed));
         seeds[seedcnt].addAmount(amount);
         seedcnt++;
     }
     else
     {
         foreach (KeyValuePair<int, Items.seeds> entry in seeds)
         {
             if (entry.Value.getID() == seed.getID() && found == false)
             {
                 s = entry.Value;
                 found = true;
             }
         }
         if (found)
         {
             s.addAmount(amount);
         }
         else
         {
             seeds.Add(seedcnt, list.cloneSeed(seed));
             seeds[seedcnt].addAmount(amount);
             seedcnt++;
         }
     }
 }
开发者ID:Lomacil,项目名称:Harvest,代码行数:32,代码来源:Inventory.cs


示例13: Task

 /// <summary>
 /// Létrehoz egy feladatot a megadott típussal és célponttal
 /// </summary>
 /// <param name="Type">A feladat típusa</param>
 /// <param name="Item">A feladat célpontja</param>
 public Task(TaskType Type, Items.ItemBase Item)
 {
     if (Type == TaskType.Any) { throw new ArgumentException("TaskType.Any cannot be used here"); }
     this.Type = Type;
     this.Item = Item;
     this.AssignedSince = Statistics.CurrentLoop;
 }
开发者ID:solymosi,项目名称:hangyaboly,代码行数:12,代码来源:Task.cs


示例14: SecretBrick

        public SecretBrick(int x, int y, Items.Item item)
        {
            this.Breakable = true;
            this.Solid = true;
            this.Position = new Rectangle(x * 24, y * 24, 24, 24);
            this.ImageCount = 0f;
            this.ImageIndex = 0;
            this.ImageSpeed = 1f;
            this.ImageTime = 10f;
            this.HeldItem = item;
            this.OffsetX = 0;
            this.OffsetY = 0;
            if(HeldItem is Items.ItemCoin)
                this.BreakSound = Game1.otherSounds[2];
            else
                this.BreakSound = Game1.otherSounds[3];
            this.HitSound = Game1.otherSounds[1];

            this.SrcRect = new Rectangle[10];
            for (int i = 0; i < this.SrcRect.Length; i++)
            {
                if (i < 7)
                    this.SrcRect[i] = new Rectangle(136, 0, 16, 16);
                else
                    this.SrcRect[i] = new Rectangle(136 + (i - 6) * 17, 0, 16, 16);
            }
        }
开发者ID:JohnP42,项目名称:super-luigi,代码行数:27,代码来源:SecretBrick.cs


示例15: CanHarvest

 public override bool CanHarvest(Items.ToolItem tool)
 {
     return tool is PickaxeItem &&
         (tool.ToolMaterial == ToolMaterial.Iron ||
         tool.ToolMaterial == ToolMaterial.Gold ||
         tool.ToolMaterial == ToolMaterial.Diamond);
 }
开发者ID:ammaraskar,项目名称:Craft.Net,代码行数:7,代码来源:DiamondBlock.cs


示例16: GetExtendedItem

        internal Item GetExtendedItem(Items itemEnum)
        {
            Item item = GetItem(itemEnum);

            HtmlNode root = HtmlDocumentController.GetDotabuffItemRoot(item.Reference);

            if (item.WinRate == null || item.Popularity == null)
            {
                item.WinRate = mainController.ConvertStringToWinRate(root.SelectSingleNode(ItemPath.General.WinRate.Value).InnerText);
                item.Popularity = mainController.ConvertStringToPopularity(root.SelectSingleNode(ItemPath.General.Popularity.Value).InnerText);

                string url = UrlPath.Main + root.SelectSingleNode(ItemPath.General.Image.Value).Attributes[MainController.HTML_ATTRIBUTE_SRC].Value;
                using (WebClient webclient = HtmlDocumentController.CreateWebclient())
                {
                    item.Image = webclient.DownloadData(url);
                }
            }

            if (item.ItemDetails == null)
                item.ItemDetails = itemDetailsController.FetchItemDetails(item.Reference);

            item.BuildsInto = FetchBuildsList(root, ItemPath.Details.BuildsInto.Value);

            item.BuildsFrom = FetchBuildsList(root, ItemPath.Details.BuildsFrom.Value);

            return item;
        }
开发者ID:Shamshiel,项目名称:DotA2StatsParser,代码行数:27,代码来源:ItemController.cs


示例17: GetInventoryByType

    public static ArrayList GetInventoryByType(string inventoryType)
    {
        ArrayList list = new ArrayList();
        string query = string.Format("SELECT * FROM items", inventoryType);

        try
        {
            conn.Open();
            command.CommandText = query;
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                int itemid = reader.GetInt32(0);
                string name = reader.GetString(1);
                string categoryname = reader.GetString(2);
                string description = reader.GetString(3);
        //        string imagepath = reader.GetString(4);
         //       bool available = reader.GetBoolean(4);
         //       bool staffonly = reader.GetBoolean(5);

                Items Items = new Items(itemid, name, categoryname, description/* imagepath, available, staffonly*/);
                list.Add(Items);
            }
        }
        finally
        {
            conn.Close();
        }

        return list;
    }
开发者ID:rmeis309uwsp,项目名称:103113cnmt480,代码行数:32,代码来源:ConnectionClass.cs


示例18: property_Values_AsStrings

 public static Items property_Values_AsStrings(this object _object)
 {
     var propertyValues_AsStrings = new Items();
     foreach(var property in _object.type().properties())
         propertyValues_AsStrings.add(property.Name.str(), _object.property(property.Name).str());
     return propertyValues_AsStrings;
 }
开发者ID:njmube,项目名称:FluentSharp,代码行数:7,代码来源:Reflection_ExtensionMethods_WebServices_SOAP.cs


示例19: Door

        public Door(Vector3 position, bool isWestEast, bool isOpen, Items.Door door) : base(position)
        {
            doorFrame = new ModelGraphic();
            doorFrame.Model = doorFrame.Resources.Content.Load<Model>("Models/outterDoor");
            doorFrame.Rotation = isWestEast ? new Vector3(0, MathHelper.PiOver2, 0) : Vector3.Zero;
            doorFrame.Position = position + (isWestEast ? new Vector3(0.4f, 0, 0) : new Vector3(0, 0, 0.4f));
            doorFrame.Scale = new Vector3(1, 0.98f, 0.2f);

            this.door = door;
            door.Graphic.Rotation = isWestEast ? new Vector3(0, MathHelper.PiOver2, 0) : Vector3.Zero;
            door.Position = position + new Vector3((1 - door.Size.X) / 2f, 0, (1 - door.Size.Z) / 2f);
            SubItems.Add(door);

            graphics = new GraphicsCollection(wallGraphic, doorFrame);
            graphics.SubDrawable.Add(door);
            graphicsProviders.SubProviders.Add(graphics);

            ContentActivated = isOpen;

            if (door.HasButton)
            {
                Vector3 shift = !isWestEast ? new Vector3(0, 0, 0.4f) : new Vector3(0.4f, 0, 0);
                var t = new SwitchActuator(position + new Vector3(0, 0.2f, 0) + shift, this, new ActionStateX(ActionState.Toggle, 0, isOnceOnly: false));
                SubItems.Add(t);
            }
        }
开发者ID:ggrrin,项目名称:DungeonMaster,代码行数:26,代码来源:Door.cs


示例20: appBarOkButton_Click

        private void appBarOkButton_Click(object sender, EventArgs e)
        {
            CategoryBean tb = (CategoryBean)selectedCategory.SelectedItem;
            if (String.IsNullOrEmpty(tb.CategoryName))
            {
                MessageBox.Show("Error: Category is not selected.");
                return;
            }
            Items newItem = new Items
            {
                CategoryID = tb.ID,
                StartTime = DateTime.Now,
                EndTime = DateTime.Now,
                IsActivity = true,
                UpdateTime = DateTime.Now

            };
            App.ViewModel.AddItem(newItem, tb);

            // Return to the main page.
            if (NavigationService.CanGoBack)
            {
                NavigationService.GoBack();
            }
        }
开发者ID:nagyist,项目名称:chenliang0571-Health-Tracker,代码行数:25,代码来源:NewItemPage.xaml.cs



注:本文中的Items类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ItemsChangedEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# ItemUpdateType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap