예제 #1
0
 /// <summary>
 /// Checks whether a given behaviour represents a blueprint which
 /// appears to have been created by Narrative Threads.
 /// </summary>
 /// <param name="behaviour">The behaviour to check.</param>
 /// <returns>True if the behaviour represents something which appears to have
 /// been created by Narrative Threads; false otherwise.</returns>
 public bool CreatedByNarrativeThreads(BlueprintBehaviour behaviour)
 {
     if (behaviour == null)
     {
         throw new ArgumentNullException("behaviour");
     }
     return(CreatedByNarrativeThreads(behaviour.Nwn2Type, behaviour.ResRef));
 }
예제 #2
0
        public ObjectBlock CreateBlueprintBlock(BlueprintBehaviour behaviour)
        {
            if (behaviour == null)
            {
                throw new ArgumentNullException("behaviour");
            }

            ObjectBlock block = new ObjectBlock(null, behaviour);

            block.AssignImage(images);
            return(block);
        }
예제 #3
0
        public ObjectBlock CreateBlueprintBlock(INWN2Blueprint blueprint)
        {
            if (blueprint == null)
            {
                throw new ArgumentNullException("blueprint");
            }

            BlueprintBehaviour behaviour = CreateBlueprintBehaviour(blueprint);

            ObjectBlock block = CreateBlueprintBlock(behaviour);

            return(block);
        }
예제 #4
0
        public Image GetImage(BlueprintBehaviour behaviour)
        {
            Image  image;
            string objectType = behaviour.Nwn2Type.ToString();

            // First, try to get a Narrative Threads user-created image:
            if (nt != null && nt.CreatedByNarrativeThreads(behaviour) && nt.HasImage(behaviour.ResRef))
            {
                image = nt.GetImageForResRef(behaviour.ResRef);
            }

            // Or if this has an icon, use that:
            else if (!String.IsNullOrEmpty(behaviour.IconName))
            {
                image = GetIconImage(behaviour.IconName);
            }

            // Otherwise, try to get an image representing this blueprint:
            else
            {
                image = GetImage(objectType, behaviour.ResRef);
            }

            // Failing that, try to retrieve an image of the blueprint it derives from:
            if (image == null)
            {
                image = GetImage(objectType, behaviour.BaseResRef);
            }

            // If neither is available, use a placeholder image:
            if (image == null)
            {
                if (behaviour.Nwn2Type == Nwn2Type.Item)
                {
                    image = GetImage("Placeholder", "Item");
                }
                else if (behaviour.Nwn2Type == Nwn2Type.Waypoint)
                {
                    image = GetImage("Placeholder", "Waypoint");
                }
                else
                {
                    image = GetImage("Placeholder", "Blueprint");
                }
            }

            return(image);
        }