コード例 #1
0
ファイル: LightCreator.cs プロジェクト: remixod/sharpwow
        public static LightCreator InitFromExistingLight(World.WorldLightEntry worldLight)
        {
            var dlg = new LightCreator();
            var pos = worldLight.Position;
            dlg.numericUpDown1.Value = (decimal)(pos.X - Utils.Metrics.MidPoint);
            dlg.numericUpDown2.Value = (decimal)(pos.Z - Utils.Metrics.MidPoint);
            dlg.numericUpDown3.Value = (decimal)pos.Y;
            dlg.numericUpDown4.Value = (decimal)worldLight.InnerRadius;
            dlg.numericUpDown5.Value = (decimal)worldLight.OuterRadius;

            // ToList is used to make sure a copy of the list is created to prevent the existing tables from being changed.
            dlg.lightColorSelector1.InitFromWorldLight(worldLight.GetTimeLine(World.ColorTableValues.GlobalDiffuse).ToList(), worldLight.GetColorLine(World.ColorTableValues.GlobalDiffuse).ToList());
            dlg.lightColorSelector2.InitFromWorldLight(worldLight.GetTimeLine(World.ColorTableValues.GlobalAmbient).ToList(), worldLight.GetColorLine(World.ColorTableValues.GlobalAmbient).ToList());
            dlg.lightColorSelector3.InitFromWorldLight(worldLight.GetTimeLine(World.ColorTableValues.Fog).ToList(), worldLight.GetColorLine(World.ColorTableValues.Fog).ToList());
            dlg.lightColorSelector4.InitFromWorldLight(worldLight.GetTimeLine(World.ColorTableValues.Color0).ToList(), worldLight.GetColorLine(World.ColorTableValues.Color0).ToList());
            dlg.lightColorSelector5.InitFromWorldLight(worldLight.GetTimeLine(World.ColorTableValues.Color1).ToList(), worldLight.GetColorLine(World.ColorTableValues.Color1).ToList());
            dlg.lightColorSelector6.InitFromWorldLight(worldLight.GetTimeLine(World.ColorTableValues.Color2).ToList(), worldLight.GetColorLine(World.ColorTableValues.Color2).ToList());
            dlg.lightColorSelector7.InitFromWorldLight(worldLight.GetTimeLine(World.ColorTableValues.Color3).ToList(), worldLight.GetColorLine(World.ColorTableValues.Color3).ToList());
            dlg.lightColorSelector8.InitFromWorldLight(worldLight.GetTimeLine(World.ColorTableValues.Color4).ToList(), worldLight.GetColorLine(World.ColorTableValues.Color4).ToList());
            dlg.lightColorSelector9.InitFromWorldLight(worldLight.GetTimeLine(World.ColorTableValues.SunColor).ToList(), worldLight.GetColorLine(World.ColorTableValues.SunColor).ToList());
            dlg.lightColorSelector10.InitFromWorldLight(worldLight.GetTimeLine(World.ColorTableValues.SunHaloColor).ToList(), worldLight.GetColorLine(World.ColorTableValues.SunHaloColor).ToList());
            dlg.lightColorSelector11.InitFromWorldLight(worldLight.GetTimeLine(World.ColorTableValues.WaterDark).ToList(), worldLight.GetColorLine(World.ColorTableValues.WaterDark).ToList());
            dlg.lightColorSelector12.InitFromWorldLight(worldLight.GetTimeLine(World.ColorTableValues.WaterLight).ToList(), worldLight.GetColorLine(World.ColorTableValues.WaterLight).ToList());
            dlg.lightColorSelector13.InitFromWorldLight(worldLight.GetTimeLine(World.ColorTableValues.Shadow).ToList(), worldLight.GetColorLine(World.ColorTableValues.Shadow).ToList());

            dlg.mLightEntry = worldLight;
            dlg.numericUpDown6.Value = (decimal)worldLight.LightParams.glow;
            dlg.comboBox1.SelectedIndex = (int)worldLight.LightParams.cloudID;
            dlg.checkBox1.Checked = worldLight.LightParams.HighlightSky > 0;

            var skyb = worldLight.LightParams.skyboxID;
            if (DBC.DBCStores.LightSkyBox.ContainsKey(skyb))
            {
                dlg.textBox1.Text = DBC.DBCStores.LightSkyBox[skyb].Path;
                dlg.textBox1.Tag = DBC.DBCStores.LightSkyBox[skyb].ID;
            }
            else
            {
                dlg.textBox1.Text = "(none)";
                dlg.textBox1.Tag = (uint)0;
            }

            dlg.numericUpDown7.Value = (decimal)worldLight.LightParams.waterShallowAlpha;
            dlg.numericUpDown8.Value = (decimal)worldLight.LightParams.waterDeepAlpha;
            dlg.numericUpDown9.Value = (decimal)worldLight.LightParams.oceanShallowAlpha;
            dlg.numericUpDown10.Value = (decimal)worldLight.LightParams.oceanDeepAlpha;
            return dlg;
        }