示例#1
0
        /// <summary>
        /// The method that calls the colour and texture methods
        /// </summary>
        /// <param name="area">The area we want to change</param>
        /// <param name="trn">The TRN data that we is going to modify</param>
        /// <param name="triangle">The Triangle we want to paint inside</param>
        /// <param name="upper">The left upper point of the rectangle that contains triangle</param>
        /// <param name="lower">The right lower point of the rectangle that contains triangle</param>
        /// <returns></returns>
        public TRN ApplyTriangle(NWN2Toolset.NWN2.Data.NWN2GameArea area, TRN trn, Triangle triangle, Pair <double, double> upper, Pair <double, double> lower, Random ran)
        {
            if (data.colourOption == colourOption.Colour)
            {
                trn = ApplyColourTriangle(trn, triangle, upper, lower, ran);
            }

            //texturemaps
            trn = ApplyTextureTriangle(trn, triangle, upper, lower, ran);

            return(trn);
        }
示例#2
0
        private TRN ApplyLine(NWN2Toolset.NWN2.Data.NWN2GameArea area, TRN trn, Pair <double, double> upper, Pair <double, double> lower)
        {
            if (data.colourOption == colourOption.Colour)
            {
                trn = ApplyColourLine(trn, upper, lower);
            }

            //texturemaps
            trn = ApplyTextureLine(trn, upper, lower);

            return(trn);
        }
示例#3
0
        public void CreateBlocksWhenAreaIsReady(object area)
        {
            NWN2Toolset.NWN2.Data.NWN2GameArea nwn2Area = area as NWN2Toolset.NWN2.Data.NWN2GameArea;
            if (nwn2Area == null)
            {
                throw new ArgumentException("Parameter was not of type NWN2Toolset.NWN2.Data.NWN2GameArea.", "area");
            }

            int wait     = 3000;
            int interval = 100;

            while (wait >= 0 && nwn2Area.Tag == null)
            {
                Thread.Sleep(interval);
                wait -= interval;
            }

            if (nwn2Area.Tag == null)
            {
                throw new ApplicationException("The last-opened area took too long to load, and could not be shown as a Flip block.");
            }

            // Once loaded, ensure that area always has the same resource name and tag:
            if (nwn2Area.Tag != nwn2Area.Name)
            {
                nwn2Area.Tag = nwn2Area.Name;
            }
            OEIShared.Utils.OEIExoLocString oeiStr = Nwn2Strings.GetOEIStringFromString(nwn2Area.Name);
            if (nwn2Area.DisplayName != oeiStr)
            {
                nwn2Area.DisplayName = oeiStr;
            }

            // Create area block:
            Action action = new Action
                            (
                delegate()
            {
                ObjectBlock areaBlock = blocks.CreateAreaBlock(nwn2Area);
                manager.AddMoveable(AreasBagName, areaBlock);

                foreach (NWN2InstanceCollection instanceCollection in nwn2Area.AllInstances)
                {
                    if (instanceCollection.Count == 0)
                    {
                        continue;
                    }

                    string bag = String.Format(InstanceBagNamingFormat, instanceCollection[0].ObjectType);

                    if (!manager.HasBag(bag))
                    {
                        continue;
                    }

                    foreach (INWN2Instance instance in instanceCollection)
                    {
                        ObjectBlock instanceBlock = blocks.CreateInstanceBlock(instance, nwn2Area);
                        manager.AddMoveable(bag, instanceBlock);
                    }
                }
            }
                            );

            uiThreadAccess.Dispatcher.Invoke(DispatcherPriority.Normal, action);
        }