/// <summary> /// Loads the enemy ConcreteCard via level imformation. /// </summary> /// <param name="levelInfo">Level information.</param> void LoadEnemyConcreteCard(LevelInfo levelInfo) { LevelData levelData = levelInfo.leveldata; List <int> enemyLevels = new List <int> (); List <int> enemyAbilityLevels = new List <int> (); for (int i = 0; i < levelData.enemiesId.Count; i++) { enemyLevels.Add(levelData.level); enemyAbilityLevels.Add(levelData.enemiesAbilityLevel); } foreach (int i in levelData.bossIndices) { enemyLevels [i] += _bossLevelDelta; enemyAbilityLevels [i] += _bossAbilityLevelDelta; } for (int i = 0; i < levelData.enemiesId.Count; i++) { ConcreteCard enemyCard = _cardFactory.GeneConcreteCard(levelData.enemiesId [i], enemyLevels [i]); foreach (var ability in enemyCard.abilities) { int abilityLevel = enemyAbilityLevels [i]; if (abilityLevel > ability.maxLevel) { abilityLevel = ability.maxLevel; } ability.level = abilityLevel; } _enemyCard.Add(enemyCard); } }
public void LoadConcreteCard(ConcreteCard card) { _concreteCard = card; _Icon.spriteName = card.name; Deselect(); _Icon.alpha = 1; _level.text = card.level.ToString(); _level.color = RarityColorStatic.rarityColors [(int)card.rarity]; }
public void AddNewCardToBag(ConcreteCard card) { GameObject bagSlotGO = Instantiate(_bagSlotPrefab) as GameObject; bagSlotGO.GetComponent <UIDragScrollView> ().scrollView = _scrollView; BagSlot bagSlot = bagSlotGO.GetComponent <BagSlot> (); bagSlot.LoadConcreteCard(card); _grid.AddChild(bagSlotGO.transform); bagSlotGO.transform.localScale = Vector3.one; _bagSlots.Add(bagSlot); }
public void SlotClick(BagSlot bagSlot) { if (_selectBattleSlot == null) { if (_selectBagSlot != null) { _selectBagSlot.Deselect(); } _selectBagSlot = bagSlot; _selectBagSlot.Select(); } else { _selectBattleSlot.Deselect(); ConcreteCard first = _selectBattleSlot.concreteCard, second = bagSlot.concreteCard; int index = _selectBattleSlot.Index; _player.playCardSet [index] = second; _player.cardBag.Remove(second); if (first != null) { _player.cardBag.Add(first); } HOTween.To(_selectBattleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 0f).Ease(EaseType.Linear).OnStart(() => { _shieldPanel.Activate(); }).OnComplete(() => { _selectBattleSlot.LoadConcreteCard(second); HOTween.To(_selectBattleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => { _shieldPanel.Deactivate(); _selectBattleSlot = null; })); })); Debug.Log(bagSlot.slotBody == null); HOTween.To(bagSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 0f).Ease(EaseType.Linear).OnStart(() => { _shieldPanel.Activate(); }).OnComplete(() => { if (first != null) { bagSlot.LoadConcreteCard(first); HOTween.To(bagSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => { _shieldPanel.Deactivate(); })); } else { _shieldPanel.Deactivate(); _grid.RemoveChild(bagSlot.transform); _bagSlots.Remove(bagSlot); Destroy(bagSlot.gameObject); } })); } }
IEnumerator gainCardsDynamic() { while (_trophyCards.Count > 0) { ConcreteCard card = _trophyCards[_trophyCards.Count - 1]; _trophyCards.RemoveAt(_trophyCards.Count - 1); GameObject newCard = Instantiate(_cardIconPrefab) as GameObject; newCard.transform.localPosition = _newCardPosition; newCard.GetComponent <UISprite>().spriteName = card.name; _grid.AddChild(newCard.transform); yield return(new WaitForSeconds(_addTimeInterval)); } yield return(null); }
public void LoadConcreteCard(ConcreteCard concreteCard) { vacant = false; _card = concreteCard; _cardIcon.spriteName = concreteCard.name; _cardName.text = concreteCard.name; _level = concreteCard.level; _cardLevelLabel.text = "lv." + _level.ToString(); _experience = concreteCard.experience; _expUpBound = BaseCard._experienceTable[concreteCard.level - 1]; _experienceSlider.value = _experience / (float)_expUpBound; _experienceLabel.text = _experience.ToString() + "/" + _expUpBound.ToString(); gameObject.SetActive(true); }
public void LoadConcreteCard(ConcreteCard card) { _concreteCard = card; _Icon.spriteName = card.name; _name.text = card.name; _level.text = "Lv." + card.level.ToString(); _price.text = card.price.ToString(); _experience.text = card.experience.ToString() + "/" + BaseCard.experienceTable [card.level - 1]; _sell.value = false; _experienceSlider.value = card.experience / (float)BaseCard._experienceTable [card.level - 1]; _slotEdge.color = Color.white; _background.color = RarityColorStatic.rarityColors [(int)card.rarity]; _background.alpha = _bgAlpha; Deselect(); }
static BagManagement() { gridSort_byLevel = delegate(Transform x, Transform y) { ConcreteCard cardX = x.GetComponent <BagSlot> ().concreteCard; ConcreteCard cardY = y.GetComponent <BagSlot> ().concreteCard; if (cardX.level > cardY.level) { return(1); } if (cardX.level < cardY.level) { return(-1); } if (cardX.experience > cardY.experience) { return(1); } if (cardX.experience < cardY.experience) { return(-1); } return(0); }; gridSort_byLevelReverse = delegate(Transform x, Transform y) { return(-gridSort_byLevel(x, y)); }; gridSort_byRarity = delegate(Transform x, Transform y) { ConcreteCard cardX = x.GetComponent <BagSlot> ().concreteCard; ConcreteCard cardY = y.GetComponent <BagSlot> ().concreteCard; if (cardX.rarity > cardY.rarity) { return(1); } if (cardX.rarity < cardY.rarity) { return(-1); } return(gridSort_byLevel(x, y)); }; gridSort_byRarityReverse = delegate(Transform x, Transform y) { return(-gridSort_byRarity(x, y)); }; }
public void LoadCard(ConcreteCard concreteCard) { _battleCard.LoadConcreteCard(concreteCard); _vacant = false; _hasCast = false; _shellMesh.renderer.material = _battleController._shellMaterials [(int)concreteCard.rarity]; _roleMesh.renderer.material.mainTexture = concreteCard.roleTexture; _label_hp.text = _battleCard.health.ToString(); _label_mp.text = _battleCard.mana.ToString(); _label_hp.alpha = 0; _label_mp.alpha = 0; transform.localRotation = Quaternion.Euler(new Vector3(0, 180f, 0)); if (_shellType == ShellType.Player) //Load 'AbilityShell' { if (_battleCard.abilities.Count <= _abilityCountPerRow) { for (int i = 0; i < _battleCard.abilities.Count; i++) { _firstRowAbilityShells [i].LoadAbility(_battleCard.abilities [i]); } } else { int index = 0; for (int i = 0; i < _abilityCountPerRow; i++) { _secondRowAbilityShells [i].LoadAbility(_battleCard.abilities [index]); index++; } for (int i = 0; i < _abilityCountPerRow && index < _battleCard.abilities.Count; i++) { _firstRowAbilityShells [i].LoadAbility(_battleCard.abilities [index]); index++; } } } transform.localPosition = _originalLocalPosition; gameObject.SetActive(true); }
void SlotShowDetail(ConcreteCard card) { ConcreteCard second = card; ConcreteCard first = null; if (_selectBagSlot != null) { first = _selectBagSlot.concreteCard; } else if (_selectBattleSlot != null) { first = _selectBattleSlot.concreteCard; } if (first == null) { Debug.Log(second == null); _cardComparisonDisplayer.DisplayCardComparison(second); } else { _cardComparisonDisplayer.DisplayCardComparison(second, first); } }
void DynamicToInstant() { StopCoroutine("PlayerGainExperienceDynamic"); StopCoroutine("gainCoinsDynamic"); StopCoroutine("gainCardsDynamic"); foreach (var item in _completeSlots) { if (item.vacant == false) { item.GainExperienceInstant(); } } LoadPlayerInfo(); _grid.animateSmoothly = false; for (int i = _trophyCards.Count - 1; i >= 0; i--) { ConcreteCard card = _trophyCards[i]; GameObject newCard = Instantiate(_cardIconPrefab) as GameObject; newCard.GetComponent <UISprite>().spriteName = card.name; _grid.AddChild(newCard.transform); } _grid.animateSmoothly = true; }
public void LoadConcreteCard(ConcreteCard concreteCard) { _concreteCard = concreteCard; _strength = concreteCard.strength; _agility = concreteCard.agility; _magic = concreteCard.magic; _maxHealth = concreteCard.maxHealth; _maxMana = concreteCard.maxMana; _health = _maxHealth; _mana = 0; _physicalDefense = concreteCard.physicalDefense; _magicalDefense = concreteCard.magicalDefense; _physicalCriticalChance = concreteCard.physicalCriticalChance; _magicalCriticalChance = concreteCard.magicalCriticalChance; _physicalDamage = concreteCard.physicalDamage; _magicalDamage = concreteCard.magicalDamage; _healthResilience = concreteCard.healthResilience; _magicResilience = concreteCard.magicResilience; _evasion = concreteCard.evasion; foreach (var item in concreteCard.abilities) { _abilityCDTable.Add(item, 0); } }
public void GainNewCard(ConcreteCard newCard) { _cardBag.Add(newCard); _bagManagement.AddNewCardToBag(newCard); }
public override object CastAbility(ConcreteCard from, ConcreteCard to) { ablityEffect.AbilityEffect(from, to, this); return(null); }
//public IAbilityEffect _abilityEffect; public abstract object CastAbility(ConcreteCard from, ConcreteCard to);
public void DisplayCardComparison(ConcreteCard second, ConcreteCard first = null) { int[] secondAttrValue = new int[_attrs.Length]; int[] firstAttrValue = new int[_attrs.Length]; for (int i = 0; i < _attrs.Length; i++) { secondAttrValue [i] = (int)_attrs [i].GetValue(second, null); } for (int i = 0; i < _attrs.Length; i++) { _secondAttrs [i].text = secondAttrValue [i].ToString(); } _container_secondAttr.gameObject.SetActive(true); if (first != null) { for (int i = 0; i < _attrs.Length; i++) { firstAttrValue [i] = (int)_attrs [i].GetValue(first, null); } for (int i = 0; i < _attrs.Length; i++) { _firstAttrs [i].text = firstAttrValue [i].ToString(); } for (int i = 0; i < _attrs.Length; i++) { UILabel attrLabel = _comparisonAttrs [i]; int valueDelta = secondAttrValue [i] - firstAttrValue [i]; string valueStr = ""; if (valueDelta > 0) { attrLabel.color = Color.green; valueStr += "+"; } else if (valueDelta < 0) { attrLabel.color = Color.red; } else { attrLabel.color = Color.white; } valueStr += valueDelta.ToString(); attrLabel.text = valueStr; } _container_comparison.gameObject.SetActive(true); _container_firstAttr.gameObject.SetActive(true); } for (int i = 0; i < second.abilities.Count; i++) { _secondAbilities [i].LoadAbility(second.abilities [i]); } if (first != null) { for (int i = 0; i < first.abilities.Count; i++) { Debug.Log("first"); _firstAbilities [i].LoadAbility(first.abilities [i]); } } _icon_second.spriteName = second.name; _icon_second.gameObject.SetActive(true); _level_second.text = second.level.ToString(); _level_second.gameObject.SetActive(true); _level_second.color = RarityColorStatic.rarityColors [(int)second.rarity]; if (first != null) { _icon_first.spriteName = first.name; _icon_first.gameObject.SetActive(true); _level_first.text = first.level.ToString(); _level_first.gameObject.SetActive(true); _level_first.color = RarityColorStatic.rarityColors [(int)first.rarity]; } gameObject.SetActive(true); HOTween.To(_panel, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => { _canClick = true; })); }
public object DurativeAbilityMonitor(ConcreteCard from, ConcreteCard to) { return(null); }
public override object CastAbility(ConcreteCard from, ConcreteCard to) { return(DurativeAbilityMonitor(from, to)); }
public void SlotClick(BattleSlot battleSlot) { if (_selectBattleSlot == null) { if (_selectBagSlot != null) { _selectBagSlot.Deselect(); _selectBagSlot = null; } _selectBattleSlot = battleSlot; battleSlot.Select(); } else //has selected a battleSlot { if (_selectBattleSlot.Index == battleSlot.Index) //Click the same slot,deselect { battleSlot.Deselect(); _selectBattleSlot = null; } else if (_selectBattleSlot.concreteCard == null) { _selectBattleSlot.Deselect(); _selectBattleSlot = battleSlot; _selectBattleSlot.Select(); } else { _selectBattleSlot.Deselect(); ConcreteCard first = _selectBattleSlot.concreteCard, second = battleSlot.concreteCard; int indexFst = _selectBattleSlot.Index, indexSec = battleSlot.Index; _player.playCardSet [indexFst] = second; _player.playCardSet [indexSec] = first; HOTween.To(_selectBattleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 0f).Ease(EaseType.Linear).OnStart(() => { _shieldPanel.Activate(); }).OnComplete(() => { if (second != null) { _selectBattleSlot.LoadConcreteCard(second); HOTween.To(_selectBattleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => { _shieldPanel.Deactivate(); _selectBattleSlot = null; })); } else { _shieldPanel.Deactivate(); _selectBattleSlot.Unload(); _selectBattleSlot = null; } })); HOTween.To(battleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 0f).Ease(EaseType.Linear).OnStart(() => { _shieldPanel.Activate(); }).OnComplete(() => { battleSlot.LoadConcreteCard(first); HOTween.To(battleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => { _shieldPanel.Deactivate(); })); })); } } }
public void Unload() { _concreteCard = null; _Icon.alpha = 0; }
public static DurativeAbilityMonitor GeneMonitor(ConcreteCard from, ConcreteCard to, DurativeAbilityBase ability) { return(null); }