public void ChangeTopic() { List <ITopic> topics = new List <ITopic>(); if (View.Visible && AvatarId != 0) { topics.Add(Topics.For(MaskedStruct.SimPage_Main, AvatarId)); switch (View.CurrentTab) { case UIPersonPageTab.Description: topics.Add(Topics.For(MaskedStruct.SimPage_DescriptionPanel, AvatarId)); break; case UIPersonPageTab.Accomplishments: topics.Add(Topics.For(MaskedStruct.SimPage_SkillsPanel, AvatarId)); topics.Add(Topics.For(MaskedStruct.SimPage_JobsPanel, AvatarId)); break; case UIPersonPageTab.Relationships: //if we're due a relationship poll on our own avatar, perform it. if (MyRelDirty) { MyRelDirty = false; DataService.Request(MaskedStruct.FriendshipWeb_Avatar, Network.MyCharacter); MyRelPollTimeout = GameThread.SetTimeout(() => { MyRelDirty = true; }, 60000); } break; } } Topic.Set(topics); }
public void HoverTile(int x, int y) { //Slight delay CurrentHoverLot.Value = null; if (HoverTimeout != null) { HoverTimeout.Clear(); } if (Realestate.IsPurchasable((ushort)x, (ushort)y)) { HoverTimeout = GameThread.SetTimeout(() => { var id = MapCoordinates.Pack((ushort)x, (ushort)y); var occupied = IsTileOccupied(x, y); DataService.Get <Lot>(id).ContinueWith(lot => { CurrentHoverLot.Value = lot.Result; //Not loaded yet if (lot.Result.Lot_Price == 0) { if (occupied) { DataService.Request(MaskedStruct.MapView_RollOverInfo_Lot, id); } else { DataService.Request(MaskedStruct.MapView_RollOverInfo_Lot_Price, id); } } }); }, 250); } }
public void Invoke(Callback callback) { if (ThreadTimeout != null) { ThreadTimeout.Clear(); } ; ThreadTimeout = GameThread.SetTimeout(callback, Timeout); }
public void Show(uint avatarId) { View.TrySaveDescription(); AvatarId = avatarId; DataService.Get <Avatar>(avatarId).ContinueWith(x => { View.CurrentAvatar.Value = x.Result; }); DataService.Request(MaskedStruct.MyAvatar, avatarId); if (View.MyAvatar.Value == null) { DataService.Get <Avatar>(Network.MyCharacter).ContinueWith(x => { View.MyAvatar.Value = x.Result; if (x.Result != null && x.Result.Avatar_LotGridXY != 0 && (View.MyLot.Value == null || View.MyLot.Value.Lot_Location_Packed != x.Result.Avatar_LotGridXY)) { DataService.Request(MaskedStruct.AdmitInfo_Lot, x.Result.Avatar_LotGridXY).ContinueWith(y => { View.MyLot.Value = (Lot)y.Result; }); } }); } else { if (View.MyAvatar.Value != null && View.MyAvatar.Value.Avatar_LotGridXY != 0 && (View.MyLot.Value == null || View.MyLot.Value.Lot_Location_Packed != View.MyAvatar.Value.Avatar_LotGridXY)) { DataService.Request(MaskedStruct.AdmitInfo_Lot, View.MyAvatar.Value.Avatar_LotGridXY).ContinueWith(y => { View.MyLot.Value = (Lot)y.Result; }); } } //if we're due a relationship poll on our own avatar, perform it. if (MyRelDirty) { MyRelDirty = false; DataService.Request(MaskedStruct.FriendshipWeb_Avatar, Network.MyCharacter); MyRelPollTimeout = GameThread.SetTimeout(() => { MyRelDirty = true; }, 60000); } View.CurrentTab = UIPersonPageTab.Description; View.SetOpen(false); View.Parent.Add(View); View.Visible = true; ChangeTopic(); }
private void Price_OnChange(UIElement element) { var input = (UITextEdit)element; var price = input.CurrentText; var isValid = VMEODRackOwnerPlugin.PRICE_VALIDATION.IsMatch(price); if (!isValid) { //TODO: Text box does not seem to like been updated in the update event loop, fix this return; /*for (var i = 0; i < price.Length; i++) { * if (!Char.IsDigit(price[i])) { * price = price.Substring(i, 1); * i--; * } * } * * if (price.Length == 0) { price = "1"; } * if (price[0] == '0') { * price = "1" + price.Substring(1); * } * * input.CurrentText = price;*/ } //Mark as dirty var newSalePrice = -1; if (!int.TryParse(price, out newSalePrice)) { return; } var buttonIndex = Array.IndexOf(OutfitPrices, input); if (buttonIndex == -1) { return; } var priceIndex = GetPriceIndex(buttonIndex); if (priceIndex == -1) { return; } var outfit = Stock[priceIndex]; //Which outfit is this for? lock (DirtyPrices) { DirtyPrices[outfit.outfit_id] = newSalePrice; } if (DirtyTimeout != null) { DirtyTimeout.Clear(); } DirtyTimeout = GameThread.SetTimeout(() => FlushDirtyPrices(), 2000); }