public async static Task ShowClosestStores(IDialogContext context) { //simulate user position Random r = new Random(); Double[] coords = new Double[] { r.NextDouble() * 180 - 90, r.NextDouble() * 180 - 90 }; List <Store> stores = StoreController.getClosesStores(coords); var reply = context.MakeMessage(); reply.AttachmentLayout = AttachmentLayoutTypes.Carousel; List <Attachment> attachments = new List <Attachment>(); for (var i = 0; i < stores.Count() && i <= N_STORES_MAX; i++) { attachments.Add(StoreCard.GetStoreCard(stores[i]).ToAttachment()); } reply.Attachments = attachments; await Interactions.SendMessage(context, Interactions.getClosesStore(), 0, 2000); await context.PostAsync(reply); }
public Store(List <Mesh> meshes, Robot previewRobot, Part[] storeParts, List <Part> humanParts, Part[] robotParts, long credits, ConfigurationCard configurationCard, Color colorScheme, bool enableCreditsSpentAnimation) { MESHES = meshes; this.previewRobot = previewRobot; this.humanParts = humanParts; this.credits = credits; this.colorScheme = colorScheme; this.enableCreditsSpentAnimation = enableCreditsSpentAnimation; GameObject storePanel = GameObject.Find("StorePanel"); foreach (Transform child in storePanel.transform) { GameObject.Destroy(child.gameObject); } MASK = GameObject.Find("Store").transform.Find("StoreMask").gameObject; MASK.SetActive(false); this.robotParts = new List <Part>(); if (robotParts != null && robotParts.Length > 0) { this.robotParts.AddRange(robotParts); robot = new Robot("", true, true, this.robotParts.ToArray()); STORE_PARTS = new List <Part>(); STORE_PARTS.AddRange(storeParts); STORE_CARD = new StoreCard(this.credits, STORE_PARTS.ToArray(), this.humanParts.ToArray(), this.robotParts.ToArray(), colorScheme, enableCreditsSpentAnimation); STORE_CARD.enable(); CONFIGURATION_CARD = configurationCard; } mode = StoreCard.MODES.VIEW_PART_STATS; PERFORMANCE_METRIC_CALCULATOR = new PerformanceMetricCalculator(); partBought = null; partWithPreviewedTexture = null; }
public void SetupCards() { for (int i = 0; i < availableCards.Count; ++i) { StoreCard clickHandler = availableCards[i] .gameObject .AddComponent(typeof(StoreCard)) as StoreCard; clickHandler.onClick = HandleCardClick; } }
public static async Task ShowStores(IDialogContext context, string productId) { var reply = context.MakeMessage(); var storeCollection = DbSingleton.GetDatabase().GetCollection <Store>(AppSettings.StoreCollection); var filter = Builders <Store> .Filter.Empty; List <Store> stores = storeCollection.Find(filter).ToList(); List <Store> storesWStock = new List <Store>(); for (int i = 0; i < stores.Count(); i++) { for (int j = 0; j < stores[i].ProductsInStock.Count(); j++) { if (stores[i].ProductsInStock[j].ProductId.ToString().Equals(productId)) { if (stores[i].ProductsInStock[j].Stock > 0 && storesWStock.Count() <= N_STORES_MAX) { storesWStock.Add(stores[i]); break; } } } } var text = ""; if (storesWStock.Count() == 0) { reply.AttachmentLayout = AttachmentLayoutTypes.List; text = Interactions.getStockFail(); } else { text = Interactions.getStockSuccess(); reply.AttachmentLayout = AttachmentLayoutTypes.Carousel; List <Attachment> cards = new List <Attachment>(); for (var i = 0; i < storesWStock.Count() && i < 7; i++) { cards.Add(StoreCard.GetStoreDetailsCard(storesWStock[i], productId).ToAttachment()); } reply.Attachments = cards; } await Interactions.SendMessage(context, text, 0, 2000); await context.PostAsync(reply); }
public void setup(StoreCard _card, int _order) { manager = StoreManagerInterface.instance.manager; storeCard = _card; order = _order; gameObject.name = "card " + storeCard.card.name; colorSprite.color = new Color(storeCard.card.baseHighlightColor.r, storeCard.card.baseHighlightColor.g, storeCard.card.baseHighlightColor.b, 0.3f); //set the text nameField.text = storeCard.card.name; descField.text = storeCard.card.description; typeField.text = CardManager.instance.TypeNames [storeCard.card.type]; levelNumField.text = storeCard.card.cardLevel.ToString(); buyButton.text.text = "Buy $" + storeCard.cost.ToString(); }
private void Awake() { button = GetComponent <Button>(); card = GetComponentInParent <StoreCard>(); }