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; }
// Use this for initialization void Start() { activeboublecolor = bouble.color; item = Items.EMPTY; bouble.color = Color.clear; coloritem = Color.white; }
public Item(Items item, World l, bool inv = false) { isInventory = inv; e = new Entity(this, l); this.id = (short)item; OnGround = false; }
// 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; }
/// <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; }
/// <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; }
public void addToInventory(Items.plants plant, int amount) { Items.plants p = null; bool found = false; if (plants.Count == 0) { plants.Add(plantcnt, list.clonePlant(plant)); plants[plantcnt].addAmount(amount); plantcnt++; } else { foreach (KeyValuePair<int, Items.plants> entry in plants) { if (entry.Value.getID() == plant.getID()&&!found) { p = entry.Value; found = true; } } if(found) p.addAmount(amount); else { plants.Add(plantcnt, list.clonePlant(plant)); plants[plantcnt].addAmount(amount); plantcnt++; } } }
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"); } } }
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(); } }
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); } }
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); } }
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; }
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; }
/// <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; }
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++; } } }
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++; } }
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; }
/// <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])); }
/// <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; }
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; }
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); } } }
public override string interact (Items.Item item) { string forReturn = ""; if (speechCounter == 0) { forReturn = "Oh...hey yeah I could use some help"; } else if (speechCounter == 1) { forReturn = "I...can't bring myself to kill the" + "\n" + "" + "poor little " + animal + " would you be able" + "\n" + " to do it for me?"; } else if (World.player.inventory.Contains (meat)) { forReturn = "Thanks...please don't tell anyone..."; World.AddChaos (World.QUEST_COMPLETE); //Counter act the killing an animal chaos. World.AddChaos (-2); deactivateQuest (questGiver); inUse = false; waitPeriod = k_numRotations; questGiver.SetState (State.happy); } else { forReturn = "Did you...get the meat yet?"; } speechCounter++; return forReturn; }
public override bool CanHarvest(Items.ToolItem tool) { return tool is PickaxeItem && (tool.ToolMaterial == ToolMaterial.Iron || tool.ToolMaterial == ToolMaterial.Gold || tool.ToolMaterial == ToolMaterial.Diamond); }
/// <summary> /// Constructor that accepts values for all mandatory fields /// </summary> ///<param name="refId">The ID (GUID) that uniquely identifies this response set.</param> ///<param name="assessmentResponseComponentRefId">The ID (GUID) of the assessment response component that the responses are associated with</param> ///<param name="learnerPersonalRefId">The ID (GUID) of the Learner for whom these responses are.</param> ///<param name="items">An Items</param> /// public LearnerAssessmentResponseSet( string refId, string assessmentResponseComponentRefId, string learnerPersonalRefId, Items items ) : base(Adk.SifVersion, AssessmentDTD.LEARNERASSESSMENTRESPONSESET) { this.RefId = refId; this.AssessmentResponseComponentRefId = assessmentResponseComponentRefId; this.LearnerPersonalRefId = learnerPersonalRefId; this.Items = items; }
public ItemManager() { INSTANCE = this; log4net.Config.XmlConfigurator.Configure(); logger = LogManager.GetLogger(typeof(ItemManager)); items = new Items(); currentlyLoading = new ConcurrentDictionary<uint, Item>(); }
public void Add(Items item, int slot) { if (slot > 44 || slot < 0) return; Item temp = new Item(item); temp.count = 1; items[slot] = temp; }
public void Initialize() { CleanRegisteredCallBacks(); InboxItems = Globals.ThisAddIn.Application.Session.DefaultStore.GetDefaultFolder(OlDefaultFolders.olFolderInbox) .Items; InboxItems.ItemAdd += AddNewInboxItems; }
public Item(int id, string name, string description, Items type) { itemID = id; itemName = name; itemDescription = description; itemType = type; itemIcon = Resources.Load<Sprite> ("" + name); }
public override void PutOn(Items.Item item) { Item = item; if (item.GetType() == typeof(Weapon)) { Weapon = (Weapon)item; } }
public void Add(Items item, byte count, int slot) { Item temp = new Item(item); temp.count = count; if (slot > 44 || slot < 0) return; items[slot] = temp; }
public IEnumerable <Item> GetDownItems() { return(Items.Where(i => i.GetOrder() > 4).OrderBy(i => i.GetOrder()));; }
public List<Item> GetItemsByDefindex (int defindex) { return Items.Where(item => item.Defindex == defindex).ToList(); }
public static bool HasItem(this Obj_AI_Hero hero, int id) { return hero != null && Items.HasItem(id, hero); }
private void ExecuteCreateNewDiagramCommand(object parameter) { Items.Clear(); }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return(Items.GetEnumerator()); }
public Gatherable? FindItemByName(string itemName) => Items.FindItemByName(itemName, Language);
public void LoadNextSlice() { if (LazyItems.Count > 0 || IsLastSliceLoaded || IsWorking) { return; } var offsetDate = 0; var offsetId = 0; TLInputPeerBase offsetPeer = new TLInputPeerEmpty(); var lastDialog = Items.OfType <TLDialog>().Last(x => x.TopMessage != null && x.TopMessage.Index > 0); if (lastDialog != null) { var lastMessage = lastDialog.TopMessage as TLMessageCommon; if (lastMessage != null) { offsetDate = lastMessage.DateIndex; offsetId = lastMessage.Index; if (lastMessage.ToId is TLPeerUser) { offsetPeer = !lastMessage.Out.Value ? DialogDetailsViewModel.PeerToInputPeer(new TLPeerUser { Id = lastMessage.FromId }) : DialogDetailsViewModel.PeerToInputPeer(lastMessage.ToId); } else { offsetPeer = DialogDetailsViewModel.PeerToInputPeer(lastMessage.ToId); } } } IsWorking = true; var offset = Items.Count; var limit = 30; MTProtoService.GetDialogsAsync(Stopwatch.StartNew(), new TLInt(offsetDate), new TLInt(offsetId), offsetPeer, new TLInt(limit), new TLInt(0), result => Execute.BeginOnUIThread(() => { lastDialog = result.Dialogs.LastOrDefault(x => x.TopMessageId != null) as TLDialog; if (lastDialog != null) { _maxId = lastDialog.TopMessageId.Value; } var itemsAdded = 0; foreach (var dialog in result.Dialogs) { if (!SkipDialogForBot(_bot, dialog)) { Items.Add(dialog); itemsAdded++; } } IsWorking = false; IsLastSliceLoaded = result.Dialogs.Count < limit; Status = LazyItems.Count > 0 || Items.Count > 0 ? string.Empty : Status; if (itemsAdded < (Constants.DialogsSlice / 2)) { LoadNextSlice(); } }), error => Execute.BeginOnUIThread(() => { IsWorking = false; Status = string.Empty; })); }
private void OnTopMessageUpdated(object sender, TopMessageUpdatedEventArgs e) { BeginOnUIThread(() => { try { e.Dialog.Typing = null; var currentPosition = Items.IndexOf(e.Dialog); var newPosition = currentPosition; for (var i = 0; i < Items.Count; i++) { if (// мигает диалог, если просто обновляется последнее сообщение, то номер становится на 1 больше // и сначала удаляем, а потом вставляем на туже позицию i != currentPosition && Items[i].GetDateIndex() <= e.Dialog.GetDateIndex()) { newPosition = i; break; } } if (currentPosition != newPosition) { if (currentPosition >= 0 && currentPosition < newPosition) { // т.к. будем сначала удалять диалог а потом вставлять, то // curPos + 1 = newPos - это вставка на тоже место и не имеет смысла // Update: имеет, т.к. обновляется инфа о последнем сообщении if (currentPosition + 1 == newPosition) { Items[currentPosition].NotifyOfPropertyChange(() => Items[currentPosition].Self); Items[currentPosition].NotifyOfPropertyChange(() => Items[currentPosition].UnreadCount); return; } Items.Remove(e.Dialog); Items.Insert(newPosition - 1, e.Dialog); } else { Items.Remove(e.Dialog); Items.Insert(newPosition, e.Dialog); } } else { // удалили сообщение и диалог должен переместиться ниже загруженной части списка if (!IsLastSliceLoaded && Items.Count > 0 && Items[Items.Count - 1].GetDateIndex() > e.Dialog.GetDateIndex()) { Items.Remove(e.Dialog); } Items[currentPosition].NotifyOfPropertyChange(() => Items[currentPosition].Self); Items[currentPosition].NotifyOfPropertyChange(() => Items[currentPosition].UnreadCount); } } catch (Exception ex) { throw ex; } }); }
public CodeTupleExpression(IEnumerable <CodeExpression> items) { Ensure.That(nameof(items)).IsNotNull(items); Items.AddRange(items); }
public ChooseDialogViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator) : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator) { FilteredItems = new CollectionViewSource { Source = Items }.View; FilteredItems.Filter += item => { var dialog = item as TLDialog; if (dialog != null) { var chat = dialog.With as TLChat41; if (chat != null) { return(!chat.IsMigrated); } var user = dialog.With as TLUser; if (user != null) { return(!user.IsSelf); } } var dialog71 = dialog as TLDialog71; if (dialog71 != null) { return(!dialog71.IsPromo); } return(true); }; EventAggregator.Subscribe(this); LogFileName = StateService.LogFileName; StateService.LogFileName = null; ForwardedMessages = StateService.ForwardMessages; StateService.ForwardMessages = null; SharedContact = StateService.SharedContact; StateService.SharedContact = null; _gameString = StateService.GameString; StateService.GameString = null; _accessToken = StateService.AccessToken; StateService.AccessToken = null; _bot = StateService.Bot; StateService.Bot = null; _webLink = StateService.WebLink; StateService.WebLink = null; _storageItems = StateService.StorageItems; StateService.StorageItems = null; _url = StateService.Url; StateService.Url = null; _text = StateService.UrlText; StateService.UrlText = null; _switchInlineButton = StateService.SwitchInlineButton; StateService.SwitchInlineButton = null; Status = AppResources.Loading; BeginOnThreadPool(() => { var isAuthorized = SettingsHelper.GetValue <bool>(Constants.IsAuthorizedKey); if (isAuthorized) { var dialogs = CacheService.GetDialogs(); var dialogsCache = new Dictionary <int, TLDialogBase>(); var clearedDialogs = new List <TLDialogBase>(); foreach (var dialog in dialogs) { if (!dialogsCache.ContainsKey(dialog.Index)) { var user = dialog.With as TLUser; if (user != null && user.IsSelf) { CurrentUser = dialog; } if (dialog is TLDialog || dialog is TLBroadcastDialog) { if (!SkipDialogForBot(_bot, dialog)) { clearedDialogs.Add(dialog); } dialogsCache[dialog.Index] = dialog; } } else { var cachedDialog = dialogsCache[dialog.Index]; if (cachedDialog.Peer is TLPeerUser && dialog.Peer is TLPeerUser) { CacheService.DeleteDialog(dialog); continue; } if (cachedDialog.Peer is TLPeerChat && dialog.Peer is TLPeerChat) { CacheService.DeleteDialog(dialog); continue; } } } if (CurrentUser == null) { var currentUser = CacheService.GetUser(new TLInt(StateService.CurrentUserId)); if (currentUser != null) { var dialog = new TLDialog71 { With = currentUser, Flags = new TLInt(0), Peer = new TLPeerUser { Id = currentUser.Id }, Messages = new ObservableCollection <TLMessageBase>(), TopMessageId = new TLInt(0), ReadInboxMaxId = new TLInt(0), ReadOutboxMaxId = new TLInt(0), UnreadCount = new TLInt(0), UnreadMentionsCount = new TLInt(0), NotifySettings = new TLPeerNotifySettings78 { Flags = new TLInt(0), MuteUntil = new TLInt(0), Sound = new TLString("Default") } }; CurrentUser = dialog; } } BeginOnUIThread(() => { NotifyOfPropertyChange(() => CurrentUser); foreach (var clearedDialog in clearedDialogs) { LazyItems.Add(clearedDialog); } var lastDialog = clearedDialogs.LastOrDefault(x => x.TopMessageId != null); _maxId = lastDialog != null ? lastDialog.TopMessageId.Value : 0; Status = LazyItems.Count == 0 ? AppResources.Loading : string.Empty; var importantCount = 0; var count = 0; for (var i = 0; i < LazyItems.Count && importantCount < FirstSliceLength; i++, count++) { Items.Add(LazyItems[i]); var chat41 = LazyItems[i].With as TLChat41; if (chat41 == null || chat41.MigratedTo == null) { importantCount++; } } BeginOnUIThread(TimeSpan.FromSeconds(0.5), () => { for (var i = count; i < LazyItems.Count; i++) { Items.Add(LazyItems[i]); } LazyItems.Clear(); LoadNextSlice(); }); }); } }); }
private static void Insec(AIHeroClient target) { //Orbwalking.MoveTo(Game.CursorPos); if (!_R.IsReady()) { return; } if (!target.IsValidTarget() || target.IsDead) { return; } var insecPos = GetInsecPosition(target); if (Player.Distance(insecPos) < 150) { _R.CastOnUnit(target); return; } switch (_menu.SubMenu("Insec").Item("method").GetValue <StringList>().SelectedValue) { case "Wardjump only": if (_W.IsReady() && Player.Mana >= 50) { if (Player.Distance(insecPos) <= 600) { var insecObj = GetInsecObject(insecPos.To3D(), 125); if (insecObj != null) { if (Player.Distance(insecObj.ServerPosition) <= 600) { _W.CastOnUnit(insecObj); } } else { var slot = Items.GetWardSlot(); if (slot.IsValidSlot() && Player.Spellbook.CanUseSpell(slot.SpellSlot) == SpellState.Ready) { Player.Spellbook.CastSpell(slot.SpellSlot, insecPos.To3D()); } return; } } if (!Items.GetWardSlot().IsValidSlot()) { return; } if (!_Q.IsReady()) { return; } if (Player.Mana >= 130 && Player.Distance(insecPos) > 600) { _insecQTarget = GetInsecQTarget(target); CastQCombo(target); } if (_target.HasBuff("BlindMonkQOne") && Player.Mana >= 80 && target.Distance(insecPos) <= 600) { _Q2.CastOnUnit(target); } } break; case "Flash Only": if (_F.Slot == SpellSlot.Unknown || !_F.IsReady()) { return; } if (Player.Distance(insecPos) < 425) { _F.Cast(insecPos); return; } if (!_Q.IsReady()) { return; } if (Player.Mana >= 80 && Player.Distance(insecPos) > 600) { _insecQTarget = GetInsecQTarget(target); CastQCombo(_insecQTarget); } if (_insecQTarget.HasBuff("BlindMonkQOne") && Player.Mana >= 80 && _insecQTarget.Distance(insecPos) <= 325) { _Q2.CastOnUnit(_insecQTarget); } break; default: if (_W.IsReady() && Player.Mana >= 50 && (Items.GetWardSlot().IsValidSlot() || _ward.IsValid)) { if (Player.Distance(insecPos) <= 600) { var insecObj = GetInsecObject(insecPos.To3D(), 600); if (insecObj != null) { _W.CastOnUnit(insecObj); } else { var slot = Items.GetWardSlot(); if (slot.IsValidSlot() && Player.Spellbook.CanUseSpell(slot.SpellSlot) == SpellState.Ready) { Player.Spellbook.CastSpell(slot.SpellSlot, insecPos.To3D()); } return; } } if (!Items.GetWardSlot().IsValidSlot()) { return; } if (!_Q.IsReady()) { return; } if (Player.Mana >= 130 && Player.Distance(insecPos) > 600) { _insecQTarget = GetInsecQTarget(target); CastQCombo(_insecQTarget); } if (_insecQTarget.HasBuff("BlindMonkQOne") && Player.Mana >= 80 && _insecQTarget.Distance(insecPos) <= 600) { _Q2.CastOnUnit(_insecQTarget); } } else if (_F.Slot != SpellSlot.Unknown && _F.IsReady() && _W.IsReady()) { var insecObj = GetInsecObject(insecPos.To3D(), 600); if (insecObj != null) { return; } if (Player.Distance(insecPos) < 400 && _F.Slot != SpellSlot.Unknown && _F.IsReady()) { _F.Cast(insecPos); return; } if (!_Q.IsReady()) { return; } if (Player.Mana >= 80 && Player.Distance(insecPos) > 600) { CastQCombo(GetInsecQTarget(target)); } if (_insecQTarget.HasBuff("BlindMonkQOne") && Player.Mana >= 80 && target.Distance(insecPos) <= 325) { _Q2.Cast(); } } break; } //EloBuddy.Player.IssueOrder(GameObjectOrder.MoveTo, Game.CursorPos); //Orbwalking.MoveTo(Game.CursorPos); }
internal void RemoveItem(ShopCartItem item) { Items.Remove(GetByProductId(item.ProductId)); CalculatingShopCartTotalPrice(); }
IEnumerator <T> IEnumerable <T> .GetEnumerator() { return(Items.GetEnumerator()); }
private void RemoveLadderTabItem(LadderTabItem tabItem) { tabItem.MouseDown -= TabItem_MouseDown; tabItem.ClearElements(); Items.Remove(tabItem); }
public static bool HasItem(this Obj_AI_Hero hero, ItemId item) { return hero != null && Items.HasItem((int) item, hero); }
public bool Contains(IItem item) => Items.Contains(item);
protected override void BaseAdd(int index, ConfigurationElement element) { Items.Insert(index, (T)element); base.BaseAdd(index, element); }
public Item GetItem (ulong id) { return (Items == null ? null : Items.FirstOrDefault(item => item.Id == id)); }
private void AddLadderTabItem(LadderTabItem tabItem) { tabItem.MouseDown += TabItem_MouseDown; Items.Add(tabItem); }
/// <summary> /// Adds element to enumerable collection and calls base add /// </summary> /// <param name="element"></param> protected override void BaseAdd(ConfigurationElement element) { Items.Add((T)element); base.BaseAdd(element); }
public async override Task InitializeAsync() { await Task.Run(() => { var strParas = item.ParaValue.Split('|'); Items.Clear(); #region 区域 if (item.ParaName == "一次网参数" || item.ParaName == "二次高区参数" || item.ParaName == "二次中区参数" || item.ParaName == "二次低区参数") { string i = item.Id; i = i.Replace("Area", ""); if (StationCode[$"sp{i}visible"] == "True") //if(true) { Items.Add(new ItemStationDetail() { ParaName = "供水压力", Id = "供水压力", ParaValue = string.Format("当前值:{0}Mpa\r\n上限值:{1}Mpa\r\n下限值:{2}Mpa", strParas[10], strParas[0], strParas[1]), TextColor = (Color) new BoolToWarningColorConverter(). StringConvert(GatherData[$"alarm_sp{i}sign"]) }); } if (StationCode[$"lp{i}visible"] == "True") //if(true) { Items.Add(new ItemStationDetail() { ParaName = "回水压力", Id = "回水压力", ParaValue = string.Format("当前值:{0}Mapa\r\n上限值:{1}Mpa\r\n下限值:{2}Mpa", strParas[11], strParas[2], strParas[3]), TextColor = (Color) new BoolToWarningColorConverter(). StringConvert(GatherData[$"alarm_lp{i}sign"]) }); } if (StationCode[$"st{i}visible"] == "True") //if(true) { Items.Add(new ItemStationDetail() { ParaName = "供水温度", Id = "供水温度", ParaValue = string.Format("当前值:{0}℃\r\n上限值:{1}℃\r\n下限值:{2}℃ ", strParas[12], strParas[4], strParas[5]), TextColor = (Color) new BoolToWarningColorConverter(). StringConvert(GatherData[$"alarm_st{i}sign"]) }); } if (StationCode[$"lt{i}visible"] == "True") //if(true) { Items.Add(new ItemStationDetail() { ParaName = "回水温度", Id = "回水温度", ParaValue = string.Format("当前值:{0}℃\r\n上限值:{1}℃\r\n下限值:{2}℃", strParas[13], strParas[6], strParas[7]), TextColor = (Color) new BoolToWarningColorConverter(). StringConvert(GatherData[$"alarm_lt{i}sign"]) }); } if (StationCode[$"flow{i}visible"] == "True") //if(true) { Items.Add(new ItemStationDetail() { ParaName = "流量", Id = "流量", ParaValue = string.Format("当前值:{0}\r\n上限值:{1}\r\n下限值:{2}", strParas[14], strParas[8], strParas[9]), TextColor = (Color) new BoolToWarningColorConverter(). StringConvert(GatherData[$"alarm_flow{i}sign"]) }); } } #endregion #region 水箱 else if (item.ParaName == "水箱参数") { float waterboxHeight = float.Parse(strParas[0]); Items.Add(new ItemStationDetail() { ParaName = "水箱真实高度", Id = "水箱真实高度", ParaValue = string.Format("{0}cm", strParas[0]), }); Items.Add(new ItemStationDetail() { ParaName = "水箱液位高度", Id = "水箱液位高度", ParaValue = string.Format("{0}cm", strParas[7]), }); float rate = float.Parse(strParas[1]); Items.Add(new ItemStationDetail() { ParaName = "水箱补水比例和高度", Id = "水箱补水比例和高度", ParaValue = string.Format("补水高度:{0}cm\r\n补水比例:{1}", rate *waterboxHeight, rate), }); rate = float.Parse(strParas[2]); Items.Add(new ItemStationDetail() { ParaName = "水箱停水比例和高度", Id = "水箱停水比例和高度", ParaValue = string.Format("停水高度:{0}cm\r\n停水比例:{1}", rate *waterboxHeight, rate), }); rate = float.Parse(strParas[3]); Items.Add(new ItemStationDetail() { ParaName = "水箱上限比例和高度", Id = "水箱上限比例和高度", ParaValue = string.Format("上限高度:{0}cm\r\n上限比例:{1}", rate *waterboxHeight, rate), }); rate = float.Parse(strParas[4]); Items.Add(new ItemStationDetail() { ParaName = "水箱下限比例和高度", Id = "水箱下限比例和高度", ParaValue = string.Format("下限高度:{0}cm\r\n下限比例:{1}", rate *waterboxHeight, rate), }); } #endregion //else if (item.ParaName == "补水压力设备参数") //{ //} #region 总调节阀 else if (item.ParaName == "总调节阀参数") { Items.Add(new ItemStationDetail() { ParaName = "开度上限", Id = "开度上限", ParaValue = string.Format("{0}", strParas[0]), }); Items.Add(new ItemStationDetail() { ParaName = "开度下限", Id = "开度下限", ParaValue = string.Format("{0}", strParas[1]), }); float percent = float.Parse(strParas[2]); Items.Add(new ItemStationDetail() { ParaName = "开度百分比", Id = "开度百分比", ParaValue = string.Format("{0}%", percent * 100), }); } #endregion #region 热量流量表 else if (item.ParaName == "热量流量表1参数" || item.ParaName == "热量流量表2参数") { Items.Add(new ItemStationDetail() { ParaName = "总热量", Id = "总热量", ParaValue = string.Format("{0}GJ", strParas[0]), }); Items.Add(new ItemStationDetail() { ParaName = "总流量", Id = "总流量", ParaValue = string.Format("{0}m3/h", strParas[1]), }); } #endregion #region 入出口温度 else if (item.ParaName == "入出口温度1参数" || item.ParaName == "入出口温度2参数") { Items.Add(new ItemStationDetail() { ParaName = "入口温度", Id = "入口温度", ParaValue = string.Format("{0}℃", strParas[0]), }); Items.Add(new ItemStationDetail() { ParaName = "出口温度", Id = "出口温度", ParaValue = string.Format("{0}℃", strParas[1]), }); } #endregion #region 变频控制 else if (item.ParaName.Contains("变频控制") == true) { string ii = item.Id; ii = ii.Replace("FC", ""); int i = int.Parse(ii); if (i <= 6) { Items.Add(new ItemStationDetail() { ParaName = "频率", Id = "频率", ParaValue = string.Format("{0}Hz", strParas[0]), TextColor = (Color) new BoolToWarningColorConverter(). StringConvert(GatherData[$"alarm_fc{i}sign"]) }); Items.Add(new ItemStationDetail() { ParaName = "转速", Id = "转速", ParaValue = string.Format("{0}r/min", strParas[1]), }); Items.Add(new ItemStationDetail() { ParaName = "电流", Id = "电流", ParaValue = string.Format("{0}A", strParas[2]), }); } else { Items.Add(new ItemStationDetail() { ParaName = "频率", Id = "频率", ParaValue = string.Format("{0}Hz", strParas[0]), TextColor = (Color) new BoolToWarningColorConverter(). StringConvert(GatherData[$"alarm_fc{i}sign"]) }); } } #endregion }); IsInitialize = true; }
internal ShopCartItem GetByProductId(Guid productId) { return(Items.FirstOrDefault(p => p.ProductId == productId)); }
public void Clear() => Items.Clear();
internal bool ShopCartItemExists(ShopCartItem item) { return(Items.Any(p => p.ProductId == item.ProductId)); }
protected override void GenerateInner(CodeGenerator generator) { generator.Write(TokenType.Punctuation, '('); Items.GenerateCommaSeparated(generator); generator.Write(TokenType.Punctuation, ')'); }
internal void CalculatingShopCartTotalPrice() { TotalPrice = Items.Sum(p => p.CalculatingQuantityPrice()); CalculateTotalDiscountValue(); }
/// <summary> /// Sorts the items of the collection in ascending order according to a key. /// </summary> /// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector"/>.</typeparam> /// <param name="keySelector">A function to extract a key from an item.</param> public void Sort <TKey>(Func <T, TKey> keySelector) { InternalSort(Items.OrderBy(keySelector)); }
public IEnumerable <Item> GetTopItems() { return(Items.Where(i => i.GetOrder() < 4).OrderBy(i => i.GetOrder())); }
/// <summary> /// Sorts the items of the collection in descending order according to a key. /// </summary> /// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector"/>.</typeparam> /// <param name="keySelector">A function to extract a key from an item.</param> public void SortDescending <TKey>(Func <T, TKey> keySelector) { InternalSort(Items.OrderByDescending(keySelector)); }
public ResourcesPage(IEditor <CampaignFile> editor_) { editor = editor_; Style = "no-padding vertical"; Spacing = 4; Items.Add(new StackLayoutItem(actionsLayout = new StackLayout() { Style = "no-padding horizontal", Spacing = 4, Items = { (addResourceButton = new Button(OnAddResource) { Image = Resources.GetIcon("AddGreen.ico", 16), Text = "Add new resource" }), //null, (editResourceButton = new Button(OnEditResource) { Image = Resources.GetIcon("Pencil.ico", 16), Text = "Edit resource properties" }), (removeResourceButton = new Button(OnRemoveResource) { Image = Resources.GetIcon("CloseRed.ico", 16), Text = "Delete resource" }) } }, false)); Items.Add(new StackLayoutItem(resourceGrid = new GridView <CampaignResource>() { DataStore = (collection = new ObservableCollection <CampaignResource>()), GridLines = GridLines.Both, ContextMenu = new ContextMenu() { Items = { (addResourceMenuButton = new ButtonMenuItem(OnAddResource) { Text = "Add new", Image = Resources.GetIcon("AddGreen.ico") }), (editResourceMenuButton = new ButtonMenuItem(OnEditResource) { Text = "Edit", Image = Resources.GetIcon("Pencil.ico") }), (removeResourceMenuButton = new ButtonMenuItem(OnRemoveResource) { Text = "Delete", Image = Resources.GetIcon("CloseRed.ico") }) } }, Columns = { (resourceTypeColumn = new GridColumn() { HeaderText = "Ressource Type", Width = 128, DataCell = new TextBoxCell() { Binding = Binding.Property <CampaignResource,string>(res => $"{res.resource_type}"), }, Editable = false, Resizable = true }), /*(resourceIdColumn = new GridColumn() * { * HeaderText = "Unique ID", * Width = 230, * DataCell = new TextBoxCell() * { * Binding = Binding.Property<CampaignResource, string>(res => $"{res.guid}"), * }, * Editable = false, * Resizable = true * }),*/ (resourceFileColumn = new GridColumn() { HeaderText = "Main File", Width = 250, DataCell = new TextBoxCell() { Binding = Binding.Property <CampaignResource,string>(res => $"{res.file}"), }, Editable = false, Resizable = true }), (resourceDependenciesColumn = new GridColumn() { HeaderText = "Number of files", Width = 120, DataCell = new TextBoxCell() { Binding = Binding.Property <CampaignResource,string>(res => $"{(res.required_files == 0 ? "none" : $"{res.required_files} file(s)")}"), },