public void ShowCard(GameObject newObjectPos, ActionsData newAction) { this.popup_Card.transform.position = new Vector3(newObjectPos.transform.position.x + 300f, newObjectPos.transform.position.y, newObjectPos.transform.position.z); this.popup_Card.GetComponent <PopupGenerator> ().GenerateCard(newAction); this.GenerateKeywords(this.popup_Card); this.popup_Card.SetActive(true); }
public void UpdateActionsSlotImages() { if (this.summoner.id != 0) { for (int i = 0; i < this.summoner.L_skills.Count; i++) { ActionsData actionTemp = DictionaryManager.GetAction(this.summoner.L_skills [i]); this.skillContainer.transform.GetChild(i).GetComponent <PopupElement> ().action = actionTemp; this.skillContainer.transform.GetChild(i).GetComponent <Image> ().color = DictionaryManager.ActionColor(actionTemp.color); this.skillContainer.transform.GetChild(i).GetChild(0).GetChild(0).GetComponent <Image> ().sprite = Resources.Load <Sprite> ("skill_icons/" + actionTemp.id); this.skillContainer.transform.GetChild(i).GetChild(2).gameObject.SetActive(false); } } else { for (int i = 0; i < this.support.L_skills.Count; i++) { ActionsData actionTemp = DictionaryManager.GetAction(this.support.L_skills [i]); this.skillContainer.transform.GetChild(i).GetComponent <PopupElement> ().action = actionTemp; this.skillContainer.transform.GetChild(i).GetComponent <Image> ().color = DictionaryManager.ActionColor(actionTemp.color); this.skillContainer.transform.GetChild(i).GetChild(0).GetChild(0).GetComponent <Image> ().sprite = Resources.Load <Sprite> ("skill_icons/" + actionTemp.id); this.skillContainer.transform.GetChild(i).GetChild(2).gameObject.SetActive(false); } } }
public void GenerateSupport(int newInt) { for (int i = 0; i < CampaignManager.playerTeam.supports.Length; i++) { SupportData supportScript = CampaignManager.playerTeam.supports[i]; GameObject supportGO = Instantiate(this.charactrerPanelPrefab, this.characterContainer.transform.position, this.transform.rotation, this.characterContainer.transform) as GameObject; supportGO.name = supportScript.supportName; supportGO.transform.GetChild(0).GetChild(0).GetComponent <Text> ().text = supportScript.supportName; supportGO.transform.GetChild(1).GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite> ("character_avatars/" + supportScript.idAvatar); supportGO.transform.GetChild(2).gameObject.SetActive(false); //supportGO.transform.GetChild (2).GetChild (0).GetChild (0).GetComponent<Text> ().text = supportScript.pv.ToString() + " / " + supportScript.pvMax.ToString (); //supportGO.transform.GetChild (2).GetChild (1).GetChild (0).GetComponent<Text> ().text = supportScript.force.ToString (); //supportGO.transform.GetChild (2).GetChild (2).GetChild (0).GetComponent<Text> ().text = supportScript.armure.ToString (); supportGO.transform.GetChild(3).GetChild(0).GetChild(0).GetComponent <Text> ().text = supportScript.nbSkillSlots.ToString(); supportGO.transform.GetChild(3).GetChild(1).GetChild(0).GetComponent <Text> ().text = supportScript.nbDice.ToString() + " / " + supportScript.nbDiceMax.ToString(); supportGO.GetComponent <PopupElement> ().support = supportScript; supportGO.GetComponent <PopupElement> ().characterType = 2; supportGO.GetComponent <PopupElement> ().characterId = i; if (newInt == 1) { supportGO.GetComponent <Button> ().enabled = false; supportGO.GetComponent <Outline> ().enabled = false; } else { if (supportScript.nbDice == supportScript.nbDiceMax) { supportGO.GetComponent <Button> ().enabled = false; supportGO.GetComponent <Outline> ().enabled = false; } } for (int j = 0; j < supportScript.nbSkillSlots; j++) { ActionsData actionTemp = DictionaryManager.GetAction(supportScript.L_skills [j]); GameObject skillGO = Instantiate(this.skillAttributionPrefab, this.transform.position, this.transform.rotation, supportGO.transform.GetChild(4)) as GameObject; skillGO.name = actionTemp.name; skillGO.transform.GetChild(1).GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite> ("skill_icons/" + actionTemp.id); skillGO.transform.GetChild(2).GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite> ("action_type_" + actionTemp.type); skillGO.transform.GetChild(3).GetComponent <Text> ().text = actionTemp.name; skillGO.GetComponent <Image> ().color = DictionaryManager.ActionColor(actionTemp.color); skillGO.GetComponent <PopupElement> ().action = actionTemp; skillGO.GetComponent <PopupElement> ().support = supportScript; skillGO.GetComponent <PopupElement> ().characterType = 2; skillGO.GetComponent <PopupElement> ().characterId = i; skillGO.GetComponent <PopupElement> ().teamId = j; if (newInt == 2) { skillGO.GetComponent <Button> ().enabled = false; skillGO.GetComponent <Outline> ().enabled = false; } } } }
public Card(int newUId, GameObject newOwner, int newOwnerType, int newDiceId, ActionsData newAction) { this.uId = newUId; this.owner = newOwner; this.OwnerType = newOwnerType; this.diceId = newDiceId; this.action = newAction; this.tempAction = this.action; }
public void GenerateCard(ActionsData newAction) { this.actionCard = newAction; this.GetComponent <CardPanel>().card = new Card(1, this.gameObject, 1, 1, newAction); this.name = this.actionCard.id.ToString(); this.transform.GetChild(2).GetComponentInChildren <Text>().text = this.actionCard.name; this.transform.GetChild(3).GetComponentInChildren <Text>().text = DictionaryManager.GetCardDescription(this.GetComponent <CardPanel>().card); this.transform.GetChild(1).GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite> ("skill_icons/" + this.actionCard.id); this.transform.GetChild(0).GetComponent <Image>().sprite = this.cardBackgrounds[this.actionCard.color]; this.transform.GetChild(4).GetChild(0).GetComponent <Image> ().sprite = Resources.Load <Sprite> ("action_type_" + this.actionCard.type); }
public async Task <IActionResult> CreateAction(ActionsData ActionAdd) { HttpClient client = _api.initial(); var ajouter = await client.PostAsJsonAsync <ActionsData>("api/Actions", ActionAdd); //Microsoft.AspNet.WebApi.Client if (ajouter.IsSuccessStatusCode) { return(RedirectToAction("Index")); } return(View()); }
public static ActionsData GetAction(int newActionId) { ActionsData action; actionsDictionary.TryGetValue(newActionId, out action); ActionsData actionTemp = new ActionsData(); actionTemp.id = action.id; actionTemp.name = action.name; actionTemp.description = action.description; actionTemp.price = action.price; actionTemp.type = action.type; actionTemp.color = action.color; actionTemp.targetType = action.targetType; actionTemp.combatActions = new CombatActionData[action.combatActions.Length]; actionTemp.upgradeRequirements = action.upgradeRequirements; for (int i = 0; i < action.combatActions.Length; i++) { actionTemp.combatActions [i].target = action.combatActions [i].target; actionTemp.combatActions [i].modulateur = action.combatActions [i].modulateur; actionTemp.combatActions [i].damage = action.combatActions [i].damage; actionTemp.combatActions [i].typeDmg = action.combatActions [i].typeDmg; actionTemp.combatActions [i].colorDmg = action.combatActions [i].colorDmg; actionTemp.combatActions [i].idAnim = action.combatActions [i].idAnim; actionTemp.combatActions [i].etats = new CombatEtatData[action.combatActions [i].etats.Length]; for (int j = 0; j < action.combatActions [i].etats.Length; j++) { actionTemp.combatActions [i].etats [j].target = action.combatActions [i].etats [j].target; actionTemp.combatActions [i].etats [j].modulateur = action.combatActions [i].etats [j].modulateur; actionTemp.combatActions [i].etats [j].idEtat = action.combatActions [i].etats [j].idEtat; actionTemp.combatActions [i].etats [j].duration = action.combatActions [i].etats [j].duration; actionTemp.combatActions [i].etats [j].value = action.combatActions [i].etats [j].value; } actionTemp.combatActions [i].conditions = new ActionCondition[action.combatActions [i].conditions.Length]; for (int j = 0; j < action.combatActions [i].conditions.Length; j++) { actionTemp.combatActions [i].conditions [j].target = action.combatActions [i].conditions [j].target; actionTemp.combatActions [i].conditions [j].type = action.combatActions [i].conditions [j].type; actionTemp.combatActions [i].conditions [j].mod = action.combatActions [i].conditions [j].mod; actionTemp.combatActions [i].conditions [j].value = action.combatActions [i].conditions [j].value; } } return(actionTemp); }
public static void GenerateAvailableSkills() { for (int i = 0; i < cardsAvailableId.Length; i++) { cardsAvailableId [i] = Random.Range(0, DictionaryManager.actionsDictionary.Count); } for (int i = 0; i < cardsAvailableId.Length; i++) { ActionsData actionTemp = DictionaryManager.GetAction(cardsAvailableId[i]); int priceMin = actionTemp.price - ((actionTemp.price * 20) / 100); int priceMax = actionTemp.price + ((actionTemp.price * 20) / 100); actionTemp.price = Random.Range(priceMin, priceMax); cardAvailable [i] = actionTemp; } }
public void GenerateCard(GameObject newOwner, int newCharacterType, int newSkillId, int newDiceId) { //ActionsData action; //DictionaryManager.actionsDictionary.TryGetValue (newSkillId, out action); ActionsData tempAction = DictionaryManager.GetAction(newSkillId); Card tempCard = new Card(this.cardGeneratedId, newOwner, newCharacterType, newDiceId, tempAction); tempCard.IsLaunchable(this.previousCardPlayed); this.cardGeneratedId += 1; this.L_Cards.Add(tempCard); if (newCharacterType == 1 || newCharacterType == 3) { for (int i = 0; i < this.L_etats.Count; i++) { tempCard.UpdateCard(this.L_etats [i], new CombatEtatData(), 1); } } else { for (int i = 0; i < newOwner.GetComponent <Support> ().L_etats.Count; i++) { tempCard.UpdateCard(newOwner.GetComponent <Support> ().L_etats [i], new CombatEtatData(), 1); } for (int i = 0; i < this.L_etats.Count; i++) { tempCard.UpdateCard(this.L_etats [i], new CombatEtatData(), 1); } } if (CardGenerated != null && this.characterType != 3) { CardGenerated(tempCard); } this.charactersInfosPanel.GetComponent <CharacterInfosPanel>().UpdateDice(newDiceId, tempCard); if (this.characterType == 3) { this.L_CardsToApply.Add(new ActionToResolve(this.gameObject, this.cardTarget, tempCard, this.previousCardPlayed)); this.selectedCard = null; this.charactersInfosPanel.GetComponent <CharacterInfosPanel>().ShowActionDice(newDiceId); } //print (this.summonerName + ": jai genere: " + action.name + " / launchable: " + tempCard.isLaunchable + " / j'ai : " + this.L_Cards.Count); }
public static List <string> GetKeywords(ActionsData newAction) { List <string> keywords = new List <string> (); if (newAction.description.Contains("[DEFENSE]")) { string tempString; tempString = "Défense: permet de réduire les dégats reçus"; keywords.Add(tempString); } if (newAction.description.Contains("[FORCE]")) { string tempString; tempString = GetEtat(10).description; keywords.Add(tempString); } return(keywords); }
public void GenerateActionsPopup() { for (int i = 0; i < DictionaryManager.actionsDictionary.Count; i++) { GameObject actionElementTemp = Instantiate(this.actionElementPrefab, this.transform.GetChild(2).position, this.transform.rotation, this.transform.GetChild(2).GetChild(0)) as GameObject; ActionsData actionTemp = DictionaryManager.actionsDictionary [i]; actionElementTemp.name = actionTemp.name; actionElementTemp.transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite> ("skill_icons/" + actionTemp.id); actionElementTemp.transform.GetChild(1).GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite> ("action_type_" + actionTemp.type); actionElementTemp.transform.GetChild(2).GetComponent <Text> ().text = actionTemp.name; actionElementTemp.GetComponent <Image> ().color = DictionaryManager.ActionColor(actionTemp.color); actionElementTemp.GetComponent <PopupElement> ().action = actionTemp; this.actionsGoList.Add(actionElementTemp); } this.actionsGoList.Sort(SortByName); for (int i = 0; i < this.actionsGoList.Count; i++) { this.actionsGoList [i].transform.SetSiblingIndex(i); } }
public static void LoadCampaign() { Campaign campaignTemp = JsonSave.LoadCampaign(); gold = campaignTemp.gold; soul = campaignTemp.soul; day = campaignTemp.day; actionDone = campaignTemp.actionDone; combatEnded = campaignTemp.combatEnded; isBossFight = campaignTemp.isBossFight; isEditor = false; isCampaignGenerated = campaignTemp.isCampaignGenerated; goldReward = campaignTemp.goldReward; soulReward = campaignTemp.soulReward; daysToRemove = campaignTemp.daysToRemove; bossTeamId = campaignTemp.bossTeamId; monstersAvailableId = campaignTemp.monstersAvailableId; cardsAvailableId = campaignTemp.cardsAvailableId; finalBossTeam = L_bossTeams [bossTeamId]; for (int i = 0; i < monstersAvailableId.Length; i++) { monstersAvailable [i] = L_campaignTeams [monstersAvailableId[i]]; } for (int i = 0; i < cardsAvailableId.Length; i++) { ActionsData actionTemp = DictionaryManager.GetAction(cardsAvailableId[i]); int priceMin = actionTemp.price - ((actionTemp.price * 20) / 100); int priceMax = actionTemp.price + ((actionTemp.price * 20) / 100); actionTemp.price = Random.Range(priceMin, priceMax); cardAvailable [i] = actionTemp; } }
public ActionContainer(IServiceActivator serviceActivator, IOptions <ActionsData> options) : base(serviceActivator) { ActionsData = options.Value; _actions = new Lazy <IEnumerable <IAction> >(CreateActions); }
public void Notify(string title, string message, string actionButtonTitle, string callbackArgs) { // Reference: https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/adaptive-interactive-toasts ToastData toastData = new ToastData(); toastData.Visual = new VisualData(); BindingData binding = new BindingData(); toastData.Visual.Binding = binding; // ToastGeneric- Our toast contains VFSForGit icon and text binding.Template = "ToastGeneric"; binding.Items = new XmlList <BindingItem>(); binding.Items.Add(new BindingItem.TextData(title)); binding.Items.Add(new BindingItem.TextData(message)); string logo = "file:///" + Path.Combine(ProcessHelper.GetCurrentProcessLocation(), ScalarIconName); binding.Items.Add(new BindingItem.ImageData() { Source = logo, Placement = "appLogoOverride", HintCrop = "circle" }); if (!string.IsNullOrEmpty(actionButtonTitle)) { ActionsData actionsData = new ActionsData(); actionsData.Actions = new XmlList <ActionItem>(); actionsData.Actions.Add(new ActionItem() { Content = actionButtonTitle, Arguments = string.IsNullOrEmpty(callbackArgs) ? string.Empty : callbackArgs, ActivationType = "background" }); toastData.Actions = actionsData; } XmlDocument toastXml = new XmlDocument(); using (StringWriter stringWriter = new StringWriter()) using (XmlWriter xmlWriter = XmlWriter.Create(stringWriter, new XmlWriterSettings { OmitXmlDeclaration = true })) { XmlSerializer serializer = new XmlSerializer(toastData.GetType()); XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces(); namespaces.Add(string.Empty, string.Empty); serializer.Serialize(xmlWriter, toastData, namespaces); toastXml.LoadXml(stringWriter.ToString()); } ToastNotification toastNotification = new ToastNotification(toastXml); toastNotification.Activated += this.ToastActivated; toastNotification.Dismissed += this.ToastDismissed; toastNotification.Failed += this.ToastFailed; ToastNotifier toastNotifier = ToastNotificationManager.CreateToastNotifier(ServiceAppId); toastNotifier.Show(toastNotification); }