public Bag GetBagFromBagData(Bag bag, BagData bagData) { Inventory inventory = Inventory.Instance; BagSetting bagSetting = bag.ItemSetting as BagSetting; for (int i = 0; i < bagSetting.SlotCount; i++) { Slot slot = Instantiate(inventory.slotItmePrefab, bag.transform).GetComponent <Slot>(); bag.Slots.Add(slot); } foreach (ItemData itemData in bagData.ItemDatas) { ItemSetting itemSetting = GetItemFromDataBase(itemData.Name); if (itemSetting is BagSetting) { Bag itemBag = Instantiate(inventory.bagItemPrefab).GetComponent <Bag>(); itemBag.ItemSetting = GetItemFromDataBase(itemData.BagData.Name); itemBag = GetBagFromBagData(itemBag, itemData.BagData); bag.Slots[itemData.Index].Item = itemBag; itemBag.transform.SetParent(bag.Slots[itemData.Index].transform); } else { Item item = Instantiate(inventory.itemPrefab).GetComponent <Item>(); item.ItemSetting = itemSetting; item.Count = itemData.Count; bag.Slots[itemData.Index].Item = item; item.transform.SetParent(bag.Slots[itemData.Index].transform); } } return(bag); }
public void AddItemSetting(ItemSetting setting) { Id = setting.Id; Name = setting.Name; ItemType = setting.ItemType; IconType = setting.IconType; }
/// <summary> /// Reads the typical attributes for a ItemSetting from the configuration node. /// </summary> /// <param name="node">The XmlNode to read from.</param> /// <param name="item">The ItemSetting to set values for.</param> protected void ReadChildItem(XmlNode node, ItemSetting item) { // Set the item only if the node has a valid path attribute value. if (node.Attributes["path"] != null && node.Attributes["path"].Value.Trim().Length > 0) { // Get the value of the path attribute. item.Path = node.Attributes["path"].Value.Trim().ToLower(); // Remove leading and trailing "/" characters. if (item.Path.Length > 0) { item.Path = item.Path.Trim('/'); } // Check for a secure attribute. if (node.Attributes["secure"] != null) { string SecureValue = node.Attributes["secure"].Value.Trim(); if (Enum.IsDefined(typeof(SecurityType), SecureValue)) { item.Secure = (SecurityType)Enum.Parse(typeof(SecurityType), SecureValue); } else { throw new SecuritySwitchSectionException("Invalid value for the 'secure' attribute.", node); } } } else { // Throw an exception for the missing Path attribute. throw new SecuritySwitchSectionException("'path' attribute not found.", node); } }
/// <summary> /// Initializes a new instance of the <see cref="TrinitySetting" /> class. /// </summary> public TrinitySetting() { Combat = new CombatSetting(); WorldObject = new WorldObjectSetting(); Loot = new ItemSetting(); Advanced = new AdvancedSetting(); Notification = new NotificationSetting(); }
private void OutputsIncludeCheckBoxToggled(object o, ToggledArgs args) { TreeIter iter; if (m_outputsStore.GetIterFromString(out iter, args.Path)) { ItemSetting itemSetting = (ItemSetting)m_outputsStore.GetValue(iter, 2); itemSetting.Include = !itemSetting.Include; } }
public ItemSetting GetItemFromDataBase(string name) { foreach (DataBase dataBase in dataBases) { ItemSetting itemSetting = dataBase.GetItem(name); if (itemSetting != null) { return(itemSetting); } } return(null); }
public void SetItemSetting(int pushId, bool isOn) { for (int i = 0; i < this.mItemSettings.get_Count(); i++) { if (this.mItemSettings.get_Item(i).sType == pushId) { this.mItemSettings.get_Item(i).bOpen = isOn; return; } } ItemSetting itemSetting = new ItemSetting(); itemSetting.sType = pushId; itemSetting.bOpen = isOn; this.mItemSettings.Add(itemSetting); }
public void UseItem() { if (Item is Bag) { if (Inventory.Instance.CanAddBag) { if (Inventory.Instance.AddBag(Item as Bag)) { Item = null; } else { Debug.Log("Add Bag is fail,maybe inventory is full"); } } else { Debug.Log("BagButton is full"); } } else { ItemSetting itemSetting = Item.ItemSetting; if (itemSetting is IUseable) { if (itemSetting is EquipItemSetting) { Item = CharacterPanelUI.Instance.SwapItem(Item); } else if (itemSetting is SkillSetting) { itemSetting.Use(); } else { Item.Use(); } } else { Debug.Log(Item.ItemSetting.Name + " isn't useable"); } } SlotUI.UpdateUI(); Inventory.Instance.OnItemCountChanged(Item); }
/// <summary> /// Initializes a new instance of the <see cref="TrinitySetting" /> class. /// </summary> public TrinitySetting() { Combat = new CombatSetting(); WorldObject = new WorldObjectSetting(); Loot = new ItemSetting(); Advanced = new AdvancedSetting(); Notification = new NotificationSetting(); _FSWatcher = new FileSystemWatcher() { Path = Path.GetDirectoryName(GlobalSettingsFile), Filter = Path.GetFileName(GlobalSettingsFile), NotifyFilter = NotifyFilters.LastWrite, EnableRaisingEvents = true }; _FSWatcher.Changed += _FSWatcher_Changed; _LastLoadedSettings = DateTime.MinValue; }
IEnumerator LateStart() { m_list = GetComponent <ItemSetting>(); m_Slot = GetComponentsInChildren <ItemInfo>(); yield return(new WaitForSeconds(0.01f)); for (int i = 0; i < m_Slot.Length; i++) { if (m_Slot[i] == null || !m_Slot[i].m_SettingClear) { print("Inven in " + m_Slot[i].name + " Not Setting"); } } DataLoad(); yield return(null); }
public void Setting() { m_Item = GameObject.Find("Inven").GetComponent <ItemSetting>(); m_Item.Setting(); for (int i = 0; i < m_CraftingMap.Length; i++) { m_CraftingMap[i].m_Data = new Dictionary <string, CraftingData>(); } List <Dictionary <string, object> > data = CSVReader.Read(path); string name; for (var i = 0; i < data.Count; i++) { var item = new CraftingData(); item.m_Array = new Item[9]; int index = -1; for (int j = 0; j < item.m_Array.Length; j++) { name = (string)data[i][j.ToString()]; if (m_Item.m_ItemMap.ContainsKey(name)) { item.m_Array[j] = m_Item.m_ItemMap[name]; item.code += m_Item.m_ItemMap[name].m_Code.ToString(); ++index; } else { item.m_Array[j] = null; } } item.name = (string)data[i]["이름"]; item.count = (int)data[i]["개수"]; m_CraftingMap[index].m_Data.Add(item.code.ToString(), item); } }
/// <summary> /// Processes the IO. /// </summary> /// <param name="componentTemplateIODictionary">The io dictionary of either Inputs of Outputs of the component template.</param> /// <param name="settings">input or output settings for the composite component that is being defined</param> /// <param name="benchmarkMappingSettingsCollection">The benchmark setting collection .</param> private static void ProcessIO(IDictionary <string, IOItem> componentTemplateIODictionary, SortedDictionary <string, ItemSetting> settings, BenchmarkSettingCollection <IOItem> benchmarkMappingSettingsCollection) { MultiDictionary <string, ItemSetting> lookupByType = new MultiDictionary <string, ItemSetting>(); //first prepare lookup by type foreach (KeyValuePair <string, ItemSetting> pair in settings) { ItemSetting item = pair.Value; //as default don't include it item.Include = false; lookupByType.Add(item.Type, item); } foreach (string itemKey in componentTemplateIODictionary.Keys) { IOItem item = componentTemplateIODictionary[itemKey]; //check if there are any item settings with matching type IEnumerable <ItemSetting> matchingItemSettings; if (lookupByType.TryGetValue(item.IOItemDefinition.Type, out matchingItemSettings)) { ItemSettingCollection list = new ItemSettingCollection(matchingItemSettings); //add all to the candidate matching items - these are items that user can choose from var setting = new BenchmarkItemSetting <IOItem>(item, list); benchmarkMappingSettingsCollection.Add(setting); setting.SelectedSetting = setting.CandidateSettings[0]; } else { //add empty list - no matching items - benchmarking cannot be executed var setting = new BenchmarkItemSetting <IOItem>(item, new ItemSettingCollection()); benchmarkMappingSettingsCollection.Add(setting); } } }
public void LoadDefault() { GlobalSetting = new GlobalSetting { CheckPlayerNick = true, NickRegex = @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|^http(s)?://([\w-]+.)+[\w-]+(/[\w- ./?%&=])?$", OnlyRuPlayers = true, CountryCodes = new List <string> { "RU", "BY", "UA", "KZ" }, ApiKey = "f837428ca01f985f50e81fb001d07a06" }; SaveSetting = new SaveSetting { Enabled = true, Interval = 1600 }; RemoteSetting = new RemoteSetting { Enabled = false, Password = "******", Port = 8888 }; ItemSetting = new ItemSetting { BlockedItems = new List <ushort> { 132, 297, 300, 519, 1000, 1382, 3517, 1441, 1300, 1394, 3087, 3077, 3075, 3061, 3059, 15053, 3500, 73, 254, 1100, 1241, 1393, 3061, 3062, 3063, 1520 }, BlockedVehicles = new List <ushort> { 120, 140, 121, 135, 137, 141, 830, 831 } }; }
private new void ResetButton_Click(object sender, System.Windows.RoutedEventArgs e) { ItemSetting.Reset(); UpdataData(); MainWindow.ShowNoticeDialog("信息", $"\"{_remoteName}\" 远程桌面设置已重置。"); }
/// <summary> /// 更新默认设置 /// </summary> public void UpdateDefault() { ItemSetting.SetDefaultSetting(); }
private void RenderIncludeCheckBox(TreeViewColumn layout, CellRenderer cell, TreeModel model, TreeIter iter) { ItemSetting itemSetting = (ItemSetting)model.GetValue(iter, 2); (cell as CellRendererToggle).Active = itemSetting.Include; }
private void RenderType(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) { ItemSetting itemSetting = (ItemSetting)model.GetValue(iter, 1); (cell as CellRendererText).Text = itemSetting.FriendlyType; }
private void RenderName(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) { ItemSetting itemSetting = (ItemSetting)model.GetValue(iter, 0); (cell as CellRendererText).Text = itemSetting.ItemSettingName; }