Exemple #1
0
        private string GetItemType(RPGObject item)
        {
            // set 'type' conditionally.
            string type = item.GetType().ToString();

            switch (type)
            {
            case ("RPG.RPGWeapon"):
            {
                // then get the weapon class/type
                return(Enum.GetName(typeof(RPGWeapon.WeaponClass), ((RPGWeapon)item).weaponClass));
                //break;
            }

            case ("RPG.Projectile"):
            {
                return(Enum.GetName(typeof(Projectile.ProjectileType), ((Projectile)item).type));
                //break;
            }

            case ("RPG.RPGArmor"):
            {
                // then get the armor class/type
                return(Enum.GetName(typeof(RPGArmor.ArmorClass), ((RPGArmor)item).Class));
                //break;
            }

            case ("RPG.RPGPotion"):
            {
                return("Potion");
                //break;
            }

            default:
            {
                return(type);
            }
            } // end switch
        }
Exemple #2
0
        private void ObjectClick(RPGObject obj)
        {
            if (SelectedObject != null)
            {
                if (SelectedObject != obj)
                {
                    // unselect old object
                    SelectedObject.IsSelected = false;

                    // clicked a new object
                    obj.IsSelected = true;
                    SelectedObject = obj;

                    // update toolbar based on selection
                    if (obj.GetType() == typeof(PlayerCharacter))
                    {
                        Session.thisSession.LoadActorToTabs((Actor)obj);

                        // any PC-specific things...
                    }
                    else if (obj.GetType() == typeof(Actor))
                    {
                        Session.thisSession.LoadActorToTabs((Actor)obj);
                    }
                    else if (obj.GetType() == typeof(RPGDrop))
                    {
                        Session.thisSession.TabPageAction.panelActionToolbar.LoadDrop((RPGDrop)obj);
                    }
                    else
                    {
                        // we have selected an unknown object, do nothing...
                    }
                }
                else
                {
                    // clicked on the same object twice,
                }
            }
            else
            {
                // new selection
                SelectedObject            = obj;
                SelectedObject.IsSelected = true;

                // update toolbar based on selection
                if (obj.GetType() == typeof(PlayerCharacter))
                {
                    Session.thisSession.LoadActorToTabs((Actor)obj);
                    // load any pc-specific things...
                }
                else if (obj.GetType() == typeof(Actor))
                {
                    Session.thisSession.LoadActorToTabs((Actor)obj);
                }
                else if (obj.GetType() == typeof(RPGDrop))
                {
                    Session.thisSession.TabPageAction.panelActionToolbar.LoadDrop((RPGDrop)obj);
                }
                else
                {
                    // we have selected an object not an actor, do nothing...
                }
            }
        }
Exemple #3
0
        private void TargetObject(RPGObject target)
        {
            // object is selected, and a new target is right-clicked
            // check ActionButtons
            if (m_toolbar.isAnyButtonSelected())
            {
                ActionButton[] btns = m_toolbar.GetSelectedButtons();
                if (btns.Length == 1)
                {
                    // only one selected, do action of button.
                    ActionButton btn = btns[0];
                    switch (btn.ActionType)
                    {
                    case (ActionButton.ActionButtonType.BasicAction):
                    {
                        TargetObjectWithBasicAction(btn, target);
                        break;
                    }

                    case (ActionButton.ActionButtonType.SkillAction):
                    {
                        TargetObjectWithSkillAction(btn, target);
                        break;
                    }

                    case (ActionButton.ActionButtonType.SpellAction):
                    {
                        TargetObjectWithSpellAction(btn, target);
                        break;
                    }

                    case (ActionButton.ActionButtonType.ItemAction):
                    {
                        TargetObjectWithItemAction(btn, target);
                        break;
                    }

                    default:
                    {
                        break;
                    }
                    } // end switch
                }
                else
                {
                    // multiple buttons selected, do complex logic.
                }
            }
            else
            {
                if (target == SelectedObject)
                {
                    // right clicked on same selected item, do anything?
                    // No
                    return;
                }

                // if no action button was selected, then do the default...
                // based on friend/foe/neutral, do default action...
                if (target.GetType() == typeof(Actor))
                {
                    SelectedObject.Act(RPGObject.Action.Attack, new Point(target.X, target.Y), target);
                }
                else if (target.GetType() == typeof(PlayerCharacter))
                {
                    SelectedObject.Act(RPGObject.Action.Attack, new Point(target.X, target.Y), target);
                }
                else if (target.GetType() == typeof(RPGDrop))
                {
                    SelectedObject.Act(RPGObject.Action.Get, new Point(target.X, target.Y), target);
                }
            } // end else - no ActionButton selected
        }