void resetCountries(string countryText) { JSONNode countries = JSON.Parse(countryText); int len = countries.Count; allCountries = new CountryCard[len]; for (System.Int32 i = 0; i < len; i++) { //Debug.Log(items["destructive"]["public"][i].ToString()); CountryCard card = Instantiate <CountryCard>(countryCardPrefab); card.transform.parent = canvas.transform; card.initCard(countries[i]); int offset = 0; if (i == 1) { offset = -3; } card.transform.localPosition = new Vector3(LEFTMOST_CARD + i * CARD_SPACING, COUNTRY_CARD_Y + offset, CARD_Z); card.transform.localScale = new Vector3(CARD_SCALE, CARD_SCALE, CARD_SCALE); if (i == 0) { card.transform.localRotation = Quaternion.AngleAxis(-COUNTRY_Y_ROTATION, Vector3.up); } else if (i == 2) { card.transform.localRotation = Quaternion.AngleAxis(COUNTRY_Y_ROTATION, Vector3.up); } card.GetComponent <Button>().onClick.AddListener(() => playerClickCountry(card)); allCountries[i] = card; } }
private async Task <DialogTurnResult> GetUsersCountryStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { if (stepContext.Context.Activity.Text != null) { stepContext.Context.Activity.Text = null; return(await stepContext.NextAsync(cancellationToken)); } await stepContext.Context.SendActivityAsync( MessageFactory.Text("Please select a valid country from the list and hit the 'Submit' button"), cancellationToken); var cardAttachment = CountryCard.Create(); var reply = stepContext.Context.Activity.CreateReply(); reply.Attachments = new List <Attachment> { cardAttachment }; await stepContext.Context.SendActivityAsync(reply, cancellationToken); return(await stepContext.PromptAsync(Constants.CountryPrompt, new PromptOptions { Prompt = new Activity { Text = string.Empty, Type = ActivityTypes.Message, } }, cancellationToken)); }
public async void AddCountryCard(string countryname, Int64 casesdata, string pictureurl) { CountryCard cc = new CountryCard(countryname, casesdata, pictureurl); flowLayoutPanel1.Controls.Add(cc); await Task.CompletedTask; }
//first Step private async Task <DialogTurnResult> GetUsersCountryStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var cardAttachment = CountryCard.Create(); var reply = stepContext.Context.Activity.CreateReply(); reply.Attachments = new List <Attachment> { cardAttachment }; await stepContext.Context.SendActivityAsync(reply, cancellationToken); return(await stepContext.PromptAsync("country", new PromptOptions { Prompt = new Activity { Text = string.Empty, Type = ActivityTypes.Message, } }, cancellationToken)); }
public void playerClickCountry(CountryCard card) { currentWeapon.attacking = card; LineRenderer lr = currentWeapon.GetComponent <LineRenderer>(); lr.enabled = true; lr.SetPosition(0, currentWeapon.transform.position); lr.SetPosition(1, card.transform.position); foreach (WeaponCard c in allWeapons) { if (c.attacking == null) { c.GetComponent <Button>().interactable = true; } else { c.GetComponent <Button>().interactable = false; } } foreach (CountryCard c in allCountries) { c.GetComponent <Button>().interactable = false; } }