Пример #1
0
 static ResourceManager()
 {
     if (Application.Current.Resources.ContainsKey("resourceManager"))
     {
         _currentResourceDictionary = (IResourceDictionary)Application.Current.Resources["resourceManager"];
     }
 }
Пример #2
0
 public UIVisual(Actor actor, SpriteBatch spriteBatch, IResourceDictionary resourceDictionary)
     : base(resourceDictionary)
 {
     this._actor = actor;
     this._spriteBatch = spriteBatch;
     this._currentAnimations = new List<Animation>();
 }
Пример #3
0
        public void Attach(IResourceNode node, IResourceDictionary resources, Action <ThemeViewModel> preview = null)
        {
            var defaultThem = GetTheme(node);

            defaultThem.Name = "BaseLight";

            DefaultTheme = defaultThem;

            if (Themes == null)
            {
                CurrentTheme = defaultThem.Clone();
#pragma warning disable CS0618
                Themes = new ReactiveList <ThemeViewModel>();
                Themes.Add(CurrentTheme);
#pragma warning restore CS0618
            }
            else
            {
                CurrentTheme = Themes.FirstOrDefault();
            }

            _themeObservable = ObserveTheme(resources, CurrentTheme, preview);

            _editorObservable = Changed.Subscribe(x =>
            {
                if (x.PropertyName == nameof(CurrentTheme))
                {
                    _themeObservable?.Dispose();
                    if (CurrentTheme != null)
                    {
                        _themeObservable = ObserveTheme(resources, CurrentTheme, preview);
                    }
                }
            });
        }
Пример #4
0
 public UITextBlockVisual(UITextBlockActor actor, SpriteBatch spriteBatch, IResourceDictionary resourceDictionary)
 {
     _actor = actor;
     _spriteBatch = spriteBatch;
     _currentAnimations = new List<Animation>();
     this._resourceDictionary = resourceDictionary;
 }
Пример #5
0
        public void Attach(IResourceDictionary resources, Action <ThemeViewModel>?preview = null)
        {
            if (Themes == null)
            {
                CurrentTheme = DefaultTheme?.Clone();
                Themes       = new ObservableCollection <ThemeViewModel>();
                if (CurrentTheme != null)
                {
                    Themes.Add(CurrentTheme);
                }
            }
            else
            {
                CurrentTheme = Themes.FirstOrDefault();
            }

            if (CurrentTheme != null)
            {
                _themeObservable = ObserveTheme(resources, CurrentTheme, preview);

                _editorObservable = Changed.Subscribe(x =>
                {
                    if (x.PropertyName == nameof(CurrentTheme))
                    {
                        _themeObservable?.Dispose();
                        if (CurrentTheme != null)
                        {
                            _themeObservable = ObserveTheme(resources, CurrentTheme, preview);
                        }
                    }
                });
            }
        }
Пример #6
0
 private void UpdateThemeBorderThickness(IResourceDictionary resources, ThemeViewModel theme)
 {
     if (theme.ThemeBorderThickness != null)
     {
         resources["ThemeBorderThickness"] = theme.ThemeBorderThickness.ToThickness();
     }
 }
Пример #7
0
 public void UpdateTheme(IResourceDictionary resources, ThemeViewModel theme)
 {
     UpdateThemeAccent(resources, theme);
     UpdateThemeAccent2(resources, theme);
     UpdateThemeAccent3(resources, theme);
     UpdateThemeAccent4(resources, theme);
     UpdateThemeBackground(resources, theme);
     UpdateThemeBorderLow(resources, theme);
     UpdateThemeBorderMid(resources, theme);
     UpdateThemeBorderHigh(resources, theme);
     UpdateThemeControlLow(resources, theme);
     UpdateThemeControlMid(resources, theme);
     UpdateThemeControlHigh(resources, theme);
     UpdateThemeControlHighlightLow(resources, theme);
     UpdateThemeControlHighlightMid(resources, theme);
     UpdateThemeControlHighlightHigh(resources, theme);
     UpdateThemeForeground(resources, theme);
     UpdateThemeForegroundLow(resources, theme);
     UpdateHighlight(resources, theme);
     UpdateError(resources, theme);
     UpdateErrorLow(resources, theme);
     UpdateThemeBorderThickness(resources, theme);
     UpdateThemeDisabledOpacity(resources, theme);
     UpdateFontSizeSmall(resources, theme);
     UpdateFontSizeNormal(resources, theme);
     UpdateUpdateFontSizeLarge(resources, theme);
     UpdateUpdateScrollBarThickness(resources, theme);
 }
Пример #8
0
 private void UpdateThemeAccent4(IResourceDictionary resources, ThemeViewModel theme)
 {
     if (theme.ThemeAccentColor4 != null)
     {
         resources["ThemeAccentColor4"] = theme.ThemeAccentColor4.ToColor();
         resources["ThemeAccentBrush4"] = theme.ThemeAccentColor4.ToBrush();
     }
 }
Пример #9
0
 private void UpdateThemeBorderMid(IResourceDictionary resources, ThemeViewModel theme)
 {
     if (theme.ThemeBorderMidColor != null)
     {
         resources["ThemeBorderMidColor"] = theme.ThemeBorderMidColor.ToColor();
         resources["ThemeBorderMidBrush"] = theme.ThemeBorderMidColor.ToBrush();
     }
 }
Пример #10
0
 private void UpdateErrorLow(IResourceDictionary resources, ThemeViewModel theme)
 {
     if (theme.ErrorLowColor != null)
     {
         resources["ErrorLowColor"] = theme.ErrorLowColor.ToColor();
         resources["ErrorLowBrush"] = theme.ErrorLowColor.ToBrush();
     }
 }
Пример #11
0
 private void UpdateHighlight(IResourceDictionary resources, ThemeViewModel theme)
 {
     if (theme.HighlightColor != null)
     {
         resources["HighlightColor"] = theme.HighlightColor.ToColor();
         resources["HighlightBrush"] = theme.HighlightColor.ToBrush();
     }
 }
Пример #12
0
 private void UpdateThemeForegroundLow(IResourceDictionary resources, ThemeViewModel theme)
 {
     if (theme.ThemeForegroundLowColor != null)
     {
         resources["ThemeForegroundLowColor"] = theme.ThemeForegroundLowColor.ToColor();
         resources["ThemeForegroundLowBrush"] = theme.ThemeForegroundLowColor.ToBrush();
     }
 }
Пример #13
0
 private void UpdateThemeControlHighlightHigh(IResourceDictionary resources, ThemeViewModel theme)
 {
     if (theme.ThemeControlHighlightHighColor != null)
     {
         resources["ThemeControlHighlightHighColor"] = theme.ThemeControlHighlightHighColor.ToColor();
         resources["ThemeControlHighlightHighBrush"] = theme.ThemeControlHighlightHighColor.ToBrush();
     }
 }
        public ParticleEffect CreateEffect(IResourceDictionary resourceDictionary)
        {
            var effect = new ParticleEffect
            {
                Emitters = new EmitterCollection
                                {            
                                     new PointEmitter
                                        {
                                            Budget = 32,
                                            Term = 1.0f,                                            
                                            ParticleTexture = (Texture2D)resourceDictionary.GetResource("Zazumo.Textures.Particles.BulletTrail"),
                                            BlendMode = EmitterBlendMode.Alpha,
                                            ReleaseColour = new ColourRange { Red = 0.0f, Green = 0.5f, Blue = 0.1f },
                                            ReleaseOpacity = 0.0f,
                                            ReleaseQuantity = 1,
                                            ReleaseRotation = new RotationRange 
                                                                {
                                                                    Roll = new Range(0f, 1.5f)
                                                                },
                                            ReleaseScale = new Range(20f, 20f),
                                            ReleaseSpeed = new Range(0f, 100f),
                                            
                                            Modifiers = new ModifierCollection
                                                            {
                                                                new ScaleInterpolator3
                                                                {
                                                                      FinalScale = 0f,
                                                                      InitialScale = 20f,
                                                                      Median = 0.25f,
                                                                      MedianScale = 20f
                                                                },

                                                                new ColourInterpolator2
                                                                    {
                                                                         FinalColour = new Vector3(1f, 0.25f, 0f),
                                                                         InitialColour = new Vector3(0f, 0.5f, 1f)
                                                                    },

                                                                new OpacityInterpolator3
                                                                {
                                                                     InitialOpacity = 0.0f,
                                                                     FinalOpacity = 0.5f,
                                                                     Median = 0.1f,
                                                                     MedianOpacity = 1.0f                                                                      
                                                                }
                                                            },
                                        },                           
                                },
            };

            foreach (var emitter in effect.Emitters)
            {
                emitter.Initialise();
            }

            return effect;
        }
Пример #15
0
        public ParticleEffectVisual(ParticleSystemActor actor,  SpriteBatchRenderer renderer,  IResourceDictionary resourceDictionary)
            : base (resourceDictionary)
        {
            this._renderer = renderer;
            this._actor = actor;

            world = view = projection = Matrix.Identity;
            cameraPosition = Vector3.Up;
        }
Пример #16
0
        public static IThemeManager GetThemeManager(this IResourceDictionary resourceDictionary)
        {
            if (resourceDictionary == null)
            {
                throw new ArgumentNullException(nameof(resourceDictionary));
            }

            return(resourceDictionary.TryGetResource(ThemeManagerKey, out var manager) ? manager as IThemeManager : null);
        }
Пример #17
0
        public static string GetString(string key)
        {
            IResourceDictionary resDict = Application.Current.Resources;

            if (resDict.TryGetResource(key, out var outVar) && outVar is string s)
            {
                return(s);
            }
            return(key);
        }
Пример #18
0
 private void SetCustomAccentColor(IResourceDictionary resources)
 {
     resources["SystemAccentColor"]       = CustomAccentColors[0];
     resources["SystemAccentColorLight1"] = CustomAccentColors[1];
     resources["SystemAccentColorLight2"] = CustomAccentColors[2];
     resources["SystemAccentColorLight3"] = CustomAccentColors[3];
     resources["SystemAccentColorDark1"]  = CustomAccentColors[4];
     resources["SystemAccentColorDark2"]  = CustomAccentColors[5];
     resources["SystemAccentColorDark3"]  = CustomAccentColors[6];
 }
        /// <summary>
        /// Adds another resource dictionary. Values from the dictionary will be merged with current
        /// values. Existing values will be replaced.
        /// </summary>
        /// <param name="dictionary">The resource dictionary.</param>
        /// <exception cref="CultureDoesNotMatchException">
        /// Added dictionary is for different culture than the current dictionary.
        /// </exception>
        public void Add(IResourceDictionary dictionary)
        {
            Requires.NotNull(dictionary, nameof(dictionary));

            if (!Equals(Culture, dictionary.Culture))
            {
                throw new CultureDoesNotMatchException();
            }

            MergeValues(values, dictionary.Values);
        }
Пример #20
0
 private BundledTheme?LocateBundledThemeInternal(IResourceDictionary dictionary)
 {
     if (dictionary is BundledTheme bundledTheme)
     {
         return(bundledTheme);
     }
     return(dictionary.MergedDictionaries
            .Select(provider => provider as IResourceDictionary)
            .Where(resourceDictionary => resourceDictionary != null)
            .Select(LocateBundledThemeInternal !)
            .FirstOrDefault());
 }
Пример #21
0
        public IDisposable ObserveTheme(IResourceDictionary resources, ThemeViewModel theme, Action <ThemeViewModel>?preview = null)
        {
            var disposable = new CompositeDisposable();

            Observe(theme, UpdateTheme);
            Observe(theme.ThemeAccentColor, UpdateThemeAccent);
            Observe(theme.ThemeAccentColor2, UpdateThemeAccent2);
            Observe(theme.ThemeAccentColor3, UpdateThemeAccent3);
            Observe(theme.ThemeAccentColor4, UpdateThemeAccent4);
            Observe(theme.ThemeBackgroundColor, UpdateThemeBackground);
            Observe(theme.ThemeBorderLowColor, UpdateThemeBorderLow);
            Observe(theme.ThemeBorderMidColor, UpdateThemeBorderMid);
            Observe(theme.ThemeBorderHighColor, UpdateThemeBorderHigh);
            Observe(theme.ThemeControlLowColor, UpdateThemeControlLow);
            Observe(theme.ThemeControlMidColor, UpdateThemeControlMid);
            Observe(theme.ThemeControlHighColor, UpdateThemeControlHigh);
            Observe(theme.ThemeControlHighlightLowColor, UpdateThemeControlHighlightLow);
            Observe(theme.ThemeControlHighlightMidColor, UpdateThemeControlHighlightMid);
            Observe(theme.ThemeControlHighlightHighColor, UpdateThemeControlHighlightHigh);
            Observe(theme.ThemeForegroundColor, UpdateThemeForeground);
            Observe(theme.ThemeForegroundLowColor, UpdateThemeForegroundLow);
            Observe(theme.HighlightColor, UpdateHighlight);
            Observe(theme.ErrorColor, UpdateError);
            Observe(theme.ErrorLowColor, UpdateErrorLow);
            Observe(theme.ThemeBorderThickness, UpdateThemeBorderThickness);

            if (resources != null)
            {
                UpdateTheme(resources, theme);
            }
            preview?.Invoke(theme);

            return(disposable);

            void Observe(IReactiveNotifyPropertyChanged <IReactiveObject>?value, Action <IResourceDictionary, ThemeViewModel> update)
            {
                if (value != null)
                {
                    disposable.Add(value.Changed.Subscribe(x =>
                    {
                        if (x.PropertyName != nameof(ThemeViewModel.Name))
                        {
                            if (resources != null)
                            {
                                update(resources, theme);
                            }
                            preview?.Invoke(theme);
                        }
                    }));
                }
            }
        }
Пример #22
0
 /// <summary>
 /// 获取资源字符串。
 /// </summary>
 /// <param name="resource">给定的 <see cref="IResourceDictionary"/>。</param>
 /// <param name="key">指定的键。</param>
 /// <param name="containsKey">输出包含此键的布尔值。</param>
 /// <returns>返回字符串值。</returns>
 public static string GetString(this IResourceDictionary resource, string key, out bool containsKey)
 {
     if (resource.TryGet(key, out var result))
     {
         containsKey = true;
         return(result.ToString() ?? string.Empty);
     }
     else
     {
         containsKey = false;
         return(string.Empty);
     }
 }
Пример #23
0
        /// <summary>
        /// Loads localized values from the given dictionary.
        /// </summary>
        /// <param name="dictionary">The resource dictionary.</param>
        public static void Load(IResourceDictionary dictionary)
        {
            Requires.NotNull(dictionary, nameof(dictionary));

            var culture = dictionary.Culture;

            if (!dictionaries.ContainsKey(culture))
            {
                dictionaries[culture] = new AggregateDictionary(culture);
            }

            dictionaries[culture].Add(dictionary);
        }
Пример #24
0
 /// <summary>
 /// 尝试获取资源字符串。
 /// </summary>
 /// <param name="resource">给定的 <see cref="IResourceDictionary"/>。</param>
 /// <param name="key">指定的键。</param>
 /// <param name="value">输出字符串值。</param>
 /// <returns>返回布尔值。</returns>
 public static bool TryGetString(this IResourceDictionary resource, string key, out string value)
 {
     if (resource.TryGet(key, out var result))
     {
         value = result.ToString() ?? string.Empty;
         return(true);
     }
     else
     {
         value = string.Empty;
         return(false);
     }
 }
        public ParticleEffect CreateEffect(IResourceDictionary resourceDictionary)
        {
            var effect = new ParticleEffect
            {
                Emitters = new EmitterCollection
                                {            
                                     new PointEmitter
                                        {
                                            Name = "Sparks",
                                            Budget = 35,
                                            Term = 0.75f,                                            
                                            ParticleTexture = (Texture2D)resourceDictionary.GetResource("Zazumo.Textures.Particles.Sparks"),
                                            BlendMode = EmitterBlendMode.Alpha,
                                            ReleaseColour = new ColourRange { Red = 1f, Green = new Range(0.4f, 0.8f), Blue = 0f },
                                            ReleaseOpacity = 1.0f,
                                            ReleaseQuantity = 35,
                                            ReleaseRotation = new RotationRange 
                                                                {
                                                                    Roll = new Range(0f, 0f)
                                                                },
                                            ReleaseScale = new Range(3f, 7f),
                                            ReleaseSpeed = new Range(0f, 250f),
                                            
                                            Modifiers = new ModifierCollection
                                                            {
                                                                new OpacityInterpolator2
                                                                {
                                                                     FinalOpacity = 0f,
                                                                     InitialOpacity = 1f
                                                                },
                                                                
                                                                new DampingModifier
                                                                {
                                                                     DampingCoefficient = 2f
                                                                }
                                                            },
                                        },                           
                                },
            };

            effect.Emitters["Sparks"].Controllers.AddFirst(new CooldownController { CooldownPeriod = 5.0f });

            foreach (var emitter in effect.Emitters)
            {
                emitter.Initialise();
            }

            return effect;
        }
Пример #26
0
        public PhysicsSubsystem(IActorPhysicsFactory physicsFactory, IResourceDictionary resources, IBus bus)
        {
            _world = new World(Vector2.Zero);
            _actorMap = new Dictionary<Actor, IActorPhysics>();
            _actorBodies = new Dictionary<Actor, Body>();
            _dynamicActors = new List<Actor>();
            _queuedActions = new List<Func<Boolean>>();
            _physicsFactory = physicsFactory;
            _resources = resources;
            _bus = bus;
            _currentContacts = new List<Contact>();

            _world.ContactManager.BeginContact += OnBeginContact;
            //_world.ContactManager.EndContact += OnEndContact;
        }
Пример #27
0
        /// <summary>
        /// Sets the system accent colors from the users settings
        /// </summary>
        private void SetSystemAccentColorsFromSystem(IResourceDictionary resources)
        {
            var themeAccent       = Win32Interop.GetThemeColorRef("ImmersiveSystemAccent");
            var themeAccentLight1 = Win32Interop.GetThemeColorRef("ImmersiveSystemAccentLight1");
            var themeAccentLight2 = Win32Interop.GetThemeColorRef("ImmersiveSystemAccentLight2");
            var themeAccentLight3 = Win32Interop.GetThemeColorRef("ImmersiveSystemAccentLight3");
            var themeAccentDark1  = Win32Interop.GetThemeColorRef("ImmersiveSystemAccentDark1");
            var themeAccentDark2  = Win32Interop.GetThemeColorRef("ImmersiveSystemAccentDark2");
            var themeAccentDark3  = Win32Interop.GetThemeColorRef("ImmersiveSystemAccentDark3");

            resources["SystemAccentColor"]       = themeAccent;
            resources["SystemAccentColorLight1"] = themeAccentLight1;
            resources["SystemAccentColorLight2"] = themeAccentLight2;
            resources["SystemAccentColorLight3"] = themeAccentLight3;
            resources["SystemAccentColorDark1"]  = themeAccentDark1;
            resources["SystemAccentColorDark2"]  = themeAccentDark2;
            resources["SystemAccentColorDark3"]  = themeAccentDark3;
        }
Пример #28
0
        public PhysicsActorBehavior(PhysicsSubsystem physicsSubsystem, IActorRepository actorRepository, IBus bus, IResourceDictionary resources, IEnumerable<Type> actorEventTypes)
        {
            _physicsSubsystem = physicsSubsystem;
            _resources = resources;
            _repository = actorRepository;
            _actorMap = new Dictionary<Guid, IActorPhysics>();

            bus.Subscribe<ActorCreatedEvent>(x => ActorCreated(x), this, Priority.Low);
            bus.Subscribe<ActorDestroyedEvent>(x => ActorDestroyed(x), this, Priority.High);
            bus.Subscribe<ActorPositionSetEvent>(x => SetPosition(x), this, Priority.High);
            bus.Subscribe<ActorVelocitySetEvent>(x => SetVelocity(x), this, Priority.High);
            bus.Subscribe<ForceAppliedToActorEvent>(x => ForceAppliedToActor(x), this, Priority.High);

            foreach (var type in actorEventTypes)
            {
                bus.Subscribe(type, (Action<Object>)(x => EventHandler(x)), this, Priority.High);
            }
        }
        public VisualActorBehaviorSubsystem(IEnumerable<Type> actorEventTypes, IVisualSubsystem visualSubsystem, IBus bus, IResourceDictionary resources)
        {
            _visualProcessor = visualSubsystem;
            _visualMap = new Dictionary<Guid, IActorVisual>();
            _resources = resources;

            bus.Subscribe<ActorCreatedEvent>(x => ActorCreated(x), this, Priority.Low);
            bus.Subscribe<ActorDestroyedEvent>(x => ActorDestroyed(x), this, Priority.Low);

            bus.Subscribe(typeof(ActorSpriteSetEvent), (Action<Object>)(x => EventHandler(x)), this, Priority.High);
            bus.Subscribe(typeof(AnimationStartedEvent), (Action<Object>)(x => EventHandler(x)), this, Priority.High);
            bus.Subscribe(typeof(ActorFrameSetSetEvent), (Action<Object>)(x => EventHandler(x)), this, Priority.High);
            bus.Subscribe(typeof(ActorZIndexSetEvent), (Action<Object>)(x => ZIndexEventHandler((ActorZIndexSetEvent)x)), this, Priority.High);
            
            foreach (var type in actorEventTypes)
            {
                    bus.Subscribe(type, (Action<Object>)(x => EventHandler(x)), this, Priority.High);
            }
        }
Пример #30
0
    /// <summary>
    /// 获取资源字符串。
    /// </summary>
    /// <param name="resource">给定的 <see cref="IResourceDictionary"/>。</param>
    /// <param name="key">指定的键。</param>
    /// <param name="containsKey">输出包含此键的布尔值。</param>
    /// <param name="args">给定的格式化参数列表。</param>
    /// <returns>返回字符串值。</returns>
    public static string GetString(this IResourceDictionary resource, string key, out bool containsKey, params object?[] args)
    {
        if (resource.TryGet(key, out var result))
        {
            containsKey = true;

            var format = result.ToString();
            if (string.IsNullOrEmpty(format))
            {
                return(string.Empty);
            }

            return(string.Format(format, args));
        }
        else
        {
            containsKey = false;
            return(string.Empty);
        }
    }
Пример #31
0
    /// <summary>
    /// 尝试获取资源字符串。
    /// </summary>
    /// <param name="resource">给定的 <see cref="IResourceDictionary"/>。</param>
    /// <param name="key">指定的键。</param>
    /// <param name="value">输出字符串值。</param>
    /// <param name="args">给定的格式化参数列表。</param>
    /// <returns>返回布尔值。</returns>
    public static bool TryGetString(this IResourceDictionary resource, string key, out string value, params object?[] args)
    {
        if (resource.TryGet(key, out var result))
        {
            var format = result.ToString();

            if (string.IsNullOrEmpty(format))
            {
                value = string.Empty;
            }
            else
            {
                value = string.Format(format, args);
            }

            return(true);
        }
        else
        {
            value = string.Empty;
            return(false);
        }
    }
Пример #32
0
            private void Flush()
            {
                if (LocalResources != null && LocalResources.Persistable)
                {
                    string ResourceSet = GetFullPagePath();

                    bool refreshLocalResource = false;

                    foreach (DictionaryEntry de in LocalResources)
                    {
                        AddResourceToStore((string)de.Key, de.Value, ResourceSet, _serviceProvider);
                        if (!_reader.Contains(de.Key))
                        {
                            _reader.Add(de.Key, de.Value);
                            refreshLocalResource = true;
                        }
                    }
                    if (refreshLocalResource && _localResources != null)
                    {
                        _localResources.Clear();
                        _localResources = null;
                    }
                }
            }
Пример #33
0
        internal static void SetSolidColorBrush(this IResourceDictionary sourceDictionary, string name, Color value)
        {
            if (sourceDictionary == null)
            {
                throw new ArgumentNullException(nameof(sourceDictionary));
            }
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            sourceDictionary[name + "Color"] = value;

            if (sourceDictionary.ContainsKey(name) && sourceDictionary[name] is SolidColorBrush brush)
            {
                if (brush.Color == value)
                {
                    return;
                }

                // TODO Color change animation.
                // var animation = new ColorAnimation {
                //     From = brush.Color,
                //     To = value,
                //     Duration = new Duration(TimeSpan.FromMilliseconds(300))
                // };
                // brush.BeginAnimation(SolidColorBrush.ColorProperty, animation);
                brush.Color = value;

                return;
            }

            var newBrush = new SolidColorBrush(value);

            sourceDictionary[name] = newBrush;
        }
Пример #34
0
 void IGameSetters.SetResourceDictionary(IResourceDictionary resourceDictionary)
 {
     throw new NotImplementedException();
 }
Пример #35
0
        public static void LoadTheme()
        {
            IResourceDictionary resDict = Application.Current.Resources;
            object?outVar;

            IsDarkMode = false;
            if (resDict.TryGetResource("IsDarkMode", out outVar))
            {
                if (outVar is bool b)
                {
                    IsDarkMode = b;
                }
            }
            if (resDict.TryGetResource("SystemControlForegroundBaseHighBrush", out outVar))
            {
                ForegroundBrush = (IBrush)outVar !;
            }
            if (resDict.TryGetResource("SystemControlBackgroundAltHighBrush", out outVar))
            {
                BackgroundBrush = (IBrush)outVar !;
            }
            if (resDict.TryGetResource("AccentBrush1", out outVar))
            {
                AccentBrush1         = (IBrush)outVar !;
                AccentPen1           = new Pen(AccentBrush1);
                AccentPen1Thickness2 = new Pen(AccentBrush1, 2);
                AccentPen1Thickness3 = new Pen(AccentBrush1, 3);
            }
            if (resDict.TryGetResource("AccentBrush1Semi", out outVar))
            {
                AccentBrush1Semi = (IBrush)outVar !;
            }
            if (resDict.TryGetResource("AccentBrush2", out outVar))
            {
                AccentBrush2         = (IBrush)outVar !;
                AccentPen2           = new Pen(AccentBrush2, 1);
                AccentPen2Thickness2 = new Pen(AccentBrush2, 2);
                AccentPen2Thickness3 = new Pen(AccentBrush2, 3);
            }
            if (resDict.TryGetResource("AccentBrush2Semi", out outVar))
            {
                AccentBrush2Semi = (IBrush)outVar !;
            }
            if (resDict.TryGetResource("AccentBrush3", out outVar))
            {
                AccentBrush3    = (IBrush)outVar !;
                AccentPen3      = new Pen(AccentBrush3, 1);
                AccentPen3Thick = new Pen(AccentBrush3, 3);
            }
            if (resDict.TryGetResource("AccentBrush3Semi", out outVar))
            {
                AccentBrush3Semi = (IBrush)outVar !;
            }
            if (resDict.TryGetResource("TickLineBrushLow", out outVar))
            {
                TickLineBrushLow = (IBrush)outVar !;
            }
            if (resDict.TryGetResource("BarNumberBrush", out outVar))
            {
                BarNumberBrush = (IBrush)outVar !;
                BarNumberPen   = new Pen(BarNumberBrush, 1);
            }
            if (resDict.TryGetResource("WhiteKeyBrush", out outVar))
            {
                WhiteKeyBrush = (IBrush)outVar !;
            }
            if (resDict.TryGetResource("WhiteKeyNameBrush", out outVar))
            {
                WhiteKeyNameBrush = (IBrush)outVar !;
            }
            if (resDict.TryGetResource("CenterKeyBrush", out outVar))
            {
                CenterKeyBrush = (IBrush)outVar !;
            }
            if (resDict.TryGetResource("CenterKeyNameBrush", out outVar))
            {
                CenterKeyNameBrush = (IBrush)outVar !;
            }
            if (resDict.TryGetResource("BlackKeyBrush", out outVar))
            {
                BlackKeyBrush = (IBrush)outVar !;
            }
            if (resDict.TryGetResource("BlackKeyNameBrush", out outVar))
            {
                BlackKeyNameBrush = (IBrush)outVar !;
            }
            if (!IsDarkMode)
            {
                ExpBrush           = WhiteKeyBrush;
                ExpNameBrush       = WhiteKeyNameBrush;
                ExpActiveBrush     = BlackKeyBrush;
                ExpActiveNameBrush = BlackKeyNameBrush;
                ExpShadowBrush     = CenterKeyBrush;
                ExpShadowNameBrush = CenterKeyNameBrush;
            }
            else
            {
                ExpBrush           = BlackKeyBrush;
                ExpNameBrush       = BlackKeyNameBrush;
                ExpActiveBrush     = WhiteKeyBrush;
                ExpActiveNameBrush = WhiteKeyNameBrush;
                ExpShadowBrush     = CenterKeyBrush;
                ExpShadowNameBrush = CenterKeyNameBrush;
            }
            TextLayoutCache.Clear();
            MessageBus.Current.SendMessage(new ThemeChangedEvent());
        }
Пример #36
0
 public DebugVisual(Actor actor, SpriteBatch spriteBatch, IResourceDictionary resourceDictionary)
     : base(resourceDictionary)
 {
     this._actor = actor;
     this._spriteBatch = spriteBatch;
 }
Пример #37
0
 public TerrainPhysics(TerrainActor actor, IResourceDictionary resourceDictionary)
     : base(resourceDictionary)
 {
     this._actor = actor;
     this._bodies = new List<Body>();
 }
Пример #38
0
 private void UpdateUpdateFontSizeLarge(IResourceDictionary resources, ThemeViewModel theme)
 {
     resources["FontSizeLarge"] = theme.FontSizeLarge;
 }
Пример #39
0
 private void UpdateThemeDisabledOpacity(IResourceDictionary resources, ThemeViewModel theme)
 {
     resources["ThemeDisabledOpacity"] = theme.ThemeDisabledOpacity;
 }
Пример #40
0
        public ParticleEffect CreateEffect(IResourceDictionary resourceDictionary)
        {
            var effect = new ParticleEffect
            {    
                            Emitters = new EmitterCollection
                                {            
                                     new BoxEmitter
                                        {
                                            Name = "SmallBubbles",
                                            Budget = 50,
                                            Height = 5f,
                                            Width = 100f,
                                            Depth = 0f,                                               
                                            Term = 1.0f,                                            
                                            ParticleTexture = (Texture2D)resourceDictionary.GetResource("Zazumo.Textures.Particles.SmallBubbles"),
                                            BlendMode = EmitterBlendMode.Alpha,
                                            ReleaseColour = new ColourRange { Red = 1.0f, Green = 1.0f, Blue = 1.0f },
                                            ReleaseOpacity = 1.0f,
                                            ReleaseQuantity = 3,
                                            ReleaseRotation = new RotationRange 
                                                                {
                                                                    Roll = new Range(0f, 1.5f)
                                                                },
                                            ReleaseScale = new Range(40f, 56f),
                                            ReleaseSpeed = new Range(0f, 25f),
                                            
                                            Modifiers = new ModifierCollection
                                                            {
                                                                new OpacityInterpolator2
                                                                    {
                                                                        InitialOpacity = 1.0f,
                                                                        FinalOpacity = 0.5f
                                                                    },
                                                                new LinearGravityModifier
                                                                {
                                                                    GravityVector = new Vector3(0f, -1f, 0f),
                                                                    Strength = 150f
                                                                },
                                                            },

                                        },                           

                                    new CircleEmitter 
                                        {
                                            Name = "Bubbles",
                                            Budget = 50,
                                            Term = 1.5f,
                                            Radiate = true,
                                            Radius = 50f,
                                            Shell = true,
                                            ParticleTexture = (Texture2D)resourceDictionary.GetResource("Zazumo.Textures.Particles.Bubble"),
                                            BlendMode = EmitterBlendMode.Alpha,
                                            ReleaseColour = new ColourRange { Blue = new Range(0.66f, 1.0f), Red = 57f, Green = new Range(0.24f, 0.64f) },
                                            ReleaseOpacity = 1.0f,
                                            ReleaseQuantity = 2,
                                            ReleaseRotation = new RotationRange 
                                                                {
                                                                    Roll = 0f
                                                                },
                                            ReleaseScale = new Range(24f, 40f),
                                            ReleaseSpeed = new Range(0f, 25f),
                                            
                                            Modifiers = new ModifierCollection
                                                            {
                                                                new OpacityInterpolator2
                                                                    {
                                                                         InitialOpacity = 1.0f,
                                                                        FinalOpacity = 0.5f
                                                                    },
                                                                new LinearGravityModifier
                                                                {
                                                                    GravityVector = new Vector3(0f, -1f, 0f),
                                                                    Strength = 150f
                                                                }
                                                            },

                                        },                             
      
                                       
                                },
            };

            effect.Emitters["Bubbles"].Controllers.AddFirst(new CooldownController { CooldownPeriod = 0.15f });
            effect.Emitters["SmallBubbles"].Controllers.AddFirst(new CooldownController { CooldownPeriod = 0.1f });

            foreach (var emitter in effect.Emitters)
            {
                emitter.Initialise();
                // emitter.Controllers.AddLast(new CooldownController { CooldownPeriod = 0.5f });
            }

            return effect;
        }
Пример #41
0
 public VolumePhysics(Actor actor, IResourceDictionary resourceDictionary)
     : base(resourceDictionary)
 {
     this._actor = actor;
 }
Пример #42
0
 public CharacterPhysics(Actor actor, IResourceDictionary resourceDictionary)
     : base(resourceDictionary)
 {
     this._actor = actor;
 }
Пример #43
0
 public PhysicsBase(IResourceDictionary resourceDictionary)
 {
     this.ResourceDictionary = resourceDictionary;
 }
Пример #44
0
 public ZazumoPhysics(ZazumoActor actor, IResourceDictionary resourceDictionary)
     : base(resourceDictionary)
 {
     this._actor = actor;
 }
Пример #45
0
 public UIPanelVisual(UIPanelActor actor, SpriteBatch spriteBatch, IResourceDictionary resourceDictionary)
     : base(actor, spriteBatch, resourceDictionary)
 {
     this._currentAnimations = new List<Animation>();
 }
Пример #46
0
 public UIToolButtonVisual(UIToolButtonActor actor, SpriteBatch spriteBatch, IResourceDictionary resourceDictionary)
     : base(actor, spriteBatch, resourceDictionary)
 {
 }
            private void Flush()
            {
                if (LocalResources != null && LocalResources.Persistable)
                {
                    string ResourceSet = GetFullPagePath();

                    bool refreshLocalResource = false;

                    foreach (DictionaryEntry de in LocalResources)
                    {
                        AddResourceToStore((string)de.Key, de.Value, ResourceSet, _serviceProvider);
                        if (!_reader.Contains(de.Key))
                        {
                            _reader.Add(de.Key, de.Value);
                            refreshLocalResource = true;
                        }
                    }
                    if (refreshLocalResource && _localResources != null)
                    {
                        _localResources.Clear();
                        _localResources = null;
                    }
                }
            }
        public ParticleEffect CreateEffect(IResourceDictionary resourceDictionary)
        {
            var effect = new ParticleEffect
            {
                Emitters = new EmitterCollection
                                {            
                                     new PointEmitter
                                        {
                                            Budget = 15,
                                            Term = 0.75f,                                            
                                            ParticleTexture = (Texture2D)resourceDictionary.GetResource("Zazumo.Textures.Particles.Star"),
                                            BlendMode = EmitterBlendMode.Alpha,
                                            ReleaseColour = new ColourRange { Red = 1.0f, Green = 0.88f, Blue = 0.75f },
                                            ReleaseOpacity = 1.0f,
                                            ReleaseQuantity = 1,
                                            ReleaseRotation = new RotationRange 
                                                                {
                                                                    Roll = new Range(0f, 0f)
                                                                },
                                            ReleaseScale = new Range(24f, 72f),
                                            ReleaseSpeed = new Range(32f, 160f),
                                            
                                            Modifiers = new ModifierCollection
                                                            {
                                                                new ScaleInterpolator3
                                                                {
                                                                      FinalScale = 16f,
                                                                      InitialScale = 48f,
                                                                      Median = 0.4f,
                                                                      MedianScale = 64f
                                                                },

                                                                new OpacityInterpolator2
                                                                {
                                                                     FinalOpacity = 0f,
                                                                     InitialOpacity = 1f
                                                                },

                                                                new ColourInterpolator2
                                                                {
                                                                    InitialColour = new Vector3(1f, 0.5f, 1f),
                                                                    FinalColour = new Vector3(1f, 0.5f, 0f)
                                                                },

                                                                new DampingModifier
                                                                {
                                                                     DampingCoefficient = 5f
                                                                }
                                                            },
                                        },                           

                                        new PointEmitter
                                        {
                                            Budget = 100,
                                            Term = 1.0f,                                            
                                            ParticleTexture = (Texture2D)resourceDictionary.GetResource("Zazumo.Textures.Particles.Star"),
                                            BlendMode = EmitterBlendMode.Alpha,
                                            ReleaseColour = new ColourRange { Red = 1.0f, Green = 1f, Blue = 1f },
                                            ReleaseOpacity = 1.0f,
                                            ReleaseQuantity = 5,
                                            ReleaseRotation = new RotationRange 
                                                                {
                                                                    Roll = new Range(0f, 0f)
                                                                },
                                            ReleaseScale = new Range(16f, 16f),
                                            ReleaseSpeed = new Range(0f, 48f),
                                            
                                            Modifiers = new ModifierCollection
                                                            {
                                                                new OpacityInterpolator2
                                                                {
                                                                     FinalOpacity = 0f,
                                                                     InitialOpacity = 1f
                                                                },

                                                                new ColourInterpolator2
                                                                {
                                                                    InitialColour = new Vector3(1f, 0.5f, 1f),
                                                                    FinalColour = new Vector3(0.75f, 0.25f, 0f)
                                                                },

                                                            },
                                        },                           
                                },
            };

            foreach (var emitter in effect.Emitters)
            {
                emitter.Initialise();
            }

            return effect;
        }
Пример #49
0
        protected override void RegisterVisuals(IActorVisualFactory actorVisualFactory, IResourceDictionary resourceDictionary, SpriteBatch spriteBatch)
        {
            base.RegisterVisuals(actorVisualFactory, resourceDictionary, spriteBatch);

            actorVisualFactory.RegisterVisualFactory<WormActor>(x => new NullVisual(x));
            actorVisualFactory.RegisterVisualFactory<EyeFlockActor>(x => new NullVisual(x));
            actorVisualFactory.RegisterVisualFactory<BoulderFlockActor>(x => new NullVisual(x));
            actorVisualFactory.RegisterVisualFactory<WormFlockActor>(x => new NullVisual(x));
            actorVisualFactory.RegisterVisualFactory<TriangleFlockActor>(x => new NullVisual(x));
            actorVisualFactory.RegisterVisualFactory<ArrowFlockActor>(x => new NullVisual(x));
            actorVisualFactory.RegisterVisualFactory<CircleFlockActor>(x => new NullVisual(x));
            actorVisualFactory.RegisterVisualFactory<DiamondFlockActor>(x => new NullVisual(x));
            actorVisualFactory.RegisterVisualFactory<SquareFlockActor>(x => new NullVisual(x));
            actorVisualFactory.RegisterVisualFactory<SquiggleFlockActor>(x => new NullVisual(x));
            actorVisualFactory.RegisterVisualFactory<AmmoMeter>(x => new AmmoMeterVisual(x, spriteBatch, resourceDictionary));
        }           
Пример #50
0
 private void UpdateFontSizeNormal(IResourceDictionary resources, ThemeViewModel theme)
 {
     resources["FontSizeNormal"] = theme.FontSizeNormal;
 }
Пример #51
0
        protected override void RegisterPhysics(IActorPhysicsFactory physicsFactory, IResourceDictionary resourceDictionary)
        {
            base.RegisterPhysics(physicsFactory, resourceDictionary);

            physicsFactory.RegisterPhysicsFactory<ZazumoActor>(x => new ZazumoPhysics(x, resourceDictionary));
            physicsFactory.RegisterPhysicsFactory<TriangleEnemy>(x => new CharacterPhysics(x, resourceDictionary));
            physicsFactory.RegisterPhysicsFactory<EnemyActor>(x => new StaticPhysics(x, resourceDictionary));
            physicsFactory.RegisterPhysicsFactory<FrogActor>(x => new StaticPhysics(x, resourceDictionary));
            physicsFactory.RegisterPhysicsFactory<PowerUpActor>(x => new StaticPhysics(x, resourceDictionary));
            physicsFactory.RegisterPhysicsFactory<ProjectileActor>(x => new ProjectilePhysics(x, resourceDictionary));
            physicsFactory.RegisterPhysicsFactory<WormholeActor>(x => new StarGatePhysics(x, resourceDictionary));
        }
Пример #52
0
 private void UpdateUpdateScrollBarThickness(IResourceDictionary resources, ThemeViewModel theme)
 {
     resources["ScrollBarThickness"] = theme.ScrollBarThickness;
 }
Пример #53
0
 public PlaceablePhysics(Actor actor, IResourceDictionary resourceDictionary)
     : base (resourceDictionary)
 {
     this._actor = actor;
 }
Пример #54
0
        protected override void LoadResources(IResourceDictionary resources)
        {
            base.LoadResources(resources);

            #region Physics
            // Physics
            Dictionary<String, Object> physics = new Dictionary<String, Object>();
            physics.Add("TileCollisionHull", new Vector2[] 
            { 
                new Vector2(0f, 0f), 
                new Vector2(1f, 0f), 
                new Vector2(1f, 1f), 
                new Vector2(0f, 1f) 
            });

            physics.Add("UnitCollisionHull", new Vector2[] 
            { 
                new Vector2(0f, 0f), 
                new Vector2(1f, 0f), 
                new Vector2(1f, 1f), 
                new Vector2(0f, 1f) 
            });

            physics.Add("WormSegmentCollisionHull", new Vector2[] 
            { 
                new Vector2(0f, 0f), 
                new Vector2(0.5f, 0f), 
                new Vector2(0.5f, 0.5f), 
                new Vector2(0f, 0.5f) 
            });

            physics.Add("ZazumoNormalHull", new Vector2[] 
            { 
                new Vector2(0.35f, 0.35f), 
                new Vector2(0.65f, 0.35f), 
                new Vector2(0.65f, 0.65f), 
                new Vector2(0.35f, 0.65f) 
            });


            physics.Add("WormholeCollisionHull", new Vector2[] 
            { 
                new Vector2(0f, 0f), 
                new Vector2(0.5f, 0f), 
                new Vector2(0.5f, 0.5f), 
                new Vector2(0f, 0.5f) 
            });
            #endregion

            #region GameData
            // Game data
            Dictionary<String, Object> gameData = new Dictionary<String, Object>();
            gameData.Add("ZazumoData", new ZazumoArchetypeData 
            { 
                Height = 0.75f, 
                Width = 0.465f, 
                Damping = 2.5f,
                Speed = 40.0f,
                BulletSpeed = 5.0f,
                SpriteKey = "Zazumo.Sprites.Zazumo" 
            });                       

            #region Shape Enemies
            gameData.Add("TriangleData", new CharacterArchetypeData
            {
                Height = 0.333f,
                Width = 0.5f,
                SpriteKey = "Zazumo.Sprites.TriangleShape",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });

            gameData.Add("SquareData", new CharacterArchetypeData
            {
                Height = 0.5f,
                Width = 0.5f,
                SpriteKey = "Zazumo.Sprites.SquareShape",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });


            gameData.Add("SquiggleData", new CharacterArchetypeData
            {
                Height = 0.5f,
                Width = 0.5f,
                SpriteKey = "Zazumo.Sprites.SquiggleShape",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });

            gameData.Add("ArrowData", new CharacterArchetypeData
            {
                Height = 0.6f,
                Width = 0.8f,
                SpriteKey = "Zazumo.Sprites.ArrowShape",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });

            gameData.Add("CircleData", new CharacterArchetypeData
            {
                Height = 0.5f,
                Width = 0.5f,
                SpriteKey = "Zazumo.Sprites.CircleShape",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });

            gameData.Add("DiamondData", new CharacterArchetypeData
            {
                Height = 0.333f,
                Width = 0.666f,
                SpriteKey = "Zazumo.Sprites.DiamondShape",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });
            #endregion

            #region Mini Bosses
            gameData.Add("WormHeadData", new CharacterArchetypeData
            {
                Height = 0.65f,
                Width = 0.65f,
                SpriteKey = "Zazumo.Sprites.Wormhead",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });

            gameData.Add("WormSegmentData", new CharacterArchetypeData
            {
                Height = 0.5f,
                Width = 0.5f,
                SpriteKey = "Zazumo.Sprites.WormSegment",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });

            gameData.Add("EyeData", new CharacterArchetypeData
            {
                Height = 0.5f,
                Width = 1.2f,
                SpriteKey = "Zazumo.Sprites.Eye",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });

            gameData.Add("BoulderData", new CharacterArchetypeData
            {
                Height = 1.5f,
                Width = 1.0f,
                SpriteKey = "Zazumo.Sprites.Boulder",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });

            gameData.Add("SquidData", new CharacterArchetypeData
            {
                Height = 1.75f,
                Width = 1.0f,
                SpriteKey = "Zazumo.Sprites.Squid1",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });

            gameData.Add("SquidArmData", new CharacterArchetypeData
            {
                Height = 0.3f,
                Width = 0.3f,
                SpriteKey = "Zazumo.Sprites.SquidBall",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });

            #endregion

            #region Power Ups
            gameData.Add("ClamData", new ClamData
            {
                Height = 1.0f,
                Width = 1.0f,
                SpriteKey = "Zazumo.Sprites.Clam1",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1,
                Shape = ZazumoShape.Star,
                HitPoints = 10
            });

            gameData.Add("StarPowerUpData", new PowerUpData
            {
                Height = 1.0f,
                Width = 1.0f,
                SpriteKey = "Zazumo.Sprites.StarPickup",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1,
                Shape = ZazumoShape.Star
            });

            gameData.Add("PurpleFrogData", new FrogData
            {
                Height = 1.4f,
                Width = 1.0f,
                FrogEffect = Resources.FrogEffect.Shrink,
                SpriteKey = "Zazumo.Sprites.PurpleFrog",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });

            gameData.Add("YellowFrogData", new FrogData
            {
                Height = 1.4f,
                Width = 1.0f,
                FrogEffect = Resources.FrogEffect.Ammo,
                SpriteKey = "Zazumo.Sprites.AmmoFrog1",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });

            gameData.Add("GreenFrogData", new FrogData
            {
                Height = 1.4f,
                Width = 1.0f,
                FrogEffect = Resources.FrogEffect.Grow,
                SpriteKey = "Zazumo.Sprites.GreenFrog",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });

            gameData.Add("BlueFrogData", new FrogData
            {
                Height = 1.4f,
                Width = 1.0f,
                FrogEffect = Resources.FrogEffect.Bomb,
                SpriteKey = "Zazumo.Sprites.BlueFrog1",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });

            gameData.Add("BlackFrogData", new FrogData
            {
                Height = 1.4f,
                Width = 1.0f,
                FrogEffect = Resources.FrogEffect.Points,
                SpriteKey = "Zazumo.Sprites.BlackFrog1",
                CollisionHullKey = "TileCollisionHull",
                CollisionGroup = 1
            });


            #endregion

            #region Wormholes
            gameData.Add("StarWormhole", new WormholeData
            {
                Height = 1f,
                Width = 1f,
                SpriteKey = "Zazumo.Sprites.StarWormhole",
                CollisionGroup = 1,
                CollisionHullKey = "WormholeCollisionHull"
            });

            gameData.Add("SwirlWormhole", new WormholeData
            {
                Height = 1f,
                Width = 1f,
                SpriteKey = "Zazumo.Sprites.SwirlWormhole",
                CollisionGroup = 1,
                CollisionHullKey = "WormholeCollisionHull"
            });
            #endregion

            gameData.Add("Bullet", new ProjectileData
            {
                Height = 0.325f,
                Width = 0.325f,
                Speed = 1.0f,
                CollisionGroup = 2,
                SpriteKey = "Zazumo.Sprites.Bullet"
            });

            gameData.Add("StarBullet", new ProjectileData
            {
                Height = 0.3f,
                Width = 0.3f,
                Speed = 2.0f,
                CollisionGroup = 2,
                SpriteKey = "Zazumo.Sprites.StarBullet"
            });

            gameData.Add("EyeBullet", new ProjectileData
            {
                Height = 0.15f,
                Width = 0.15f,
                Speed = 2.0f,
                CollisionGroup = 1,
                SpriteKey = "Zazumo.Sprites.EyeBullet"
            });

            gameData.Add("HorizontalWall", new VolumeWorldObject
            {
                Width = GraphicsDevice.PresentationParameters.BackBufferWidth / Phat.Settings.MetersToPixels,
                Height = 0.01f
            });

            gameData.Add("VerticalWall", new VolumeWorldObject
            {
                Height = GraphicsDevice.PresentationParameters.BackBufferHeight / Phat.Settings.MetersToPixels,
                Width = 0.01f
            });
            #endregion

            #region Paths
            gameData.Add("WormPath1", new Vector2[]
            {
                new Vector2(-1.5f,0.5f),
                new Vector2(0.0f, 1.0f),
                new Vector2(4.5f, 1.5f),
                new Vector2(6.5f, 2.5f),
                new Vector2(4.5f, 3.5f),
                new Vector2(2.5f, 2.5f),
                /*new Vector2(4.5f, 1.5f),
                new Vector2(6.5f, 2.5f),                */
            });

            gameData.Add("EyePath1", new Vector2[]
            {
                new Vector2(4.5f, 2.5f),
                new Vector2(7f, 0.5f),
                new Vector2(8.5f, 2.5f),
                new Vector2(7f, 4.5f),
                new Vector2(4.5f, 2.5f),
                new Vector2(3f, 0.5f),
                new Vector2(0.5f, 2.5f),
                new Vector2(3f, 4.5f)                
            });

            gameData.Add("EyePath2", new Vector2[]
            {
                new Vector2(4.5f, 2.5f),
                new Vector2(3f, 0.5f),
                new Vector2(0.5f, 2.5f),
                new Vector2(3f, 4.5f),
                new Vector2(4.5f, 2.5f),
                new Vector2(7f, 0.5f),
                new Vector2(8.5f, 2.5f),
                new Vector2(7f, 4.5f),

            });

            gameData.Add("EyePath3", new Vector2[]
            {
                new Vector2(4.5f, 2.5f),
                new Vector2(7f, 4.5f),                
                new Vector2(8.5f, 2.5f),
                new Vector2(7f, 0.5f),
                new Vector2(4.5f, 2.5f),
                new Vector2(3f, 4.5f),
                new Vector2(0.5f, 2.5f),
                new Vector2(3f, 0.5f),                               
            });

            gameData.Add("EyePath4", new Vector2[]
            {
                new Vector2(4.5f, 2.5f),
                new Vector2(3f, 4.5f),
                new Vector2(0.5f, 2.5f),
                new Vector2(3f, 0.5f),                
                new Vector2(4.5f, 2.5f),
                new Vector2(7f, 4.5f),
                new Vector2(8.5f, 2.5f),
                new Vector2(7f, 0.5f),
            });
            #endregion            


            #region LevelSpawnData
            gameData.Add("Level1NormalSpawnData", new LevelSpawnData[]
            {
                new LevelSpawnData { SpawnType = SpawnType.Triangle, Data = new TriangleShapeData { StartPosition = StartPosition.Left } },
                new LevelSpawnData { SpawnType = SpawnType.Triangle, Data = new TriangleShapeData { StartPosition = StartPosition.Left } },
                new LevelSpawnData { SpawnType = SpawnType.Triangle, Data = new TriangleShapeData { StartPosition = StartPosition.Right } },
                new LevelSpawnData { SpawnType = SpawnType.Triangle, Data = new TriangleShapeData { StartPosition = StartPosition.Right } },
                new LevelSpawnData { SpawnType = SpawnType.Square, Data = new SquareShapeData { StartPosition = StartPosition.Top } },
                new LevelSpawnData { SpawnType = SpawnType.Square, Data = new SquareShapeData { StartPosition = StartPosition.Top } },
                new LevelSpawnData { SpawnType = SpawnType.Square, Data = new SquareShapeData { StartPosition = StartPosition.Bottom } },
                new LevelSpawnData { SpawnType = SpawnType.Square, Data = new SquareShapeData { StartPosition = StartPosition.Bottom } },
                new LevelSpawnData { SpawnType = SpawnType.Squiggle, Data = new SquiggleShapeData { StartPosition = StartPosition.Left } },
                new LevelSpawnData { SpawnType = SpawnType.Squiggle, Data = new SquiggleShapeData { StartPosition = StartPosition.Left } },
                new LevelSpawnData { SpawnType = SpawnType.Squiggle, Data = new SquiggleShapeData { StartPosition = StartPosition.Right } },
                new LevelSpawnData { SpawnType = SpawnType.Squiggle, Data = new SquiggleShapeData { StartPosition = StartPosition.Right } },
                new LevelSpawnData { SpawnType = SpawnType.Arrow, Data = new ArrowShapeData { } },
                new LevelSpawnData { SpawnType = SpawnType.Arrow, Data = new ArrowShapeData { } },
                new LevelSpawnData { SpawnType = SpawnType.Arrow, Data = new ArrowShapeData { } },
                new LevelSpawnData { SpawnType = SpawnType.Arrow, Data = new ArrowShapeData { } },
                new LevelSpawnData { SpawnType = SpawnType.Circle, Data = new CircleShapeData { StartPosition = StartPosition.TopLeft } },
                new LevelSpawnData { SpawnType = SpawnType.Circle, Data = new CircleShapeData { StartPosition = StartPosition.TopRight } },
                new LevelSpawnData { SpawnType = SpawnType.Circle, Data = new CircleShapeData { StartPosition = StartPosition.BottomLeft } },
                new LevelSpawnData { SpawnType = SpawnType.Circle, Data = new CircleShapeData { StartPosition = StartPosition.BottomRight } },
                new LevelSpawnData { SpawnType = SpawnType.Diamond, Data = new DiamondShapeData { } },
                new LevelSpawnData { SpawnType = SpawnType.Diamond, Data = new DiamondShapeData { } },
                new LevelSpawnData { SpawnType = SpawnType.Diamond, Data = new DiamondShapeData { } },
                new LevelSpawnData { SpawnType = SpawnType.Diamond, Data = new DiamondShapeData { } },
            });
            #endregion

            // Fonts
            var fontDictionary = new Dictionary<String, Object>();
            fontDictionary.Add("SmallPointsFont", Content.Load<SpriteFont>("Fonts/SmallPoints"));
            fontDictionary.Add("BigPointsFont", Content.Load<SpriteFont>("Fonts/BigPoints"));
            fontDictionary.Add("ScoreFont", Content.Load<SpriteFont>("Fonts/Score"));
            fontDictionary.Add("MainFont", Content.Load<SpriteFont>("Fonts/MainFont"));
            

            resources.MergeResources("Fonts", fontDictionary);
            resources.MergeResources("GameData", gameData);
            resources.MergeResources("Physics", physics);
        }
Пример #55
0
 public AmmoMeterVisual(Actor actor, SpriteBatch spriteBatch, IResourceDictionary resourceDictionary)
     : base(actor, spriteBatch, resourceDictionary)
 {
     
 }
Пример #56
0
 public UICarouselVisual(UICarousel actor, SpriteBatch spriteBatch, IResourceDictionary resourceDictionary)
     : base(actor, spriteBatch, resourceDictionary)
 {
     this._actor = actor;
     this._spriteBatch = spriteBatch;
 }
Пример #57
0
 public TerrainVisual(TerrainActor actor, SpriteBatch terrainSpriteBatch, IResourceDictionary resourceDictionary)
     : base(resourceDictionary)
 {
     this._actor = actor;
     this._terrainSpriteBatch = terrainSpriteBatch;
 }