public void LoadLayers()
        {
            Overlays.Clear();
            var previewResolution = 75;

            var layers = LayerHelper.GetLayers().ToList();

            //Ensure that the empty layer is the first option in the list.
            var emptyLayer = layers.FirstOrDefault(i => i.Type == Layer.LayerType.Overlay && i.Name == "None");

            if (emptyLayer != null)
            {
                Overlays.Add(new OverlayInfo
                {
                    Image = BitmapHelper.ConvertBitmapToImageSource(ImageLoader.LoadBitmapFromFile(emptyLayer.File, previewResolution, 5)),
                    Info  = emptyLayer
                });
            }

            foreach (var layer in layers.Where(i => i.Type == Layer.LayerType.Overlay && i != emptyLayer))
            {
                Overlays.Add(new OverlayInfo
                {
                    Image = BitmapHelper.ConvertBitmapToImageSource(ImageLoader.LoadBitmapFromFile(layer.File, previewResolution, previewResolution)),
                    Info  = layer
                });
            }
        }
 public NetworkViewModel()
 {
     if (!Overlays.Contains(_overlay))
     {
         Overlays.Add(_overlay);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Adds the given overlay to the list of <see cref="IClickableMenu"/>'s that should receive emulated events
 /// </summary>
 /// <param name="overlay">The <see cref="IClickableMenu"/> to add</param>
 public static void Add(IClickableMenu overlay)
 {
     Overlays.Add(overlay);
     if (Overlays.Count == 1)
     {
         Init();
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Gets called when the control gets loaded
 /// Sets up an initial state
 /// </summary>
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     MapProvider = GMapProviders.GoogleMap;
     Position    = _centerOfTheMap;
     Overlays.Add(_polygons);
     Overlays.Add(_polygonRects);
     Overlays.Add(_topLayer);
 }
        public NetworkViewModel(IList <Reach> reaches, int wkid, bool showNodes = false)
        {
            _wkid = wkid;

            if (!Overlays.Contains(_overlay))
            {
                Overlays.Add(_overlay);
            }
            CallLater(() => AddNetworkToMap(reaches, wkid, showNodes));
        }
Exemplo n.º 6
0
        public bool Update()
        {
            IsInitializing = true;
            _logger.Info("Updating vMix state.");
            var _temp = Create();

            if (_temp == null)
            {
                _logger.Info("vMix is offline");
                _logger.Info("Firing \"updated\" event.");

                if (OnStateUpdated != null)
                {
                    OnStateUpdated(this, new StateUpdatedEventArgs()
                    {
                        Successfully = false
                    });
                }
                IsInitializing = false;
                return(false);
            }

            _logger.Info("Calculating difference.");
            Diff(this, _temp);

            _logger.Info("Updating inputs.");

            Inputs.Clear();
            foreach (var item in _temp.Inputs)
            {
                Inputs.Add(item);
            }
            Overlays.Clear();
            foreach (var item in _temp.Overlays)
            {
                Overlays.Add(item);
            }


            UpdateChangedInputs(_currentStateText, _temp._currentStateText);
            if (_currentStateText != _temp._currentStateText)
            {
                _currentStateText = _temp._currentStateText;
            }

            _logger.Info("Firing \"updated\" event.");

            OnStateUpdated?.Invoke(this, new StateUpdatedEventArgs()
            {
                Successfully = true, OldInputs = null, NewInputs = null
            });
            IsInitializing = false;
            return(true);
        }
Exemplo n.º 7
0
        private void AddPolyline(Polyline polyline)
        {
            if (Overlays.ContainsKey(polyline))
            {
                return;
            }
            MKPolyline naitivePolyline = MKPolyline.FromCoordinates(polyline.Points.Select(p => new CLLocationCoordinate2D(p.Latitude, p.Longitude)).ToArray());

            Overlays.Add(polyline, naitivePolyline);
            Control.InsertOverlay(naitivePolyline, (nuint)polyline.ZIndex, MKOverlayLevel.AboveLabels);
        }
        public UserMapControl()
        {
            InitializeComponent();

            makerOverlay = new GMapOverlay("makerOverlay");
            Overlays.Add(makerOverlay);

            MouseClick += MapControl_MouseClick;
            MouseMove  += MapControl_MouseMove;
            MouseDown  += MapControl_MouseDown;
            MouseUp    += MapControl_MouseUp;
        }
 public MapViewModel()
 {
     Overlays.Add(new GraphicsOverlay()
     {
         Renderer = new SimpleRenderer(new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Colors.CornflowerBlue, 5))
     });
     Overlays[0].SceneProperties.SurfacePlacement = SurfacePlacement.Relative;
     Overlays.Add(new GraphicsOverlay()
     {
         Renderer = new SimpleRenderer(new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Colors.Red, 15))
     });
     Overlays[1].SceneProperties.SurfacePlacement = SurfacePlacement.Relative;
 }
Exemplo n.º 10
0
        public void Update(BoardService boards, OpPost post)
        {
            Post = post; // editing a post will build a new header, create a new object

            Text = boards.GetPostTitle(post);

            if (post.Header.ParentID == 0 && post.Replies > 0)
            {
                Text += " (" + post.Replies.ToString() + ")";
            }

            SubItems[0].Text = boards.Core.GetName(post.Header.SourceID);
            SubItems[1].Text = Utilities.FormatTime(post.Header.Time);


            /*
             * 0 - PostView.OverlayImages.Add(PostImages.higher);
             * 1 - PostView.OverlayImages.Add(PostImages.lower);
             * 2 - PostView.OverlayImages.Add(PostImages.high_scope);
             * 3 - PostView.OverlayImages.Add(PostImages.low_scope);*/


            ImageIndex = 0;

            if (Position == ScopeType.High)
            {
                ImageIndex = 1;
            }

            if (Position == ScopeType.Low)
            {
                ImageIndex = 2;
            }


            if (Overlays == null)
            {
                Overlays = new List <int>();
            }

            if (Scope == ScopeType.High)
            {
                Overlays.Add(0);
            }

            if (Scope == ScopeType.Low)
            {
                Overlays.Add(1);
            }
        }
Exemplo n.º 11
0
        internal IconLibrary(XElement eltLibrary)
        {
            Name = eltLibrary.Attribute("name")?.Value;

            foreach (XElement eltOverlay in eltLibrary.Elements(MainModel.NSIconMaker + "Overlay"))
            {
                Overlays.Add(new IconOverlay(eltOverlay));
                ProgressDialog.ProgressDialog.Current.Report(value: double.PositiveInfinity);
            }

            foreach (XElement eltCategory in eltLibrary.Elements(MainModel.NSIconMaker + "Category"))
            {
                Categories.Add(new Category(eltCategory, this));
            }
        }
Exemplo n.º 12
0
        private void AddPolyline(object o)
        {
            if (_allPolylines.Last == null)
            {
                return;
            }

            var polyline = _allPolylines.Last.Value;

            _allPolylines.RemoveLast();

            Overlays.Add(polyline);

            _removePolylineCommand.ChangeCanExecute();
            _addPolylineCommand.ChangeCanExecute();
        }
Exemplo n.º 13
0
        public NavigationalMapControl()
            : base()
        {
            InitializeMapBasics();

            InitializeEvents();

            InitializeZoomButtons();

            SetMapTypeFromConfiguration();
            SetMapLanguageFromConfiguration();

            _trackOverlay = new GMap.NET.WindowsForms.GMapOverlay(this, "tracks");
            Overlays.Add(_trackOverlay);

            base.RasterBaseFolder = @"C:\AmudAnan\Tiles";
        }
Exemplo n.º 14
0
        internal void OnControlAdded(Control control)
        {
            if (control is Overlay overlay)
            {
                Overlays.Clear();
                Action <ControlCollection> traverse = null;
                traverse = (collection) =>
                {
                    foreach (var item in collection)
                    {
                        if (item is Overlay selected)
                        {
                            Overlays.Add(selected);
                        }
                        traverse(item.Children);
                    }
                };

                traverse(Controls);
            }
        }
Exemplo n.º 15
0
        public void RegisterComponent(IComponent component)
        {
            if (!Components.TryAdd(component.ComponentName, component))
            {
                // TODO: what should I do in this case?
                //Console.WriteLine($"Unable to register component '{component.ComponentName}' in page '{GetType().Name}'");
            }

            if (component is IHtmlAlert)
            {
                Alerts.Add(component as IHtmlAlert);
            }
            else if (component is IOverlay)
            {
                Overlays.Add(component as IOverlay);
            }
            else if (component is IProgressBar)
            {
                ProgressBars.Add(component as IProgressBar);
            }
        }
Exemplo n.º 16
0
        private async void LoadService(string uri)
        {
            StreamInfo = "Initializing stream...";
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(StreamInfo)));
            var client = await StreamServiceClient.CreateAsync(new Uri(uri));

            client.FeatureTimeout = TimeSpan.FromMinutes(5); // Removes any features that hasn't reported back in over 5 minutes
            client.OnUpdate      += Client_OnUpdate;

            // Create overlay for rendering updates
            var si = typeof(LocationDisplay).Assembly.GetManifestResourceStream("Esri.ArcGISRuntime.Esri.ArcGISRuntime.LocationDisplayCourse.scale-200.png");
            var ri = await RuntimeImage.FromStreamAsync(si);

            PictureMarkerSymbol vehicleSymbol = new PictureMarkerSymbol(ri)
            {
                Width = 25, Height = 25
            };
            var overlay = new Esri.ArcGISRuntime.UI.GraphicsOverlay()
            {
                Renderer        = new SimpleRenderer(vehicleSymbol),
                SceneProperties = new LayerSceneProperties(SurfacePlacement.Absolute) //In case we use it in 3D and have Z values
            };
            var headingField = client.ServiceInfo.Fields.Where(f => f.Name.ToLower() == "heading").Select(f => f.Name).FirstOrDefault();

            if (!string.IsNullOrEmpty(headingField))
            {
                overlay.Renderer.RotationExpression = $"[{headingField}]";
                overlay.Renderer.SceneProperties.HeadingExpression = $"[{headingField}]";
            }
            Overlays.Add(overlay);
            client.Overlay = overlay;

            // Connect
            await client.ConnectAsync();

            StreamInfo = "Connected";
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(StreamInfo)));
        }
Exemplo n.º 17
0
        public DrawableKaraokeRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList <Mod> mods)
            : base(ruleset, beatmap, mods)
        {
            positionCalculator = new PositionCalculator(9);

            // TODO : it should be moved into NotePlayfield
            BarLines = new BarLineGenerator <BarLine>(Beatmap).BarLines;

            // Editor should not generate hud overlay
            if (mods == null)
            {
                return;
            }

            // create overlay
            var overlay = new KaraokeHUDOverlay(this);

            foreach (var mod in mods.OfType <IApplicableToKaraokeHUD>())
            {
                mod.ApplyToKaraokeHUD(overlay);
            }

            Overlays.Add(overlay);
        }
Exemplo n.º 18
0
        public bool Update()
        {
            try
            {
                IsInitializing = true;
                _logger.Debug("Updating vMix state.");
                var _temp = Create();

                if (_temp == null)
                {
                    _logger.Debug("vMix is offline");
                    _logger.Debug("Firing \"updated\" event.");

                    OnStateSynced?.Invoke(this, new StateSyncedEventArgs()
                    {
                        Successfully = false
                    });
                    IsInitializing = false;
                    return(false);
                }

                _logger.Debug("Calculating difference.");
                Diff(this, _temp);

                _logger.Debug("Updating inputs.");

                Inputs.Clear();
                foreach (var item in _temp.Inputs)
                {
                    Inputs.Add(item);
                }
                Overlays.Clear();
                foreach (var item in _temp.Overlays)
                {
                    Overlays.Add(item);
                }
                Audio.Clear();
                foreach (var item in _temp.Audio)
                {
                    Audio.Add(item);
                }
                Transitions.Clear();
                foreach (var item in _temp.Transitions)
                {
                    Transitions.Add(item);
                }
                Mixes.Clear();
                foreach (var item in _temp.Mixes)
                {
                    Mixes.Add(item);
                }

                //UpdateChangedInputs(_currentStateText, _temp._currentStateText);
                if (_currentStateText != _temp._currentStateText)
                {
                    _currentStateText = _temp._currentStateText;
                }

                _logger.Debug("Firing \"updated\" event.");

                OnStateSynced?.Invoke(this, new StateSyncedEventArgs()
                {
                    Successfully = true, OldInputs = null, NewInputs = null
                });
                IsInitializing = false;
                return(true);
            }
            catch (Exception e)
            {
                IsInitializing = false;
                _logger.Error(e, "Exception at Update");
                return(false);
            }
        }
Exemplo n.º 19
0
        public long Update(BinaryReader packet, Duel duel)
        {
            long pos = packet.BaseStream.Position;

            while (true)
            {
                int size = packet.ReadInt16();
                if (size == 0)
                {
                    return(packet.BaseStream.Position - pos);
                }
                uint flag = packet.ReadUInt32();
                switch (flag)
                {
                case (uint)Query.Code:
                {
                    SetId(packet.ReadInt32());
                    break;
                }

                case (uint)Query.Position:
                {
                    Position = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Alias:
                {
                    Alias = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Type:
                {
                    Type = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Level:
                {
                    Level = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Rank:
                {
                    Rank = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Attribute:
                {
                    Attribute = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Race:
                {
                    Race = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Attack:
                {
                    Attack = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Defence:
                {
                    Defense = packet.ReadInt32();
                    break;
                }

                case (uint)Query.BaseAttack:
                {
                    BaseAttack = packet.ReadInt32();
                    break;
                }

                case (uint)Query.BaseDefence:
                {
                    BaseDefense = packet.ReadInt32();
                    break;
                }

                case (uint)Query.OverlayCard:
                {
                    Overlays.Clear();
                    int count = packet.ReadInt32();
                    for (int i = 0; i < count; ++i)
                    {
                        Overlays.Add(packet.ReadInt32());
                    }
                }
                break;

                case (uint)Query.Owner:
                {
                    Owner = duel.GetLocalPlayer(packet.ReadByte());
                    break;
                }

                case (uint)Query.Status:
                {
                    int       status               = packet.ReadInt32();
                    const int STATUS_DISABLED      = 0x0001;
                    const int STATUS_PROC_COMPLETE = 0x0008;
                    Disabled      = status & STATUS_DISABLED;
                    ProcCompleted = status & STATUS_PROC_COMPLETE;
                    break;
                }

                case (uint)Query.LScale:
                {
                    LScale = packet.ReadInt32();
                    break;
                }

                case (uint)Query.RScale:
                {
                    RScale = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Link:
                {
                    LinkCount  = packet.ReadInt32();
                    LinkMarker = packet.ReadInt32();
                    break;
                }

                case (uint)Query.End:     //Query.End
                    return(packet.BaseStream.Position - pos);

                default:
                {
                    packet.ReadChars(size - sizeof(uint));
                    break;
                }
                }
            }
        }
Exemplo n.º 20
0
        public void Update(BinaryReader packet, Duel duel)
        {
            int flag = packet.ReadInt32();

            if ((flag & (int)Query.Code) != 0)
            {
                SetId(packet.ReadInt32());
            }
            if ((flag & (int)Query.Position) != 0)
            {
                Controller = duel.GetLocalPlayer(packet.ReadByte());
                packet.ReadByte();
                packet.ReadByte();
                Position = packet.ReadByte();
            }
            if ((flag & (int)Query.Alias) != 0)
            {
                Alias = packet.ReadInt32();
            }
            if ((flag & (int)Query.Type) != 0)
            {
                Type = packet.ReadInt32();
            }
            if ((flag & (int)Query.Level) != 0)
            {
                Level = packet.ReadInt32();
            }
            if ((flag & (int)Query.Rank) != 0)
            {
                Rank = packet.ReadInt32();
            }
            if ((flag & (int)Query.Attribute) != 0)
            {
                Attribute = packet.ReadInt32();
            }
            if ((flag & (int)Query.Race) != 0)
            {
                Race = packet.ReadInt32();
            }
            if ((flag & (int)Query.Attack) != 0)
            {
                Attack = packet.ReadInt32();
            }
            if ((flag & (int)Query.Defence) != 0)
            {
                Defense = packet.ReadInt32();
            }
            if ((flag & (int)Query.BaseAttack) != 0)
            {
                BaseAttack = packet.ReadInt32();
            }
            if ((flag & (int)Query.BaseDefence) != 0)
            {
                BaseDefense = packet.ReadInt32();
            }
            if ((flag & (int)Query.Reason) != 0)
            {
                packet.ReadInt32();
            }
            if ((flag & (int)Query.ReasonCard) != 0)
            {
                packet.ReadInt32(); // Int8 * 4
            }
            if ((flag & (int)Query.EquipCard) != 0)
            {
                packet.ReadInt32(); // Int8 * 4
            }
            if ((flag & (int)Query.TargetCard) != 0)
            {
                int count = packet.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    packet.ReadInt32(); // Int8 * 4
                }
            }
            if ((flag & (int)Query.OverlayCard) != 0)
            {
                Overlays.Clear();
                int count = packet.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    Overlays.Add(packet.ReadInt32());
                }
            }
            if ((flag & (int)Query.Counters) != 0)
            {
                int count = packet.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    packet.ReadInt32(); // Int16 * 2
                }
            }
            if ((flag & (int)Query.Owner) != 0)
            {
                Owner = duel.GetLocalPlayer(packet.ReadInt32());
            }
            if ((flag & (int)Query.IsDisabled) != 0)
            {
                Disabled = packet.ReadInt32();
            }
            if ((flag & (int)Query.IsPublic) != 0)
            {
                packet.ReadInt32();
            }
            if ((flag & (int)Query.LScale) != 0)
            {
                LScale = packet.ReadInt32();
            }
            if ((flag & (int)Query.RScale) != 0)
            {
                RScale = packet.ReadInt32();
            }
            if ((flag & (int)Query.Link) != 0)
            {
                Link       = packet.ReadInt32();
                LinkMarker = packet.ReadInt32();
            }
        }
Exemplo n.º 21
0
 protected virtual void InitialOverlay()
 {
     // create setting overlay
     Overlays.Add(new SettingHUDOverlay(this, Mods));
 }
Exemplo n.º 22
0
        public void Update(BinaryReader packet, Duel duel)
        {
            int flag = packet.ReadInt32();

            if ((flag & (int)Query.Code) != 0)
            {
                SetId(packet.ReadInt32());
            }
            if ((flag & (int)Query.Position) != 0)
            {
                Controller = duel.GetLocalPlayer(packet.ReadByte());
                Location   = (CardLocation)packet.ReadByte();
                Sequence   = packet.ReadByte();
                Position   = packet.ReadByte();
            }
            if ((flag & (int)Query.Alias) != 0)
            {
                Alias = packet.ReadInt32();
            }
            if ((flag & (int)Query.Type) != 0)
            {
                Type = packet.ReadInt32();
            }
            if ((flag & (int)Query.Level) != 0)
            {
                Level = packet.ReadInt32();
            }
            if ((flag & (int)Query.Rank) != 0)
            {
                Rank = packet.ReadInt32();
            }
            if ((flag & (int)Query.Attribute) != 0)
            {
                Attribute = packet.ReadInt32();
            }
            if ((flag & (int)Query.Race) != 0)
            {
                Race = packet.ReadInt32();
            }
            if ((flag & (int)Query.Attack) != 0)
            {
                Attack = packet.ReadInt32();
            }
            if ((flag & (int)Query.Defence) != 0)
            {
                Defense = packet.ReadInt32();
            }
            if ((flag & (int)Query.BaseAttack) != 0)
            {
                BaseAttack = packet.ReadInt32();
            }
            if ((flag & (int)Query.BaseDefence) != 0)
            {
                BaseDefense = packet.ReadInt32();
            }
            if ((flag & (int)Query.Reason) != 0)
            {
                packet.ReadInt32();
            }
            if ((flag & (int)Query.ReasonCard) != 0)
            {
                packet.ReadInt32(); // Int8 * 4
            }
            if ((flag & (int)Query.EquipCard) != 0)
            {
                packet.ReadInt32(); // Int8 * 4
            }
            if ((flag & (int)Query.TargetCard) != 0)
            {
                int count = packet.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    packet.ReadInt32(); // Int8 * 4
                }
            }
            if ((flag & (int)Query.OverlayCard) != 0)
            {
                Overlays.Clear();
                int count = packet.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    Overlays.Add(packet.ReadInt32());
                }
            }
            if ((flag & (int)Query.Counters) != 0)
            {
                int count = packet.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    packet.ReadInt32(); // Int16 * 2
                }
            }
            if ((flag & (int)Query.Owner) != 0)
            {
                Owner = duel.GetLocalPlayer(packet.ReadInt32());
            }
            if ((flag & (int)Query.Status) != 0)
            {
                int       status               = packet.ReadInt32();
                const int STATUS_DISABLED      = 0x0001;
                const int STATUS_PROC_COMPLETE = 0x0008;
                Disabled      = status & STATUS_DISABLED;
                ProcCompleted = status & STATUS_PROC_COMPLETE;
            }
            if ((flag & (int)Query.LScale) != 0)
            {
                LScale = packet.ReadInt32();
            }
            if ((flag & (int)Query.RScale) != 0)
            {
                RScale = packet.ReadInt32();
            }
            if ((flag & (int)Query.Link) != 0)
            {
                LinkCount  = packet.ReadInt32();
                LinkMarker = packet.ReadInt32();
            }
        }
Exemplo n.º 23
0
        public void UpdateAsync()
        {
            SendFunction("", true, x =>
            {
                var e = (DownloadStringCompletedEventArgs)x;

                if (e.Error != null)
                {
                    OnStateSynced?.Invoke(this, new StateSyncedEventArgs()
                    {
                        Successfully = false
                    });
                    return;
                }
                if (e.UserState == null)
                {
                    return;
                }
                IsInitializing = true;
                _logger.Info("Updating vMix state.");
                var _temp = Create(e.Result);

                if (_temp == null)
                {
                    _logger.Info("vMix is offline");
                    _logger.Info("Firing \"updated\" event.");

                    IsInitializing = false;
                    OnStateSynced?.Invoke(this, new StateSyncedEventArgs()
                    {
                        Successfully = false
                    });
                }

                _logger.Info("Calculating difference.");
                Diff(this, _temp);

                _logger.Info("Updating inputs.");

                Inputs.Clear();
                foreach (var item in _temp.Inputs)
                {
                    Inputs.Add(item);
                }
                Overlays.Clear();
                foreach (var item in _temp.Overlays)
                {
                    Overlays.Add(item);
                }

                /*_previousStateText = _currentStateText;
                 * _currentStateText = _temp.CurrentStateText;*/
                UpdateChangedInputs(_currentStateText, _temp._currentStateText);
                if (_currentStateText != _temp._currentStateText)
                {
                    _currentStateText = _temp._currentStateText;
                }

                _logger.Info("Firing \"updated\" event.");

                IsInitializing = false;
                OnStateSynced?.Invoke(this, new StateSyncedEventArgs()
                {
                    Successfully = true, OldInputs = null, NewInputs = null
                });
                return;
            });
        }
Exemplo n.º 24
0
        public void UpdateAsync()
        {
            SendFunction("", true, x =>
            {
                try
                {
                    var e = (DownloadStringCompletedEventArgs)x;

                    if (e.Error != null)
                    {
                        OnStateSynced?.Invoke(this, new StateSyncedEventArgs()
                        {
                            Successfully = false
                        });
                        return;
                    }
                    if (e.UserState == null)
                    {
                        return;
                    }
                    IsInitializing = true;
                    _logger.Debug("Updating vMix state.");
                    var _temp = Create(e.Result);

                    if (_temp == null)
                    {
                        _logger.Debug("vMix is offline");
                        _logger.Debug("Firing \"updated\" event.");

                        IsInitializing = false;
                        OnStateSynced?.Invoke(this, new StateSyncedEventArgs()
                        {
                            Successfully = false
                        });
                    }

                    _logger.Debug("Calculating difference.");
                    Diff(this, _temp);

                    _logger.Debug("Updating inputs.");
                    if (Inputs == null)
                    {
                        Inputs = new List <Input>();
                    }
                    if (Overlays == null)
                    {
                        Overlays = new List <Overlay>();
                    }
                    if (Audio == null)
                    {
                        Audio = new List <Master>();
                    }
                    if (Transitions == null)
                    {
                        Transitions = new List <Transition>();
                    }
                    Inputs.Clear();
                    foreach (var item in _temp.Inputs)
                    {
                        Inputs.Add(item);
                    }
                    Overlays.Clear();
                    foreach (var item in _temp.Overlays)
                    {
                        Overlays.Add(item);
                    }
                    Audio.Clear();
                    foreach (var item in _temp.Audio)
                    {
                        Audio.Add(item);
                    }
                    Transitions.Clear();
                    foreach (var item in _temp.Transitions)
                    {
                        Transitions.Add(item);
                    }
                    Mixes.Clear();
                    foreach (var item in _temp.Mixes)
                    {
                        Mixes.Add(item);
                    }


                    if (_currentStateText != _temp._currentStateText)
                    {
                        _currentStateText = _temp._currentStateText;
                    }

                    _logger.Debug("Firing \"updated\" event.");

                    IsInitializing = false;
                    OnStateSynced?.Invoke(this, new StateSyncedEventArgs()
                    {
                        Successfully = true, OldInputs = null, NewInputs = null
                    });
                    return;
                }
                catch (Exception e)
                {
                    IsInitializing = false;
                    _logger.Error(e, "Exception at UpdateAsync");
                }
            });
        }
Exemplo n.º 25
0
        public override VobSendFlags Read(RakNet.BitStream stream)
        {
            VobSendFlags sendInfo = base.Read(stream);

            stream.Read(out name);
            stream.Read(out bodyMesh);
            stream.Read(out bodyTex);
            stream.Read(out skinColor);
            stream.Read(out headMesh);
            stream.Read(out headTex);
            stream.Read(out teethTex);

            stream.Read(out this.attributes, this.Attributes.Length);
            stream.Read(out this.talentSkills, this.TalentSkills.Length);
            stream.Read(out this.talentValues, this.TalentValues.Length);
            stream.Read(out this.hitchances, this.Hitchances.Length);


            Vec3f vec = new Vec3f();

            stream.Read(out vec);
            Scale = vec;

            stream.Read(out Fatness);


            int itemCount = 0;

            stream.Read(out itemCount);
            for (int i = 0; i < itemCount; i++)
            {
                int itemID = 0;
                stream.Read(out itemID);

                Item it = (Item)sWorld.VobDict[itemID];
                addItem(it);
            }

            itemCount = 0;
            stream.Read(out itemCount);
            for (int i = 0; i < itemCount; i++)
            {
                int itemID = 0;
                stream.Read(out itemID);

                Item it = (Item)sWorld.VobDict[itemID];
                EquippedList.Add(it);
            }

            int armorID = 0, weaponID = 0, rangeWeaponID = 0;

            stream.Read(out armorID);
            stream.Read(out weaponID);
            stream.Read(out rangeWeaponID);
            if (armorID > 0)
            {
                Armor = (Item)sWorld.VobDict[armorID];
            }
            if (weaponID > 0)
            {
                Weapon = (Item)sWorld.VobDict[weaponID];
            }
            if (rangeWeaponID > 0)
            {
                RangeWeapon = (Item)sWorld.VobDict[rangeWeaponID];
            }

            int activeSpellIDid = 0;

            stream.Read(out activeSpellIDid);
            if (activeSpellIDid > 0)
            {
                this.ActiveSpell = (Item)sWorld.VobDict[activeSpellIDid];
            }


            int overlayCount = 0;

            stream.Read(out overlayCount);
            for (int i = 0; i < overlayCount; i++)
            {
                String overlay = "";
                stream.Read(out overlay);
                Overlays.Add(overlay);
            }

            stream.Read(out this.IsInvisible);
            stream.Read(out this.hideName);

            stream.Read(out this.weaponMode);

            return(sendInfo);
        }
Exemplo n.º 26
0
        protected override void GetGameOverlays(SuperBitmap bmp)
        {
            Overlays.Clear();

            ushort chksum;
            Color  c;

            //Overlays
            if (CurrentArea == Area.MainBases.Main)
            {
                chksum = ScreenState.GetScreenChecksum(bmp, 67, 16, 6);
                if (chksum == 0x95ca)
                {
                    Overlays.Add(Overlay.Statuses.Loading);
                }

                chksum = ScreenState.GetScreenChecksum(bmp, 352, 545, 20);
                if (chksum == 0xdd80)
                {
                    Overlays.Add(Overlay.Widgets.AllianceHelp);
                }

                chksum = ScreenState.GetScreenChecksum(bmp, 373, 348, 10);
                //if (chksum != 0xe8ae && chksum != 0x6bb1) ///depricated?
                if (chksum == 0x0060)
                {
                    //c = bmp.GetPixel(44, 395);
                    //if (!c.Equals(165, 121, 24))
                    c = bmp.GetPixel(372, 345);
                    if (!c.Equals(198, 150, 33))
                    {
                        Overlays.Add(Overlay.Widgets.DailyLogin);
                    }
                }

                //c = s.bmp.GetPixel(35, 498);
                //c2 = s.bmp.GetPixel(29, 498);
                c = bmp.GetPixel(275, 535);
                //Rectangle(4, 489, 63, 18)
                //if (Math.Abs(c.R - c.G) <= 11 && (c.Within(157, 156, 155, 28) || c2.Within(165, 162, 156, 28)) &&
                if (ScreenState.BlackBoxExists(bmp, new Rectangle(4, 587, 51, 18), Color.FromArgb(74, 77, 74)))
                {
                    Overlays.Add(Overlay.Widgets.GlobalGift);
                }

                if (!ScreenState.BlackBoxExists(bmp, new Rectangle(63, 587, 51, 18), Color.FromArgb(74, 77, 74)))
                {
                    for (int i = 552; i <= 570; i++)
                    {
                        c = bmp.GetPixel(91, i);
                        //int min = 99; //Useful for debugging
                        //min = Math.Min(min, Math.Max(Math.Max(Math.Abs(c.R - 99), Math.Abs(c.G - 97)), Math.Abs(c.B - 99)));
                        if (c.Within(99, 97, 99, 8))
                        {
                            Overlays.Add(Overlay.Widgets.SecretGift);
                            break;
                        }
                    }
                }

                chksum = ScreenState.GetScreenChecksum(bmp, 98, 16, 10);
                if (chksum == 0x0f1e)
                {
                    Overlays.Add(Overlay.Statuses.VIPInactive);
                }

                if (ScreenState.BlackBoxExists(bmp, new Rectangle(16, 562, 63, 18), Color.FromArgb(74, 77, 74)))
                {
                    Overlays.Add(Overlay.Widgets.RewardsCrate);
                }

                if (ScreenState.BlackBoxExists(bmp, new Rectangle(248, 589, 51, 16), Color.FromArgb(74, 77, 74))) //DIFF ff
                {
                    Overlays.Add(Overlay.Widgets.AmmoFreeAttack);
                }
            }
            else if (CurrentArea == Area.StateMaps.Main || CurrentArea == Area.StateMaps.FullScreen)
            {
                chksum = ScreenState.GetScreenChecksum(bmp, 352, 545, 20);
                if (chksum == 0xdd80)
                {
                    Overlays.Add(Overlay.Widgets.AllianceHelp);
                }

                chksum = ScreenState.GetScreenChecksum(bmp, 54, 198, 10);
                if (chksum == 0xcadb)
                {
                    Overlays.Add(Overlay.Dialogs.Tiles.Empty);
                }
                else
                {
                    chksum = ScreenState.GetScreenChecksum(bmp, 40, 107, 10);
                    if (chksum == 0x63bd)
                    {
                        c = bmp.GetPixel(195, 240);
                        if (c.Equals(0, 186, 255))
                        {
                            Overlays.Add(Overlay.Dialogs.Tiles.PlayerFriend);
                        }
                        else
                        {
                            c = bmp.GetPixel(195, 244); //if that player's VIP is active
                            if (c.Equals(0, 186, 255))
                            {
                                Overlays.Add(Overlay.Dialogs.Tiles.PlayerFriend);
                            }
                            else
                            {
                                Overlays.Add(Overlay.Dialogs.Tiles.PlayerEnemy);
                            }
                        }
                    }
                    else
                    {
                        chksum = ScreenState.GetScreenChecksum(bmp, 54, 71, 10);
                        if (chksum == 0x3dec)
                        {
                            Overlays.Add(Overlay.Dialogs.Tiles.RssOpen);
                        }
                        else
                        {
                            chksum = ScreenState.GetScreenChecksum(bmp, 23, 18, 10);
                            if (chksum == 0x10f3)
                            {
                                Overlays.Add(Overlay.Dialogs.Tiles.Rebel);
                            }
                            else
                            {
                                chksum = ScreenState.GetScreenChecksum(bmp, 54, 128, 10);
                                if (chksum == 0x41c0)
                                {
                                    Overlays.Add(Overlay.Dialogs.Tiles.Warzone);
                                }
                                else
                                {
                                    chksum = ScreenState.GetScreenChecksum(bmp, 54, 128, 10);
                                    if (chksum == 0x5345)
                                    {
                                        Overlays.Add(Overlay.Dialogs.Tiles.ControlPoint);
                                    }
                                    else
                                    {
                                        chksum = ScreenState.GetScreenChecksum(bmp, 192, 120, 10);
                                        if (chksum == 0xa992 || chksum == 0x520b) //crystal no occupy allowed <-no longer true, its just a Blocked dialog
                                        {
                                            Overlays.Add(Overlay.Dialogs.Tiles.Blocked);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else if (CurrentArea == Area.Menus.Alliance || CurrentArea == Area.Menus.Mission || CurrentArea == Area.Menus.Account)
            {
                //bmp.Bitmap.Save(String.Format("{0}\\help{1}.bmp", Controller.Instance.GetFullScreenshotDir(), System.Threading.Thread.CurrentThread.ManagedThreadId.ToString()), System.Drawing.Imaging.ImageFormat.Bmp);
                chksum = ScreenState.GetScreenChecksum(bmp, 67, 16, 6);
                if (chksum == 0x041e)
                {
                    Overlays.Add(Overlay.Statuses.Loading);
                }
            }
            else if (CurrentArea == Area.Menus.AllianceHelp)
            {
                //bmp.Bitmap.Save(String.Format("{0}\\help{1}.bmp", Controller.Instance.GetFullScreenshotDir(), System.Threading.Thread.CurrentThread.ManagedThreadId.ToString()), System.Drawing.Imaging.ImageFormat.Bmp);
                chksum = ScreenState.GetScreenChecksum(bmp, 36, 225, 20);
                if (chksum == 0xfb5e) //f534 loaded2 //fb5e loading
                {
                    Overlays.Add(Overlay.Statuses.Loading);
                }
            }

            chksum = ScreenState.GetScreenChecksum(bmp, 190, 104, 10);
            if (chksum == 0x7cf6 || chksum == 0x124a) //popup
            {
                chksum = ScreenState.GetScreenChecksum(bmp, 190, 115, 20);
                switch (chksum)
                {
                case 0x0388:
                case 0x6abd:
                    //TODO: look into possible transparency issue with this dialog
                    // TODO: Remove, debugging
                    chksum = ScreenState.GetScreenChecksum(bmp, 67, 16, 4);
                    ushort chksum2 = ScreenState.GetScreenChecksum(bmp, 160, 16, 14);
                    ushort chksum3 = ScreenState.GetScreenChecksum(bmp, 190, 115, 20);

                    if (!System.IO.File.Exists(String.Format("{0}\\unknown\\rss{1}-{2}-{3}.bmp", Controller.Instance.GetFullScreenshotDir(), chksum.ToString("X4"), chksum2.ToString("X4"), chksum3.ToString("X4"))))
                    {
                        bmp.Save(String.Format("{0}\\unknown\\rss{1}-{2}-{3}.bmp", Controller.Instance.GetFullScreenshotDir(), chksum.ToString("X4"), chksum2.ToString("X4"), chksum3.ToString("X4")));
                    }
                    Overlays.Add(Overlay.Dialogs.Popups.TransferConfirmation);
                    break;

                case 0xdc05:     //max limit
                    Overlays.Add(Overlay.Dialogs.Popups.MaxDeployments);
                    break;

                case 0x1187:
                    Overlays.Add(Overlay.Dialogs.Popups.DemolishBuilding);
                    break;

                case 0x4c4a:
                case 0x6262:     //log out
                    Overlays.Add(Overlay.Dialogs.Popups.AreYouSure);
                    break;

                case 0x152c:
                    Overlays.Add(Overlay.Dialogs.Popups.LoginFailed);
                    break;

                case 0xba61:     //notice
                case 0x9aed:     //memu 5.1.1.1
                    chksum = ScreenState.GetScreenChecksum(bmp, 190, 150, 20);
                    switch (chksum)
                    {
                    case 0x8a67:         //march may have not sent due to internet connection
                        Overlays.Add(Overlay.Dialogs.Popups.ConnectionInterrupted);
                        break;

                    case 0x4e5b:         //please try to collect the gift later
                        Overlays.Add(Overlay.Dialogs.Popups.Unknown);
                        break;

                    default:
                        Overlays.Add(Overlay.Dialogs.Popups.Unknown);
                        break;
                    }
                    //google play error
                    //quest timer not completed
                    //cannot attack allied base
                    //nsf rss
                    break;

                case 0xb3aa:              //tip!
                    chksum = ScreenState.GetScreenChecksum(bmp, 190, 150, 20);
                    if (chksum == 0x003e) //warning troops attacking outside base are not saved by hospital
                    {
                        Overlays.Add(Overlay.Dialogs.Popups.WarningOutsideAttack);
                    }
                    else
                    {
                        Overlays.Add(Overlay.Dialogs.Popups.Unknown);
                    }
                    break;

                case 0x49ac:              //scout
                    chksum = ScreenState.GetScreenChecksum(bmp, 190, 150, 20);
                    if (chksum == 0x68e1) //scout not unlocked
                    {
                        Overlays.Add(Overlay.Dialogs.Popups.ScoutNotUnlocked);
                    }
                    else
                    {
                        Overlays.Add(Overlay.Dialogs.Popups.Unknown);
                    }
                    break;

                case 0x54db:
                    Overlays.Add(Overlay.Dialogs.Popups.ReplaceBoost);
                    break;

                case 0xe495:
                    Overlays.Add(Overlay.Dialogs.Popups.NewEvent);
                    break;

                case 0xf58b:     //coordinate dialog
                    break;

                default:
                    Overlays.Add(Overlay.Dialogs.Popups.Unknown);
                    break;
                }
            }

            chksum = ScreenState.GetScreenChecksum(bmp, 200, 660, 10);
            //c = bmp.GetPixel(213, 664); //DIFF MS
            //if (c.Equals(24, 130, 16) || c.Equals(0, 28, 0)) //DIFF MS
            if (chksum == 0x2bd0 || chksum == 0x4dde)
            {
                Overlays.Add(Overlay.Widgets.AllianceGift);
            }

            c = bmp.GetPixel(132, 652);
            if (c.Equals(231, 4, 82))
            {
                Overlays.Add(Overlay.Widgets.MissionsAvailable);
            }

            chksum = ScreenState.GetScreenChecksum(bmp, 360, 494, 8);//DIFF ff
            switch (chksum)
            {
            //    case 0x7d6a:
            //        Overlays.Add(Overlay.Incomings.Rally);
            //        s.SuperBitmap.Bitmap.Save(Controller.Instance.GetFullScreenshotDir() + "rally.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
            //        break;
            case 0x3d9f:
                Overlays.Add(Overlay.Incomings.Attack);
                break;
                //    case 0x1475:
                //        Overlays.Add(Overlay.Incomings.Scout);
                //        break;
                //    case 0xb76e:
                //        Overlays.Add(Overlay.Incomings.Transport);
                //        break;
                //    case 0xe405:
                //        Overlays.Add(Overlay.Incomings.Reinforcement);
                //        break;
            }

            if (Overlays.Count == 0 && CurrentArea != Area.Unknown && CurrentArea != Area.MainBases.Main &&
                CurrentArea != Area.StateMaps.Main && CurrentArea != Area.StateMaps.FullScreen &&
                CurrentArea != Area.Emulators.Loading && CurrentArea != Area.Emulators.Android &&
                CurrentArea != Area.Others.Login && CurrentArea != Area.Others.Splash && CurrentArea != Area.Others.Ad &&
                CurrentArea != Area.Others.Chat && CurrentArea != Area.Others.SessionTimeout)
            {
                chksum = ScreenState.GetScreenChecksum(bmp, 67, 16, 4);
                ushort chksum2 = ScreenState.GetScreenChecksum(bmp, 160, 16, 14);
                ushort chksum3 = ScreenState.GetScreenChecksum(bmp, 190, 115, 20);

                if (chksum == 0x0cde || chksum == 0x57ca) //modal or double modal on a menu
                {
                    if (!System.IO.File.Exists(String.Format("{0}\\unknown\\unknown{1}-{2}-{3}.bmp", Controller.Instance.GetFullScreenshotDir(), chksum.ToString("X4"), chksum2.ToString("X4"), chksum3.ToString("X4"))))
                    {
                        bmp.Save(String.Format("{0}\\unknown\\unknown{1}-{2}-{3}.bmp", Controller.Instance.GetFullScreenshotDir(), chksum.ToString("X4"), chksum2.ToString("X4"), chksum3.ToString("X4")));
                    }
                }
            }

            if (Overlays.Contains(Overlay.Dialogs.Popups.Unknown))
            {
                chksum = ScreenState.GetScreenChecksum(bmp, 190, 115, 20);
                ushort chksum2 = ScreenState.GetScreenChecksum(bmp, 190, 150, 20);

                if (!System.IO.File.Exists(String.Format("{0}\\unknown\\popup{1}-{2}.bmp", Controller.Instance.GetFullScreenshotDir(), chksum.ToString("X4"), chksum2.ToString("X4"))))
                {
                    bmp.Save(String.Format("{0}\\unknown\\popup{1}-{2}.bmp", Controller.Instance.GetFullScreenshotDir(), chksum.ToString("X4"), chksum2.ToString("X4")));
                }
            }
        }
Exemplo n.º 27
0
 public void AddOverlayChildren(FrameworkElement fe)
 {
     Overlays.Add(fe);
     Children.Add(fe);
 }
Exemplo n.º 28
0
        protected override void GetGameOverlays(SuperBitmap bmp)
        {
            Overlays.Clear();

            ushort chksum;
            Color  c;

            //Overlays
            if (CurrentArea == Area.MainBases.Main)
            {
                chksum = ScreenState.GetScreenChecksum(bmp, 345, 500, 20);

                //if (chksum == 0xb877) //depricated?
                if (chksum == 0xe925)
                {
                    Overlays.Add(Overlay.Widgets.AllianceHelp);
                }

                chksum = ScreenState.GetScreenChecksum(bmp, 373, 348, 10);
                //if (chksum != 0xe8ae && chksum != 0x6bb1) ///depricated?
                if (chksum == 0x0060)
                {
                    //c = bmp.GetPixel(44, 395);
                    //if (!c.Equals(165, 121, 24))
                    c = bmp.GetPixel(372, 345);
                    if (!c.Equals(198, 150, 33))
                    {
                        Overlays.Add(Overlay.Widgets.DailyLogin);
                    }
                }

                //c = s.bmp.GetPixel(35, 498);
                //c2 = s.bmp.GetPixel(29, 498);
                c = bmp.GetPixel(275, 535);
                //Rectangle(4, 489, 63, 18)
                //if (Math.Abs(c.R - c.G) <= 11 && (c.Within(157, 156, 155, 28) || c2.Within(165, 162, 156, 28)) &&
                if (ScreenState.BlackBoxExists(bmp, new Rectangle(253, 562, 63, 18), Color.FromArgb(74, 77, 74), 10) &&
                    !c.Equals(57, 85, 140))
                {
                    Overlays.Add(Overlay.Widgets.GlobalGift);
                }

                chksum = ScreenState.GetScreenChecksum(bmp, 275, 532, 10);
                c      = bmp.GetPixel(275, 535);
                if (chksum != 0x41fa && !ScreenState.BlackBoxExists(bmp, new Rectangle(253, 562, 63, 18), Color.FromArgb(74, 77, 74)))
                {
                    int n = 0;
                    for (int i = 514; i <= 544; i++)
                    {
                        c = bmp.GetPixel(278, i);
                        if (c.Within(49, 83, 155, 50))
                        {
                            n++;
                        }
                    }
                    if (n > 6)
                    {
                        n = 0;
                        for (int i = 514; i <= 544; i++)
                        {
                            c = bmp.GetPixel(298, i);
                            if (c.Within(49, 83, 155, 50))
                            {
                                n++;
                            }
                        }

                        if (n > 6)
                        {
                            n = 0;
                            for (int i = 514; i <= 544; i++)
                            {
                                c = bmp.GetPixel(286, i);
                                if (Math.Abs(c.G - c.R) < 18 && Math.Abs(c.B - c.G) < 18 && c.R < 80 && c.G < 80 && c.B < 80)
                                {
                                    n++;
                                }
                            }

                            if (n > 7)
                            {
                                Overlays.Add(Overlay.Widgets.SecretGift);
                            }
                        }
                    }
                }

                chksum = ScreenState.GetScreenChecksum(bmp, 98, 16, 10);
                if (chksum == 0x0f1e)
                {
                    Overlays.Add(Overlay.Statuses.VIPInactive);
                }

                if (ScreenState.BlackBoxExists(bmp, new Rectangle(16, 562, 63, 18), Color.FromArgb(74, 77, 74)))
                {
                    Overlays.Add(Overlay.Widgets.RewardsCrate);
                }
                //Rectangle(253, 490, 63, 17)
                if (ScreenState.BlackBoxExists(bmp, new Rectangle(178, 563, 63, 17), Color.FromArgb(74, 77, 74)))
                {
                    Overlays.Add(Overlay.Widgets.AmmoFreeAttack);
                }
            }
            else if (CurrentArea == Area.StateMaps.Main || CurrentArea == Area.StateMaps.FullScreen)
            {
                c = bmp.GetPixel(387, 515);
                if (c.Equals(239, 8, 41))
                {
                    Overlays.Add(Overlay.Widgets.AllianceHelp);
                }
            }

            c = bmp.GetPixel(213, 664);
            if (c.Equals(24, 130, 16) || c.Equals(0, 28, 0))
            {
                Overlays.Add(Overlay.Widgets.AllianceGift);
            }

            c = bmp.GetPixel(134, 668);
            if (c.Equals(231, 8, 33))
            {
                Overlays.Add(Overlay.Widgets.MissionsAvailable);
            }

            chksum = ScreenState.GetScreenChecksum(bmp, 352, 457, 8);

            /*switch (chksum)
             * {
             *  case 0x7d6a:
             *      Overlays.Add(Overlay.Incomings.Rally);
             *      s.SuperBitmap.Bitmap.Save(Controller.Instance.GetFullScreenshotDir() + "rally.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
             *      break;
             *  case 0x6de0:
             *      Overlays.Add(Overlay.Incomings.Attack);
             *      break;
             *  case 0x1475:
             *      Overlays.Add(Overlay.Incomings.Scout);
             *      break;
             *  case 0xb76e:
             *      Overlays.Add(Overlay.Incomings.Transport);
             *      break;
             *  case 0xe405:
             *      Overlays.Add(Overlay.Incomings.Reinforcement);
             *      break;
             * }*/
        }
Exemplo n.º 29
0
        public override void LoadContent()
        {
            //colors for debug
            rndColors = new Color[20];

            for (int i = 0; i < 20; i++)
            {
                rndColors[i] = new Color((float)RandomManager.TheRandom.NextDouble(), (float)RandomManager.TheRandom.NextDouble(), (float)RandomManager.TheRandom.NextDouble());
            }

            //Content manager
            if (Content == null)
            {
                Content = new ContentManager(ScreenManager.Game.Services, "Content");
                screenContentManager = new ScreenContentManager(Content);
            }


            DebugDrawer = new DebugDrawer(ScreenManager.Game, this);
            ScreenManager.Game.Components.Add(DebugDrawer);

            //Load models
            screenContentManager.AddModel("ground", @"Models\Ground");
            screenContentManager.AddModel("ship", @"Models\ship");
            screenContentManager.AddModel("teapot", @"Models\teapot");

            //Set graphics
            graphics                   = ScreenManager.GraphicsDevice;
            graphics.BlendState        = BlendState.Opaque;
            graphics.DepthStencilState = DepthStencilState.Default;

            //Load fonts
            screenContentManager.AddFont("kootenay14", @"Fonts\kootenay14");

            //setup camera
            if (Cam == null)
            {
                Cam = new FreeCamera(new Vector3(0, 100, -250),
                                     MathHelper.ToRadians(180),
                                     MathHelper.ToRadians(5),
                                     graphics);
            }

            //set mouse to invisible
            ScreenManager.Game.IsMouseVisible = false;

            //set up game state

            foreach (Entity e in GameStateManager.GameManager.Entities)
            {
                Actors.Add(new BasicActor(e, screenContentManager.GetModel(e.Name)));
            }

            screenContentManager.AddEffect("lightingEffect", @"Models\LightingEffect");

            LightingMaterial mat = new LightingMaterial();

            //mat.LightColor = Color.Red.ToVector3();
            mat.AmbientColor = new Vector3(0.1f, 0.1f, 0.1f);


            foreach (BasicActor actor in Actors)
            {
                actor.SetModelEffect(screenContentManager.GetEffect("lightingEffect"), true);
                actor.Material = mat;
            }

            //setup overlays
            Overlays.Add(new DebugOverlay(this));
            Overlays[0].IsActive = true;
        }
Exemplo n.º 30
0
 public void AddOverlayChildren(Drawing drawing)
 {
     Overlays.Add(drawing);
     _drawingGroup.Children.Add(drawing);
 }