Пример #1
0
 /// <summary>
 /// Initializes a new instance of Clamp.
 /// </summary>
 /// <param name="input">The input module.</param>
 public Clamp(ModuleBase input)
     : base(1)
 {
     Modules[0] = input;
     Minimum = -1.0;
     Maximum = 1.0;
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of Terrace.
 /// </summary>
 /// <param name="inverted">Indicates whether the terrace curve is inverted.</param>
 /// <param name="input">The input module.</param>
 public Terrace(bool inverted, ModuleBase input)
     : base(1)
 {
     Modules[0] = input;
     IsInverted = inverted;
     ControlPoints = new List<double>();
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of ScaleBias.
 /// </summary>
 /// <param name="scale">The scaling factor to apply to the output value from the source module.</param>
 /// <param name="bias">The bias to apply to the scaled output value from the source module.</param>
 /// <param name="input">The input module.</param>
 public ScaleBias(float scale, float bias, ModuleBase input)
     : base(1)
 {
     this.m_modules[0] = input;
     this.Bias = bias;
     this.Scale = scale;
 }
Пример #4
0
        public Bias(ModuleBase source, double? bias)
        {
            Source = source;

            if (bias != null)
                _bias = (double) bias;
        }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of Clamp.
 /// </summary>
 /// <param name="input">The input module.</param>
 /// <param name="min">The minimum value.</param>
 /// <param name="max">The maximum value.</param>
 public Clamp(float min, float max, ModuleBase input)
     : base(1)
 {
     this.Minimum = min;
     this.Maximum = max;
     this.m_modules[0] = input;
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of Select.
 /// </summary>
 /// <param name="inputA">The first input module.</param>
 /// <param name="inputB">The second input module.</param>
 /// <param name="inputB">The controller module.</param>
 public Select(ModuleBase inputA, ModuleBase inputB, ModuleBase controller)
     : base(3)
 {
     this.m_modules[0] = inputA;
     this.m_modules[1] = inputB;
     this.m_modules[2] = controller;
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of Select.
 /// </summary>
 /// <param name="inputA">The first input module.</param>
 /// <param name="inputB">The second input module.</param>
 /// <param name="controller">The controller module.</param>
 public Select(ModuleBase inputA, ModuleBase inputB, ModuleBase controller)
     : base(3)
 {
     Modules[0] = inputA;
     Modules[1] = inputB;
     Modules[2] = controller;
 }
Пример #8
0
 public Clamp(double min, double max, ModuleBase input)
     : base(1)
 {
     this.Minimum = min;
     this.Maximum = max;
     this.m_modules[0] = input;
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of Select.
 /// </summary>
 /// <param name="min">The minimum value.</param>
 /// <param name="max">The maximum value.</param>
 /// <param name="fallOff">The falloff value at the edge transition.</param>
 /// <param name="inputA">The first input module.</param>
 /// <param name="inputB">The second input module.</param>
 public Select(double min, double max, double fallOff, ModuleBase inputA, ModuleBase inputB)
     : this(inputA, inputB, null)
 {
     this.m_min = min;
     this.m_max = max;
     this.FallOff = fallOff;
 }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of ScaleBias.
 /// </summary>
 /// <param name="scale">The scaling factor to apply to the output value from the source module.</param>
 /// <param name="bias">The bias to apply to the scaled output value from the source module.</param>
 /// <param name="input">The input module.</param>
 public ScaleBias(double scale, double bias, ModuleBase input)
     : base(1)
 {
     this.m_modules[0] = input;
     this.Bias = bias;
     this.Scale = scale;
 }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of Blend.
 /// </summary>
 /// <param name="lhs">The left hand input module.</param>
 /// <param name="rhs">The right hand input module.</param>
 /// <param name="controller">The controller of the operator.</param>
 public Blend(ModuleBase lhs, ModuleBase rhs, ModuleBase controller)
     : base(3)
 {
     this.m_modules[0] = lhs;
     this.m_modules[1] = rhs;
     this.m_modules[2] = controller;
 }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of Clamp.
 /// </summary>
 /// <param name="input">The input module.</param>
 /// <param name="min">The minimum value.</param>
 /// <param name="max">The maximum value.</param>
 public Clamp(double min, double max, ModuleBase input)
     : base(1)
 {
     Minimum = min;
     Maximum = max;
     Modules[0] = input;
 }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of Select.
 /// </summary>
 /// <param name="min">The minimum value.</param>
 /// <param name="max">The maximum value.</param>
 /// <param name="fallOff">The falloff value at the edge transition.</param>
 /// <param name="inputA">The first input module.</param>
 /// <param name="inputB">The second input module.</param>
 public Select(double min, double max, double fallOff, ModuleBase inputA, ModuleBase inputB, ModuleBase controller)
     : this(inputA, inputB, controller)
 {
     _min = min;
     _max = max;
     FallOff = fallOff;
 }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of ScaleBias.
 /// </summary>
 /// <param name="scale">The scaling factor to apply to the output value from the source module.</param>
 /// <param name="bias">The bias to apply to the scaled output value from the source module.</param>
 /// <param name="input">The input module.</param>
 public ScaleBias(double scale, double bias, ModuleBase input)
     : base(1)
 {
     Modules[0] = input;
     Bias = bias;
     Scale = scale;
 }
Пример #15
0
		/// <summary>
		/// Initializes a new instance of Translate.
		/// </summary>
		/// <param name="x">The translation on the x-axis.</param>
		/// <param name="y">The translation on the y-axis.</param>
		/// <param name="z">The translation on the z-axis.</param>
		/// <param name="input">The input module.</param>
		public Translate(double x, double y, double z, ModuleBase input)
			: base(1)
		{
			this.m_modules[0] = input;
			this.X = x;
			this.Y = y;
			this.Z = z;
		}
Пример #16
0
 public Mask(ModuleBase inputA, double min, double max)
     : base(1)
 {
     Modules[0] = inputA;
     MinMaskValue = min;
     MaxMaskValue = max;
     smoothlenght = smoothlenght / (double)DataBaseHandler.HeighMapSize;
 }
Пример #17
0
 /// <summary>
 /// Initializes a new instance of Translate.
 /// </summary>
 /// <param name="x">The translation on the x-axis.</param>
 /// <param name="y">The translation on the y-axis.</param>
 /// <param name="z">The translation on the z-axis.</param>
 /// <param name="input">The input module.</param>
 public Translate(double x, double y, double z, ModuleBase input)
     : base(1)
 {
     Modules[0] = input;
     X = x;
     Y = y;
     Z = z;
 }
Пример #18
0
 /// <summary>
 /// Initializes a new instance of Translate.
 /// </summary>
 /// <param name="input">The input module.</param>
 public Translate(ModuleBase input)
     : base(1)
 {
     Modules[0] = input;
     X = 1.0;
     Z = 1.0;
     Y = 1.0;
 }
Пример #19
0
 /// <summary>
 /// Initializes a new instance of Turbulence.
 /// </summary>
 /// <param name="input">The input module.</param>
 public Turbulence(ModuleBase input)
     : base(1)
 {
     _xDistort = new Perlin();
     _yDistort = new Perlin();
     _zDistort = new Perlin();
     Modules[0] = input;
 }
Пример #20
0
 /// <summary>
 /// Initializes a new instance of Displace.
 /// </summary>
 /// <param name="input">The input module.</param>
 /// <param name="x">The displacement module of the x-axis.</param>
 /// <param name="y">The displacement module of the y-axis.</param>
 /// <param name="z">The displacement module of the z-axis.</param>
 public Displace(ModuleBase input, ModuleBase x, ModuleBase y, ModuleBase z)
     : base(4)
 {
     Modules[0] = input;
     Modules[1] = x;
     Modules[2] = y;
     Modules[3] = z;
 }
Пример #21
0
 public DocumentProvider(ModuleBase module)
 {
     this.module = module;
     
     _docProviderImpl = module.Resolve<DocumentProviderImpl>();
     
     _wsMessage = module.Resolve<IWsMessage>();
 }
 /// <summary>
 /// Initializes a new instance of Turbulence.
 /// </summary>
 /// <param name="input">The input module.</param>
 public Turbulence(ModuleBase input)
     : base(1)
 {
     this.m_xDistort = new Perlin();
     this.m_yDistort = new Perlin();
     this.m_zDistort = new Perlin();
     this.m_modules[0] = input;
 }
Пример #23
0
 /// <summary>
 /// Initializes a new instance of Scale.
 /// </summary>
 /// <param name="x">The scaling on the x-axis.</param>
 /// <param name="y">The scaling on the y-axis.</param>
 /// <param name="z">The scaling on the z-axis.</param>
 /// <param name="input">The input module.</param>
 public Scale(float x, float y, float z, ModuleBase input)
     : base(1)
 {
     this.m_modules[0] = input;
     this.X = x;
     this.Y = y;
     this.Z = z;
 }
 /// <summary>
 /// Initializes a new instance of Displace.
 /// </summary>
 /// <param name="input">The input module.</param>
 /// <param name="x">The displacement module of the x-axis.</param>
 /// <param name="y">The displacement module of the y-axis.</param>
 /// <param name="z">The displacement module of the z-axis.</param>
 public Displace(ModuleBase input, ModuleBase x, ModuleBase y, ModuleBase z)
     : base(4)
 {
     this.m_modules[0] = input;
     this.m_modules[1] = x;
     this.m_modules[2] = y;
     this.m_modules[3] = z;
 }
Пример #25
0
 /// <summary>
 /// Initializes a new instance of Turbulence.
 /// </summary>
 /// <param name="x">The perlin noise to apply on the x-axis.</param>
 /// <param name="y">The perlin noise to apply on the y-axis.</param>
 /// <param name="z">The perlin noise to apply on the z-axis.</param>
 /// <param name="power">The power of the turbulence.</param>
 /// <param name="input">The input module.</param>
 public Turbulence(Perlin x, Perlin y, Perlin z, double power, ModuleBase input)
     : base(1)
 {
     _xDistort = x;
     _yDistort = y;
     _zDistort = z;
     Modules[0] = input;
     Power = power;
 }
 /// <summary>
 /// Initializes a new instance of Turbulence.
 /// </summary>
 /// <param name="x">The perlin noise to apply on the x-axis.</param>
 /// <param name="y">The perlin noise to apply on the y-axis.</param>
 /// <param name="z">The perlin noise to apply on the z-axis.</param>
 /// <param name="power">The power of the turbulence.</param>
 /// <param name="input">The input module.</param>
 public Turbulence(Perlin x, Perlin y, Perlin z, double power, ModuleBase input)
     : base(1)
 {
     this.m_xDistort = x;
     this.m_yDistort = y;
     this.m_zDistort = z;
     this.m_modules[0] = input;
     this.Power = power;
 }
Пример #27
0
        /// <summary>
        /// Initializes a new instance of Scale.
        /// </summary>
        /// <param name="input">The input module.</param>
        public Scale(ModuleBase input)
            : base(1)
        {
            Modules[0] = input;

            X = 1.0;
            Y = 1.0;
            Z = 1.0;
        }
Пример #28
0
 /// <summary>
 /// Initializes a new instance of Select.
 /// </summary>
 /// <param name="min">The minimum value.</param>
 /// <param name="max">The maximum value.</param>
 /// <param name="fallOff">The falloff value at the edge transition.</param>
 /// <param name="input">The input module.</param>
 /// <param name="controller">The controller of the operator.</param>
 public Select(double min, double max, double fallOff, ModuleBase input, ModuleBase controller)
     : base(2)
 {
     this.m_modules[0] = input;
     this.m_modules[1] = controller;
     this.m_min = min;
     this.m_max = max;
     this.FallOff = fallOff;
 }
Пример #29
0
        public ScaleDomain(ModuleBase source, double? x, double? y)
        {
            if (x != null)
                _sx = (double) x;

            if (y != null)
                _sy = (double) y;

            Source = source;
        }
Пример #30
0
 /// <summary>
 /// Initializes a new instance of Select.
 /// </summary>
 /// <param name="min">The minimum value.</param>
 /// <param name="max">The maximum value.</param>
 /// <param name="fallOff">The falloff value at the edge transition.</param>
 /// <param name="input1">The first input module.</param>
 /// <param name="input2">The second input module.</param>
 /// <param name="controller">The controller of the operator.</param>
 public Select(float min, float max, float fallOff, ModuleBase input1, ModuleBase input2, ModuleBase controller)
     : base(3)
 {
     this.m_modules[0] = input1;
     this.m_modules[1] = input2;
     this.m_modules[2] = controller;
     this.m_min = min;
     this.m_max = max;
     this.FallOff = fallOff;
 }
Пример #31
0
 public ModuleBaseTests()
 {
     _moduleBase = new ModuleBase(NameOrConnectionString, SchemaName);
 }
Пример #32
0
 public Min(ModuleBase m1, ModuleBase m2)
 {
     module1 = m1;
     module2 = m2;
 }
Пример #33
0
 /// <summary>
 /// Initializes a new instance of Exponent.
 /// </summary>
 /// <param name="exponent">The exponent to use.</param>
 /// <param name="input">The input module.</param>
 public Exponent(float exponent, ModuleBase input)
     : base(1)
 {
     this.m_modules[0] = input;
     this.Value        = exponent;
 }
Пример #34
0
 /// <summary>
 /// Initializes a new instance of Terrace.
 /// </summary>
 /// <param name="input">The input module.</param>
 public Terrace(ModuleBase input)
     : base(1)
 {
     Modules[0] = input;
 }
Пример #35
0
 //sam
 public Terrace(ModuleBase input, int tid)
     : this(input)
 {
     textID = tid;
 }
Пример #36
0
 /// <summary>
 /// Initializes a new instance of Cache.
 /// </summary>
 /// <param name="inpu">The input module.</param>
 public Cache(ModuleBase input)
     : base(1)
 {
     this.m_modules[0] = input;
 }
Пример #37
0
 /// <summary>
 /// Initializes a new instance of Clamp.
 /// </summary>
 /// <param name="input">The input module.</param>
 public Clamp(ModuleBase input)
     : base(1)
 {
     this.m_modules[0] = input;
 }
Пример #38
0
        static bool Prefix(IntVec3 loc, ref Vector3 __result, ModuleBase ___coordinateX, ModuleBase ___coordinateZ)
        {
            if (MapDesignerMod.mod.settings.selRiverStyle == MapDesignerSettings.RiverStyle.Confluence)
            {
                //__result = new Vector3(___coordinateX.GetValue(loc), 0f, ___coordinateZ.GetValue(loc));
                //__result = new Vector3(___coordinateX.GetValue(loc), 0f, Math.Abs(___coordinateZ.GetValue(loc)));
                //__result = new Vector3(___coordinateZ.GetValue(loc) + ___coordinateX.GetValue(loc), 0f, ___coordinateZ.GetValue(loc));


                // these return the correct angles for the L and R branches of a forked river
                //__result = new Vector3(___coordinateX.GetValue(loc) + 0.6f * ___coordinateZ.GetValue(loc), 0f, ___coordinateZ.GetValue(loc));
                //__result = new Vector3(___coordinateX.GetValue(loc) - 0.6f * ___coordinateZ.GetValue(loc), 0f, ___coordinateZ.GetValue(loc));


                #region messy confluence
                // this makes debug data in approx. the right shape for a confluence, but the forked part is messy

                //if (___coordinateZ.GetValue(loc) > 0f)
                //{
                //    __result = new Vector3(___coordinateX.GetValue(loc), 0f, ___coordinateZ.GetValue(loc));
                //}

                //else
                //{
                //    if (___coordinateX.GetValue(loc) > 0f)
                //    {
                //        __result = new Vector3(___coordinateX.GetValue(loc) + 0.6f * ___coordinateZ.GetValue(loc), 0f, ___coordinateZ.GetValue(loc));
                //    }
                //    else
                //    {
                //        __result = new Vector3(___coordinateX.GetValue(loc) - 0.6f * ___coordinateZ.GetValue(loc), 0f, ___coordinateZ.GetValue(loc));

                //    }
                //}

                #endregion


                #region messy confluence 2
                // this makes debug data in approx. the right shape for a confluence, but the forked part is messy
                if (___coordinateZ.GetValue(loc) > 0f)
                {
                    __result = new Vector3(___coordinateX.GetValue(loc), 0f, ___coordinateZ.GetValue(loc));
                }

                else
                {
                    if (___coordinateX.GetValue(loc) > 0f)
                    {
                        __result = new Vector3(___coordinateX.GetValue(loc) + 0.6f * ___coordinateZ.GetValue(loc), 0f, ___coordinateZ.GetValue(loc));
                    }
                    else
                    {
                        __result = new Vector3(___coordinateX.GetValue(loc) - 0.6f * ___coordinateZ.GetValue(loc), 0f, ___coordinateZ.GetValue(loc));
                    }
                }

                #endregion

                return(false);
            }

            return(true);
        }
Пример #39
0
 public Multiply(ModuleBase m1, ModuleBase m2)
 {
     module1 = m1;
     module2 = m2;
 }
Пример #40
0
 public Subtract(ModuleBase m1, ModuleBase m2)
 {
     module1 = m1;
     module2 = m2;
 }
Пример #41
0
 public ModuleBaseTests()
 {
     _moduleBase = new ModuleBase(_dbContextOptionsBuilder.Options, SchemaName);
 }
Пример #42
0
 public Invert(ModuleBase input)
     : base(1)
 {
     modules[0] = input;
 }
Пример #43
0
        public static Category GetCategory(int itemId, int portalId, bool loadRelationships, bool loadTags, bool loadItemVersionSettings, bool ignoreCache)
        {
            // cache?
            // var c = (Category)CBO.FillObject(DataProvider.Instance().GetCategory(itemId), typeof(Category));
            // if (c != null)
            // {
            // c.CorrectDates();

            // if (loadRelationships)
            // {
            // c.LoadRelationships();
            // }

            // if (loadTags && ModuleBase.AllowTagsForPortal(c.PortalId))
            // {
            // c.LoadTags();
            // }
            // if (loadItemVersionSettings)
            // {
            // c.LoadItemVersionSettings();
            // }
            // }
            string cacheKey = Utility.CacheKeyPublishCategory + itemId.ToString(CultureInfo.InvariantCulture) + "loadRelationships" +
                              loadRelationships + "loadTags" + loadTags + "loadItemVersionSettings" + loadItemVersionSettings;
            Category c;

            if (!ignoreCache && ModuleBase.UseCachePortal(portalId))
            {
                object o = DataCache.GetCache(cacheKey);
                if (o != null)
                {
                    c = (Category)o;
                }
                else
                {
                    c = (Category)CBO.FillObject(DataProvider.Instance().GetCategory(itemId), typeof(Category));
                    if (c != null)
                    {
                        c.CorrectDates();

                        if (loadRelationships)
                        {
                            c.LoadRelationships();
                        }

                        if (loadTags && ModuleBase.AllowTagsForPortal(c.PortalId))
                        {
                            c.LoadTags();
                        }

                        if (loadItemVersionSettings)
                        {
                            c.LoadItemVersionSettings();
                        }

                        DataCache.SetCache(cacheKey, c, DateTime.Now.AddMinutes(ModuleBase.CacheTimePortal(portalId)));
                        Utility.AddCacheKey(cacheKey, portalId);
                    }
                }
            }
            else
            {
                c = (Category)CBO.FillObject(DataProvider.Instance().GetCategory(itemId), typeof(Category));
                if (c != null)
                {
                    c.CorrectDates();
                    if (loadRelationships)
                    {
                        c.LoadRelationships();
                    }

                    if (loadTags && ModuleBase.AllowTagsForPortal(c.PortalId))
                    {
                        c.LoadTags();
                    }

                    if (loadItemVersionSettings)
                    {
                        c.LoadItemVersionSettings();
                    }
                }
            }

            return(c);
        }
Пример #44
0
        public static Article GetArticle(int itemId, int portalId, bool loadRelationships, bool loadTags, bool loadItemVersionSettings, bool ignoreCache)
        {
            string cacheKey = Utility.CacheKeyPublishArticle + itemId.ToString(CultureInfo.InvariantCulture) + "loadRelationships" + loadRelationships +
                              "loadTags" + loadTags + "loadItemVersionSettings" + loadItemVersionSettings;
            Article a;

            if (!ignoreCache && ModuleBase.UseCachePortal(portalId))
            {
                object o = DataCache.GetCache(cacheKey);
                if (o != null)
                {
                    a = (Article)o;
                }
                else
                {
                    a = GetArticle(itemId);
                    if (a != null)
                    {
                        if (loadRelationships)
                        {
                            a.LoadRelationships();
                        }

                        // we don't need to get the tags if the portal doesn't allow it
                        if (loadTags && ModuleBase.AllowTagsForPortal(portalId))
                        {
                            a.LoadTags();
                        }

                        if (loadItemVersionSettings)
                        {
                            a.LoadItemVersionSettings();
                        }
                    }
                }

                if (a != null)
                {
                    DataCache.SetCache(cacheKey, a, DateTime.Now.AddMinutes(ModuleBase.CacheTimePortal(portalId)));
                    Utility.AddCacheKey(cacheKey, portalId);
                }
            }
            else
            {
                a = GetArticle(itemId);
                if (a != null)
                {
                    if (loadRelationships)
                    {
                        a.LoadRelationships();
                    }

                    // we don't need to get the tags if the portal doesn't allow it
                    if (loadTags && ModuleBase.AllowTagsForPortal(portalId))
                    {
                        a.LoadTags();
                    }

                    if (loadItemVersionSettings)
                    {
                        a.LoadItemVersionSettings();
                    }
                }
            }

            return(a);
        }
Пример #45
0
 public override void OnAddExportedTypes(ModuleBase module)
 {
     CashDisciplineTestHelper.AddExportedTypes(module);
 }
        public async Task <Viewport[]> EditViewportsAsync(string templateName, string exampleImageUrl, ModuleBase module, Viewport[] viewports)
        {
            var deviceViewportMonitorIds = GetDeviceViewportMonitorIds();
            var screens = Screen.AllScreens.Where(s => deviceViewportMonitorIds.Contains(s.DeviceName)).ToArray();

            Array.ForEach(viewports, v => v.MonitorId = screens[0].DeviceName);

            var model =
                new ModuleViewportModel(
                    templateName,
                    exampleImageUrl,
                    module,
                    viewports);

            return(await EditViewportsAsync(model));
        }
Пример #47
0
 public ScaleBias(double scale, double bias, ModuleBase input) : base(1)
 {
     this.m_modules[0] = input;
     this.Bias         = bias;
     this.Scale        = scale;
 }
Пример #48
0
 /// <summary>
 /// Initializes a new instance of Max.
 /// </summary>
 /// <param name="lhs">The left hand input module.</param>
 /// <param name="rhs">The right hand input module.</param>
 public Max(ModuleBase lhs, ModuleBase rhs)
     : base(2)
 {
     this.m_modules[0] = lhs;
     this.m_modules[1] = rhs;
 }
Пример #49
0
        /// <summary>
        /// This method will configure the default ItemVersionSettings for an article, it is called from the Create method on article so that users of the API do not have to pass in itemversionsettings.
        /// </summary>
        private void SetDefaultItemVersionSettings()
        {
            var hostController = HostController.Instance;

            // Printer Friendly
            string hostPrinterFriendlySetting =
                hostController.GetString(Utility.PublishDefaultPrinterFriendly + this.PortalId.ToString(CultureInfo.InvariantCulture));
            Setting setting = Setting.PrinterFriendly;

            setting.PropertyValue = Convert.ToBoolean(hostPrinterFriendlySetting, CultureInfo.InvariantCulture).ToString();
            var itemVersionSetting = new ItemVersionSetting(setting);

            this.VersionSettings.Add(itemVersionSetting);

            // Email A Friend
            string hostEmailFriendSetting =
                hostController.GetString(Utility.PublishDefaultEmailAFriend + this.PortalId.ToString(CultureInfo.InvariantCulture));

            setting = Setting.EmailAFriend;
            setting.PropertyValue = Convert.ToBoolean(hostEmailFriendSetting, CultureInfo.InvariantCulture).ToString();
            itemVersionSetting    = new ItemVersionSetting(setting);
            this.VersionSettings.Add(itemVersionSetting);

            // ratings
            string hostRatingSetting =
                hostController.GetString(Utility.PublishDefaultRatings + this.PortalId.ToString(CultureInfo.InvariantCulture));

            setting = Setting.Rating;
            setting.PropertyValue = Convert.ToBoolean(hostRatingSetting, CultureInfo.InvariantCulture).ToString();
            itemVersionSetting    = new ItemVersionSetting(setting);
            this.VersionSettings.Add(itemVersionSetting);

            // comments
            string hostCommentSetting =
                hostController.GetString(Utility.PublishDefaultComments + this.PortalId.ToString(CultureInfo.InvariantCulture));

            setting = Setting.Comments;
            setting.PropertyValue = Convert.ToBoolean(hostCommentSetting, CultureInfo.InvariantCulture).ToString();
            itemVersionSetting    = new ItemVersionSetting(setting);
            this.VersionSettings.Add(itemVersionSetting);

            if (ModuleBase.IsPublishCommentTypeForPortal(this.PortalId))
            {
                // forum comments
                setting = Setting.ForumComments;
                setting.PropertyValue = Convert.ToBoolean(hostCommentSetting, CultureInfo.InvariantCulture).ToString();
                itemVersionSetting    = new ItemVersionSetting(setting);
                this.VersionSettings.Add(itemVersionSetting);
            }

            // include all articles from the parent category
            setting = Setting.ArticleSettingIncludeCategories;
            setting.PropertyValue = false.ToString();
            itemVersionSetting    = new ItemVersionSetting(setting);
            this.VersionSettings.Add(itemVersionSetting);

            // display on current page option
            setting = Setting.ArticleSettingCurrentDisplay;
            setting.PropertyValue = false.ToString();
            itemVersionSetting    = new ItemVersionSetting(setting);
            this.VersionSettings.Add(itemVersionSetting);

            // force display on specific page
            setting = Setting.ArticleSettingForceDisplay;
            setting.PropertyValue = false.ToString();
            itemVersionSetting    = new ItemVersionSetting(setting);
            this.VersionSettings.Add(itemVersionSetting);

            // display return to list
            setting = Setting.ArticleSettingReturnToList;
            setting.PropertyValue = false.ToString();
            itemVersionSetting    = new ItemVersionSetting(setting);
            this.VersionSettings.Add(itemVersionSetting);

            // show author
            string hostAuthorSetting =
                hostController.GetString(Utility.PublishDefaultShowAuthor + this.PortalId.ToString(CultureInfo.InvariantCulture));

            setting = Setting.Author;
            setting.PropertyValue = Convert.ToBoolean(hostAuthorSetting, CultureInfo.InvariantCulture).ToString();
            itemVersionSetting    = new ItemVersionSetting(setting);
            this.VersionSettings.Add(itemVersionSetting);

            // show tags
            string hostTagsSetting = hostController.GetString(
                Utility.PublishDefaultShowTags + this.PortalId.ToString(CultureInfo.InvariantCulture));

            setting = Setting.ShowTags;
            setting.PropertyValue = Convert.ToBoolean(hostTagsSetting, CultureInfo.InvariantCulture).ToString();
            itemVersionSetting    = new ItemVersionSetting(setting);
            this.VersionSettings.Add(itemVersionSetting);

            // use approvals
            string hostUseApprovalsSetting =
                hostController.GetString(Utility.PublishUseApprovals + this.PortalId.ToString(CultureInfo.InvariantCulture));

            setting = Setting.UseApprovals;
            setting.PropertyValue = Convert.ToBoolean(hostUseApprovalsSetting, CultureInfo.InvariantCulture).ToString();
            itemVersionSetting    = new ItemVersionSetting(setting);
            this.VersionSettings.Add(itemVersionSetting);
        }
Пример #50
0
 /// <summary>
 /// Initializes a new instance of Terrace.
 /// </summary>
 /// <param name="inverted">Indicates whether the terrace curve is inverted.</param>
 /// <param name="input">The input module.</param>
 public Terrace(bool inverted, ModuleBase input)
     : base(1)
 {
     this.m_modules[0] = input;
     this.IsInverted   = inverted;
 }
Пример #51
0
 /// <summary>
 /// Initializes a new instance of Terrace.
 /// </summary>
 /// <param name="inverted">Indicates whether the terrace curve is inverted.</param>
 /// <param name="input">The input module.</param>
 public Terrace(bool inverted, ModuleBase input)
     : base(1)
 {
     Modules[0] = input;
     IsInverted = inverted;
 }
Пример #52
0
        private void ExpandSnow()
        {
            if (this.snowNoise == null)
            {
                this.snowNoise = new Perlin(0.054999999701976776, 2.0, 0.5, 5, Rand.Range(0, 651431), QualityMode.Medium);
            }
            if (this.snowRadius < 8f)
            {
                this.snowRadius += 1.3f;
            }
            else
            {
                if (this.snowRadius < 17f)
                {
                    this.snowRadius += 0.7f;
                }
                else
                {
                    if (this.snowRadius < 30f)
                    {
                        this.snowRadius += 0.4f;
                    }
                    else
                    {
                        this.snowRadius += 0.1f;
                    }
                }
            }
            if (this.snowRadius > 55f)
            {
                this.snowRadius = 55f;
            }
            CellRect occupiedRect = this.OccupiedRect();

            Building_CrashedShipPartCopy.reachableCells.Clear();
            FloodFiller.FloodFill(base.Position, (IntVec3 x) => x.DistanceToSquared(this.Position) <= this.snowRadius * this.snowRadius && (occupiedRect.Contains(x) || !x.Filled()), delegate(IntVec3 x)
            {
                Building_CrashedShipPartCopy.reachableCells.Add(x);
            });
            int num = GenRadial.NumCellsInRadius(this.snowRadius);

            for (int i = 0; i < num; i++)
            {
                IntVec3 intVec = base.Position + GenRadial.RadialPattern[i];
                if (intVec.InBounds())
                {
                    if (Building_CrashedShipPartCopy.reachableCells.Contains(intVec))
                    {
                        float num2 = this.snowNoise.GetValue(intVec);
                        num2 += 1f;
                        num2 *= 0.5f;
                        if (num2 < 0.1f)
                        {
                            num2 = 0.1f;
                        }
                        if (Find.SnowGrid.GetDepth(intVec) <= num2)
                        {
                            float lengthHorizontal = (intVec - base.Position).LengthHorizontal;
                            float num3             = 1f - lengthHorizontal / this.snowRadius;
                            Find.SnowGrid.AddDepth(intVec, num3 * 0.12f * num2);
                        }
                    }
                }
            }
        }
Пример #53
0
 private static void Mi_Click(object sender, RoutedEventArgs e)
 {
     //Handle delete  & initialize commands
     if (sender is MenuItem mi)
     {
         if ((string)mi.Header == "Delete")
         {
             int i = (int)mi.Parent.GetValue(AreaNumberProperty);
             if (i < 0)
             {
                 i = -i - 1;
                 MainWindow.arrayView.theSelection.selectedRectangles.RemoveAt(i);
                 deleted = true;
             }
             else
             {
                 ModuleView mv = MainWindow.theNeuronArray.Modules[i];
                 foreach (Neuron n in mv.Neurons())
                 {
                     n.Reset();
                     n.DeleteAllSynapes();
                 }
                 MainWindow.theNeuronArray.Modules.RemoveAt(i);
                 deleted = true;
             }
         }
         if ((string)mi.Header == "Initialize")
         {
             int i = (int)mi.Parent.GetValue(AreaNumberProperty);
             if (i < 0)
             {
             }
             else
             {
                 MainWindow.theNeuronArray.Modules[i].TheModule.Initialize();
             }
         }
         if ((string)mi.Header == "Show Dialog")
         {
             int i = (int)mi.Parent.GetValue(AreaNumberProperty);
             if (i < 0)
             {
             }
             else
             {
                 MainWindow.theNeuronArray.Modules[i].TheModule.ShowDialog();
             }
         }
         if ((string)mi.Header == "Info...")
         {
             int i = (int)mi.Parent.GetValue(AreaNumberProperty);
             if (i < 0)
             {
             }
             else
             {
                 ModuleView        m  = MainWindow.theNeuronArray.Modules[i];
                 ModuleBase        m1 = m.TheModule;
                 ModuleDescription md = new ModuleDescription(m1.ShortDescription, m1.LongDescription);
                 md.ShowDialog();
             }
         }
         if ((string)mi.Header == "Reset Hebbian Weights")
         {
             foreach (NeuronSelectionRectangle sr in MainWindow.arrayView.theSelection.selectedRectangles)
             {
                 foreach (int Id in sr.NeuronInRectangle())
                 {
                     Neuron n = MainWindow.theNeuronArray.GetNeuron(Id);
                     foreach (Synapse s in n.Synapses)
                     {
                         if (s.isHebbian)
                         {
                             s.Weight = 0;
                             n.AddSynapse(s.targetNeuron, s.weight, s.isHebbian);
                         }
                     }
                 }
             }
             MainWindow.Update();
         }
     }
 }
Пример #54
0
 private void OnEnable()
 {
     module = target as ModuleBase;
 }
Пример #55
0
 /// <summary>
 /// Initializes a new instance of Curve.
 /// </summary>
 /// <param name="input">The input module.</param>
 public Curve(ModuleBase input)
     : base(1)
 {
     Modules[0] = input;
 }
Пример #56
0
 public static void Cleanup()
 {
     beachNoise = null;
 }
Пример #57
0
 public TEWarp(ModuleBase input) : base(1)
 {
     this.m_modules[0] = input;
 }
Пример #58
0
 public void Init(ModuleBase owner)
 {
     nameText.text        = owner.name;
     valueUpdateText.text = null;
     commentText.text     = null;
 }
Пример #59
0
        private void PreviewButton_Click(object sender, RoutedEventArgs e)
        {
            // validate the height/width first
            bool widthValid  = Int32.TryParse(WidthBox.Text, out imageWidth);
            bool heightValid = Int32.TryParse(HeightBox.Text, out imageHeight);
            bool seedValid   = Int32.TryParse(SeedBox.Text, out seed);

            if (!widthValid)
            {
                WidthBox.BorderBrush = System.Windows.Media.Brushes.Red;
            }
            else
            {
                WidthBox.BorderBrush = System.Windows.Media.Brushes.CornflowerBlue;
            }

            if (!heightValid)
            {
                HeightBox.BorderBrush = System.Windows.Media.Brushes.Red;
            }
            else
            {
                HeightBox.BorderBrush = System.Windows.Media.Brushes.CornflowerBlue;
            }

            if (!seedValid)
            {
                SeedBox.BorderBrush = System.Windows.Media.Brushes.Red;
            }
            else
            {
                SeedBox.BorderBrush = System.Windows.Media.Brushes.CornflowerBlue;
            }

            string noiseStyle = ((ComboBoxItem)NoiseStyle.SelectedItem).Content.ToString();
            string colorStyle = ((ComboBoxItem)ColourStyle.SelectedItem).Content.ToString();

            if (noiseStyle.Equals("Planar"))
            {
                selectedNoiseStyle = NoiseStyles.Planar;
            }
            else if (noiseStyle.Equals("Cylindrical"))
            {
                selectedNoiseStyle = NoiseStyles.Cylindrical;
            }
            else
            {
                selectedNoiseStyle = NoiseStyles.Spherical;
            }

            if (colorStyle.Equals("Grayscale"))
            {
                selectedColorStyle = ColourStyles.Greyscale;
            }
            else if (colorStyle.Equals("Blue/Red"))
            {
                selectedColorStyle = ColourStyles.RedBlue;
            }
            else
            {
                selectedColorStyle = ColourStyles.World;
            }

            if (seedValid)
            {
                // clone the module by generating a new module via serialization
                // this is not the nicest way of doing this, so we'll improve it later with a proper clone mechanism
                // for now though, it works quite well
                XmlDocument doc    = LibnoiseFileUtils.DiagramToXML(nodes);
                ModuleBase  module = LibnoiseFileUtils.LoadLibnoiseXml(doc);
                SetSeeds(module, seed);
                this.module = module;
            }

            if (widthValid && heightValid && seedValid)
            {
                GeneratePreview();
            }
        }
Пример #60
0
        protected override void OnSingletonBehaviourInitialized()
        {
            if (m_dontDestroyOnLoad && transform.parent == null && Application.isPlaying)
            {
                DontDestroyOnLoad(gameObject);
            }

            m_activatedModule     = VRModuleActiveEnum.Uninitialized;
            m_activatedModuleBase = null;

            try
            {
                var modules        = new List <ModuleBase>();
                var modulesOrdered = new List <ModuleBase>();
                foreach (var type in Assembly.GetAssembly(typeof(ModuleBase)).GetTypes().Where(t => t.IsClass && !t.IsAbstract && t.IsSubclassOf(typeof(ModuleBase))))
                {
                    var inst  = type == typeof(SimulatorVRModule) ? s_simulator : (ModuleBase)Activator.CreateInstance(type);
                    var index = inst.moduleIndex;

                    if (index < 0)
                    {
                        Debug.LogWarning("Invalid module index, module will not be activated! module name=" + type.Name + " index=" + index);
                    }
                    else if (index < modules.Count && modules[index] != null)
                    {
                        Debug.LogWarning("Duplicated module index, module will not be activated! module name=" + type.Name + " index=" + index);
                    }
                    else
                    {
                        while (index >= modules.Count)
                        {
                            modules.Add(null);
                        }
                        modules[index] = inst;
                    }

                    var order = inst.moduleOrder;

                    if (order < 0)
                    {
                        Debug.LogWarning("Invalid module order, module will not be activated! module name=" + type.Name + " order=" + order);
                    }
                    else if (order < modulesOrdered.Count && modulesOrdered[order] != null)
                    {
                        Debug.LogWarning("Duplicated module order, module will not be activated! module name=" + type.Name + " order=" + order);
                    }
                    else
                    {
                        while (order >= modulesOrdered.Count)
                        {
                            modulesOrdered.Add(null);
                        }
                        modulesOrdered[order] = inst;
                    }
                }
                m_modules        = modules.ToArray();
                m_modulesOrdered = modulesOrdered.ToArray();
            }
            catch (Exception e)
            {
                m_modules        = new ModuleBase[] { new DefaultModule() };
                m_modulesOrdered = new ModuleBase[] { new DefaultModule() };
                Debug.LogError(e);
            }
        }