protected override void OnHoverEnter(Draggable dragged)
        {
            //TODO popup showing effect?
            DraggableItem item = (DraggableItem)dragged;

            if (item != null)
            {
                Item containedItem = item.itemBox.ContainedItem;
                if (containedItem.IsUsable(character))
                {
                    StatDisplay.StatChangeData statChangeData = new StatDisplay.StatChangeData();
                    statChangeData.ItemToUse = containedItem;
                    statChangeData.ApplyItemEffects(containedItem);
                    if (containedItem is Equipment)
                    {
                        if (((Equipment)containedItem).equipmentType == Equipment.EquipmentType.Weapon)
                        {
                            statChangeData.ApplyItemEffects(character.weapon.equippedItem, true);
                        }
                    }
                    GetComponentInParent <CharacterScreen>().DisplayCharacter(statChangeData);
                }
                else
                {
                    // TODO show it's not usable
                }
            }
        }
 public void OnPointerEnter(PointerEventData eventData)
 {
     RPGsys.Character           c          = screen.CurrentChar;
     StatDisplay.StatChangeData statChange = new StatDisplay.StatChangeData();
     statChange.ApplyItemEffects(c.weapon.equippedItem, true);
     statChange.ApplyItemEffects(c.ringL.equippedItem, true);
     statChange.ApplyItemEffects(c.ringR.equippedItem, true);
     screen.DisplayCharacter(statChange);
 }
Beispiel #3
0
 protected override void OnHoverEnter(Draggable dragged)
 {
     // Shows changes from equipping item
     if (dragged is DraggableItem)
     {
         DraggableItem di = (DraggableItem)dragged;
         if (di.itemBox is InventorySlot)
         {
             StatDisplay.StatChangeData statChangeData = new StatDisplay.StatChangeData();
             statChangeData.ItemToUse = di.itemBox.ContainedItem;
             statChangeData.ApplyItemEffects(di.itemBox.ContainedItem);
             //HACK
             GetComponentInParent <CharacterScreen>().DisplayCharacter(statChangeData);
         }
     }
 }
        protected override void OnHoverEnter(Draggable dragged)
        {
            //TODO popup showing effect?
            DraggableItem item = (DraggableItem)dragged;

            if (item != null)
            {
                Item containedItem = item.itemBox.ContainedItem;
                if (containedItem.IsUsable(character))
                {
                    StatDisplay.StatChangeData statChangeData = new StatDisplay.StatChangeData();
                    statChangeData.ItemToUse = containedItem;
                    statChangeData.ApplyItemEffects(containedItem);
                    if (containedItem is Equipment)
                    {
                        if (((Equipment)containedItem).equipmentType == Equipment.EquipmentType.Weapon)
                        {
                            statChangeData.ApplyItemEffects(character.weapon.equippedItem, true);
                        }
                    }

                    ResetHealBars();

                    if (statChangeData != null)
                    {
                        float hpChange;
                        float mpChange;
                        if (statChangeData.changes.TryGetValue(RPGStats.Stats.Hp, out hpChange))
                        {
                            characterPortrait.HPRegenBar.Init(hpChange + character.Hp, character.hpStat);
                        }
                        if (statChangeData.changes.TryGetValue(RPGStats.Stats.Mp, out mpChange))
                        {
                            characterPortrait.MPRegenBar.Init(mpChange + character.Mp, character.mpStat);
                        }
                    }
                }
                else
                {
                    // TODO show it's not usable
                }
            }
        }
Beispiel #5
0
        protected override void OnHoverEnter(Draggable dragged)
        {
            //HACK checking if in character screen
            CharacterScreen screen = GetComponentInParent <CharacterScreen>();

            if (screen != null)
            {
                if (dragged is DraggableItem)
                {
                    DraggableItem di = (DraggableItem)dragged;
                    if (di.itemBox is EquipmentSlotUI)
                    {
                        StatDisplay.StatChangeData statChangeData = new StatDisplay.StatChangeData();
                        statChangeData.ItemToUse = di.itemBox.ContainedItem;
                        statChangeData.ApplyItemEffects(di.itemBox.ContainedItem, true);
                        screen.DisplayCharacter(statChangeData);
                    }
                }
            }
        }
Beispiel #6
0
        public void DisplayCharacter(StatDisplay.StatChangeData changeData = null)
        {
            // TODO just make this set it as dirty and update next update?
            NameText.text = CurrentChar.characterName;
            characterPortrait.SetCharacter(CurrentChar);
            foreach (StatDisplay stat in statDisplays)
            {
                stat.Display(changeData);
            }

            if (changeData != null)
            {
                float hpChange;
                float mpChange;
                if (changeData.changes.TryGetValue(RPGStats.Stats.Hp, out hpChange))
                {
                    characterPortrait.characterUI.HPRegenBar.Init(hpChange + CurrentChar.Hp, CurrentChar.hpStat);
                }
                if (changeData.changes.TryGetValue(RPGStats.Stats.Mp, out mpChange))
                {
                    characterPortrait.characterUI.MPRegenBar.Init(mpChange + CurrentChar.Mp, CurrentChar.mpStat);
                }
            }

            for (int i = 0; i < powerToggles.Count; ++i)
            {
                if (i < CurrentChar.classInfo.classPowers.Count)
                {
                    powerToggles[i].SetContents(CurrentChar, CurrentChar.classInfo.classPowers[i]);
                }
                else
                {
                    powerToggles[i].SetContents(CurrentChar, null);
                }
            }
            LevelText.text = string.Format("Level {0}", CurrentChar.experience.CharacterLevel);
            xpText.text    = string.Format("XP {0}/{1}", CurrentChar.experience.Exp, CurrentChar.experience.XPToLevel);
        }
 protected override void OnHoverEnter(Draggable dragged)
 {
     // Shows stat changes from removing this item and adding another
     if (dragged is DraggableItem)
     {
         DraggableItem di = (DraggableItem)dragged;
         if (di.itemBox is InventorySlot)
         {
             if (equipmentSlot.CanEquip(di.itemBox.ContainedItem as Equipment))
             {
                 StatDisplay.StatChangeData statChangeData = new StatDisplay.StatChangeData();
                 statChangeData.ItemToUse = di.itemBox.ContainedItem;
                 statChangeData.ApplyItemEffects(di.itemBox.ContainedItem);
                 // remove this item
                 statChangeData.ApplyItemEffects(ContainedItem, true);
                 GetComponentInParent <CharacterScreen>().DisplayCharacter(statChangeData);
             }
             else
             {
                 // TODO show item can't be equipped in this slot
             }
         }
     }
 }