Ejemplo n.º 1
0
        private void btnAddLight_Click(object sender, RoutedEventArgs e)
        {
            UnitLight light = new UnitLight();

            light.LightDebugName = new String8Property()
            {
                Value = "New"
            };
            light.LightColor = new ColorRGBProperty()
            {
                Color = Colors.White
            };
            light.LightType = new KeyProperty()
            {
                InstanceId = LightTypes.First(l => l.Value == "Point").Key
            };
            light.LightCullDistance = new KeyProperty()
            {
                InstanceId = LightCullDistances.First(l => l.Value == "Max").Key
            };

            light.LightTransform = new TransformProperty();
            light.LightTransform.SetMatrix(new TranslateTransform3D(0, 0, 10).Value);
            //light.LightTransform.SetMatrix(new TranslateTransform3D(0, 0, meshMain.Bounds.SizeZ + 10).Value);

            UnitFileEntry.UnitLights.Add(light);

            light.CreateGeometry();

            viewPort.Children.Add(light.ModelRepresentation);
            UnitFileEntry.UnitLights.Changed();
        }
Ejemplo n.º 2
0
        private void tbLength_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (this.DataContext is UnitLight)
            {
                UnitLight light = ((UnitLight)this.DataContext);

                light.UpdateGeometry();
            }
        }
Ejemplo n.º 3
0
        void newLight_LightTypeChanged(object sender, EventArgs e)
        {
            UnitLight light = sender as UnitLight;

            light.UpdateTransform();
            viewPort.Children.Remove(light.ModelRepresentation);
            light.ModelRepresentation = light.CreateGeometry();
            viewPort.Children.Add(light.ModelRepresentation);

            lbLights.SelectedItem = light;
        }
Ejemplo n.º 4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ColorPickerControls.Dialogs.ColorPickerFullDialog dlg = new ColorPickerControls.Dialogs.ColorPickerFullDialog();
            UnitLight light = ((UnitLight)lbLights.SelectedItem);

            dlg.InitialColor = ((UnitLight)lbLights.SelectedItem).LightColor.Color;
            if (dlg.ShowDialog().GetValueOrDefault(false))
            {
                light.LightColor.Color = dlg.SelectedColor;
            }
        }
Ejemplo n.º 5
0
        private void cbLightType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.DataContext is UnitLight)
            {
                UnitLight light = ((UnitLight)this.DataContext);


                // light.ModelRepresentation = light.CreateGeometry();

                light.OnLightTypeChanged(light, new EventArgs());
            }
        }
Ejemplo n.º 6
0
    public void SetLight(UnitLight light, bool isOn)
    {
        switch (light)
        {
        case UnitLight.attack:
            attackLight.gameObject.SetActive(isOn);
            break;

        case UnitLight.hurt:
            hurtLight.gameObject.SetActive(isOn);
            break;
        }
    }
Ejemplo n.º 7
0
 private void lbLights_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (lbLights.SelectedItem is UnitLight)
     {
         UnitLight light = (UnitLight)lbLights.SelectedItem;
         if (light.ModelRepresentation != null)
         {
             BindingOperations.SetBinding(manipulator, CombinedManipulator.TargetTransformProperty, new Binding("Transform")
             {
                 Source = light.ModelRepresentation
             });
             ResizeManipulator(light.ModelRepresentation);
         }
         contentHolder.Content = light;
     }
 }
Ejemplo n.º 8
0
        private void cbLightType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            UnitLight light = ((FrameworkElement)((sender as ComboBox).Parent)).DataContext as UnitLight;

            if (light != null)
            {
                light.UpdateTransform();

                if (light.ModelRepresentation != null)
                {
                    viewPort.Children.Remove(light.ModelRepresentation);
                }
                light.CreateGeometry();
                viewPort.Children.Add(light.ModelRepresentation);
                // manipulator.Bind(light.ModelRepresentation);
            }
        }
Ejemplo n.º 9
0
        private void btnCloneLight_Click(object sender, RoutedEventArgs e)
        {
            if (lbLights.SelectedItem is UnitLight)
            {
                UnitLight selLight = (UnitLight)lbLights.SelectedItem;
                selLight.UpdateTransform();

                UnitLight light = new UnitLight();
                light.LightDebugName = new String8Property()
                {
                    Value = "New"
                };
                light.LightColor        = selLight.LightColor;
                light.LightType         = selLight.LightType;
                light.LightCullDistance = selLight.LightCullDistance;
                light.LightId           = selLight.LightId;

                light.LightInnerRadius  = selLight.LightInnerRadius;
                light.LightOuterRadius  = selLight.LightOuterRadius;
                light.LightSpecLevels   = selLight.LightSpecLevels;
                light.LightLength       = selLight.LightLength;
                light.IsVolumetric      = selLight.IsVolumetric;
                light.LightDiffuseLevel = selLight.LightDiffuseLevel;
                light.LightVolStrength  = selLight.LightVolStrength;
                light.LightFalloffStart = selLight.LightFalloffStart;

                light.LightTransform = new TransformProperty();
                light.LightTransform.SetMatrix(selLight.LightTransform.GetAsMatrix3D());
                light.LightTransform.Unknown = selLight.LightTransform.Unknown;
                light.LightTransform.Flags   = selLight.LightTransform.Flags;

                light.CreateGeometry();

                UnitFileEntry.UnitLights.Add(light);
                UnitFileEntry.UnitLights.Changed();

                if (chkLights.IsChecked.GetValueOrDefault(false))
                {
                    viewPort.Children.Add(light.ModelRepresentation);
                }
            }
        }
Ejemplo n.º 10
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ColorPickerControls.Dialogs.ColorPickerFullDialog dlg = new ColorPickerControls.Dialogs.ColorPickerFullDialog();
            UnitLight light = ((UnitLight)this.DataContext);

            dlg.InitialColor = light.LightColor.Color;
            if (dlg.ShowDialog().GetValueOrDefault(false))
            {
                light.LightColor.Color = dlg.SelectedColor;
            }

            var expression = rectangle1.GetBindingExpression(Border.BackgroundProperty);

            if (expression != null)
            {
                expression.UpdateTarget();
            }

            light.UpdateGeometry();
        }
Ejemplo n.º 11
0
 private void viewPort_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Delete)
     {
         //Delete the selected item from the list (if any)
         if (tabProps.IsSelected)
         {
             UnitBinDrawSlot selectedItem = dgProps.SelectedItem as UnitBinDrawSlot;
             viewPort.Children.Remove(selectedItem.ModelRepresentation);
             foreach (ObservableList <UnitBinDrawSlot> slotList in UnitFileEntry.UnitBinDrawSlots)
             {
                 slotList.Remove(selectedItem);
             }
         }
         if (tabEffects.IsSelected)
         {
             UnitEffect selectedItem = dgEffects.SelectedItem as UnitEffect;
             viewPort.Children.Remove(selectedItem.ModelRepresentation);
             UnitFileEntry.UnitEffects.Remove(selectedItem);
         }
         if (tabLights.IsSelected)
         {
             UnitLight selectedItem = lbLights.SelectedItem as UnitLight;
             viewPort.Children.Remove(selectedItem.ModelRepresentation);
             UnitFileEntry.UnitLights.Remove(selectedItem);
         }
         if (tabDecals.IsSelected)
         {
             UnitDecal selectedItem = dgDecals.SelectedItem as UnitDecal;
             viewPort.Children.Remove(selectedItem.ModelRepresentation);
             foreach (ObservableList <UnitDecal> slotList in UnitFileEntry.UnitBinDecals)
             {
                 slotList.Remove(selectedItem);
             }
         }
     }
 }