Exemplo n.º 1
0
        public MapViewModel(IZoneCompletionController zoneController, IZoneService zoneService, IPlayerService playerService,
                            ZoneItemsStore zoneItemsStore, MapUserData userData)
        {
            this.zoneController = zoneController;
            this.zoneService    = zoneService;
            this.userData       = userData;

            this.CharacterPointer = new CharacterPointerViewModel(zoneController, userData);
            this.CharacterPointer.PropertyChanged += CharacterPointer_PropertyChanged;

            this.MapMarkers = new MarkersViewModel(userData);
            this.ZoneItems  = new ZoneItemsViewModel(zoneItemsStore);

            if (playerService.HasValidMapId)
            {
                this.ContinentData = this.zoneService.GetContinentByMap(playerService.MapId);
            }
            else
            {
                this.ContinentData = this.zoneService.GetContinent(DEFAULT_CONTINENT_ID);
            }

            this.FloorId = 1;

            ((INotifyPropertyChanged)this.zoneController).PropertyChanged += ZoneControllerPropertyChanged;
            this.zoneController.Start();
        }
Exemplo n.º 2
0
        public MapViewModel(IZoneCompletionController zoneController, IZoneService zoneService, IPlayerService playerService,
                            PlayerMarkersViewModel mapMarkers, ZoneItemsViewModel zoneItems, MapUserData userData)
        {
            this.zoneController = zoneController;
            this.zoneService    = zoneService;
            this.userData       = userData;

            this.CharacterPointer = new CharacterPointerViewModel(zoneController, userData);
            this.CharacterPointer.PropertyChanged += CharacterPointer_PropertyChanged;
            this.Drawings = new DrawingsViewModel(this.CharacterPointer, zoneService, playerService, userData);

            this.MapMarkers = mapMarkers;
            this.ZoneItems  = zoneItems;

            // Make sure the zone service is ready
            this.zoneService.Initialize();

            if (playerService.HasValidMapId)
            {
                this.ContinentData = this.zoneService.GetContinentByMap(playerService.MapId);
            }
            else
            {
                this.ContinentData = this.zoneService.GetContinent(DEFAULT_CONTINENT_ID);
            }

            this.FloorId = 1;
            if (playerService.HasValidMapId)
            {
                this.FloorId = this.zoneService.GetMap(playerService.MapId).DefaultFloor;
            }

            ((INotifyPropertyChanged)this.zoneController).PropertyChanged += ZoneControllerPropertyChanged;
            this.zoneController.Start();
        }
Exemplo n.º 3
0
        public PlayerMarkersViewModel(TaskTrackerViewModel taskTrackerVm,
                                      MapUserData userData,
                                      PlayerTasksFactory playerTaskFactory,
                                      IPlayerTasksController tasksController,
                                      IZoneService zoneService,
                                      IPlayerService playerService)
        {
            this.taskTrackerVm     = taskTrackerVm;
            this.playerTaskFactory = playerTaskFactory;
            this.tasksController   = tasksController;
            this.zoneService       = zoneService;
            this.playerService     = playerService;
            this.userData          = userData;

            this.PlayerMarkers = new ObservableCollection <PlayerMarkerViewModel>();

            this.playerTasksCollection = (ObservableCollection <PlayerTaskViewModel>) this.taskTrackerVm.PlayerTasks.Source;
            foreach (var task in this.playerTasksCollection)
            {
                task.PropertyChanged += Task_PropertyChanged;
                if (task.HasContinentLocation)
                {
                    this.PlayerMarkers.Add(new PlayerMarkerViewModel(task, this.zoneService, this.playerService));
                }
            }
            this.playerTasksCollection.CollectionChanged += PlayerTasksCollection_CollectionChanged;

            this.InitializeTemplates();
            this.PlayerMarkers.CollectionChanged += PlayerMarkers_CollectionChanged;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Constructs a new MarkersViewModel object
        /// </summary>
        public MarkersViewModel(MapUserData userData)
        {
            this.Markers = new ObservableCollection<MapMarker>();
            this.userData = userData;

            this.InitializeTemplates();

            this.Markers.CollectionChanged += Markers_CollectionChanged;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Constructs a new MarkersViewModel object
        /// </summary>
        public MarkersViewModel(MapUserData userData)
        {
            this.Markers  = new ObservableCollection <MapMarker>();
            this.userData = userData;

            this.InitializeTemplates();

            this.Markers.CollectionChanged += Markers_CollectionChanged;
        }
Exemplo n.º 6
0
        public DrawingViewModel(Drawing drawing, int currentContinentId, MapUserData userData)
        {
            this.currentContinentId = currentContinentId;
            this.Drawing            = drawing;
            this.userData           = userData;

            this.DeleteCommand = new DelegateCommand(this.Delete);
            this.BeginNewPolyline();
            this.RefreshVisibility();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Constructs a new Player Marker view model
        /// </summary>
        /// <param name="taskViewModel">View model of the marker's corresponding task</param>
        public PlayerMarkerViewModel(PlayerTaskViewModel taskViewModel, MapUserData userData, int currentContinentId, IZoneService zoneService, IPlayerService playerService)
        {
            this.taskViewModel      = taskViewModel;
            this.userData           = userData;
            this.currentContinentId = currentContinentId;
            this.zoneService        = zoneService;
            this.playerService      = playerService;

            this.userData.HiddenMarkerCategories.CollectionChanged += HiddenMarkerCategories_CollectionChanged;
            this.taskViewModel.PropertyChanged      += TaskViewModel_PropertyChanged;
            this.taskViewModel.Task.PropertyChanged += Task_PropertyChanged;
            this.RefreshVisibility();
        }
Exemplo n.º 8
0
        /// <summary>
        /// Constructs a new CharacterPointerViewModel
        /// </summary>
        public CharacterPointerViewModel(IZoneCompletionController zoneController, MapUserData userData)
        {
            this.zoneController = zoneController;
            this.userData       = userData;

            this.PlayerTrail = new ObservableCollection <Location>();

            this.DisplayCharacterPointer    = true;
            this.SnapToCharacter            = false;
            this.ShowPlayerTrail            = true;
            this.PlayerTrailLength          = 100;
            this.CanDisplayCharacterPointer = this.zoneController.ValidMapID;

            ((INotifyPropertyChanged)this.zoneController).PropertyChanged += ZoneControllerPropertyChanged;
        }
Exemplo n.º 9
0
        /// <summary>
        /// Constructs a new CharacterPointerViewModel
        /// </summary>
        public CharacterPointerViewModel(IZoneCompletionController zoneController, MapUserData userData)
        {
            this.zoneController = zoneController;
            this.userData       = userData;

            this.PlayerTrail = new ObservableCollection <Location>();
            this.CanDisplayCharacterPointer = this.zoneController.ValidMapID;
            this.RefreshCharacterLocation();
            this.RefreshCharacterDirection();

            string validMapProp  = ReflectionUtility.GetPropertyName(() => this.zoneController.ValidMapID);
            string activeMapProp = ReflectionUtility.GetPropertyName(() => this.zoneController.ActiveMap);
            string charPosProp   = ReflectionUtility.GetPropertyName(() => this.zoneController.CharacterPosition);
            string camDirProp    = ReflectionUtility.GetPropertyName(() => this.zoneController.CameraDirection);

            ((INotifyPropertyChanged)this.zoneController).PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == validMapProp)
                {
                    this.CanDisplayCharacterPointer = this.zoneController.ValidMapID;
                }
                else if (e.PropertyName == activeMapProp)
                {
                    this.RefreshCharacterLocation();
                    this.RefreshCharacterDirection();
                }
                else if (e.PropertyName == charPosProp)
                {
                    this.RefreshCharacterLocation();
                }
                else if (e.PropertyName == camDirProp)
                {
                    this.RefreshCharacterDirection();
                }
            };

            this.PlayerTrailColorOptions = new List <string>()
            {
                "#FFFFFF",
                "#000000",
                "#DD2C00",
                "#6200EA",
                "#2962FF",
                "#00C853",
                "#FFEA00",
                "#FF6D00"
            };
        }
Exemplo n.º 10
0
        public DrawingsViewModel(CharacterPointerViewModel charPointerVm, IZoneService zoneService, IPlayerService playerService, MapUserData userData)
        {
            this.charPointerVm = charPointerVm;
            this.zoneService   = zoneService;
            this.playerService = playerService;
            this.userData      = userData;

            if (this.playerService.HasValidMapId)
            {
                var continent = this.zoneService.GetContinentByMap(this.playerService.MapId);
                this.currentContinentId = continent.Id;
            }
            else
            {
                this.currentContinentId = 1;
            }

            this.NewDrawing = new DrawingViewModel(new Drawing(this.currentContinentId), this.currentContinentId, this.userData);
            this.PenEnabled = false;
            this.Drawings   = new ObservableCollection <DrawingViewModel>();
            foreach (var drawing in userData.Drawings)
            {
                this.Drawings.Add(new DrawingViewModel(drawing, this.currentContinentId, this.userData));
            }
            this.Drawings.CollectionChanged          += Drawings_CollectionChanged;
            this.userData.Drawings.CollectionChanged += UserDataDrawings_CollectionChanged;

            this.PenColorOptions = new List <string>()
            {
                "#FFFFFF",
                "#000000",
                "#DD2C00",
                "#6200EA",
                "#2962FF",
                "#00C853",
                "#FFEA00",
                "#FF6D00"
            };

            this.CopyCharacterTrailCommand = new DelegateCommand(this.CopyCharacterTrail);
            this.ClearNewDrawingCommand    = new DelegateCommand(this.ClearNewDrawing);
            this.SaveNewDrawingCommand     = new DelegateCommand(this.SaveNewDrawing);
            this.ImportDrawingsCommand     = new DelegateCommand(this.ImportDrawings);
            this.ExportDrawingsCommand     = new DelegateCommand(this.ExportDrawing);
        }
Exemplo n.º 11
0
        public PlayerMarkersViewModel(TaskTrackerViewModel taskTrackerVm,
                                      MapUserData userData,
                                      PlayerTasksFactory playerTaskFactory,
                                      IPlayerTasksController tasksController,
                                      IZoneService zoneService,
                                      IPlayerService playerService)
        {
            this.taskTrackerVm     = taskTrackerVm;
            this.playerTaskFactory = playerTaskFactory;
            this.tasksController   = tasksController;
            this.zoneService       = zoneService;
            this.playerService     = playerService;
            this.userData          = userData;

            this.PlayerMarkers = new ObservableCollection <PlayerMarkerViewModel>();

            if (this.playerService.HasValidMapId)
            {
                var continent = this.zoneService.GetContinentByMap(this.playerService.MapId);
                this.currentContinentId = continent.Id;
            }
            else
            {
                this.currentContinentId = 1;
            }

            this.playerTasksCollection = this.tasksController.PlayerTasks;
            foreach (var task in this.playerTasksCollection)
            {
                task.PropertyChanged += Task_PropertyChanged;
                if (task.HasContinentLocation)
                {
                    this.PlayerMarkers.Add(new PlayerMarkerViewModel(task, this.userData, this.currentContinentId, this.zoneService, this.playerService));
                }
            }
            this.playerTasksCollection.CollectionChanged += PlayerTasksCollection_CollectionChanged;

            this.InitializeTemplates();
            this.PlayerMarkers.CollectionChanged += PlayerMarkers_CollectionChanged;

            this.ToggleCategoryVisibiltyCommand = new DelegateCommand <string>(this.ToggleCategoryVisibility);
        }
Exemplo n.º 12
0
        public ZoneItemsViewModel(ZoneItemsStore zoneItemsStore, IZoneCompletionController zoneController, MapUserData userData)
        {
            this.zoneItemsStore = zoneItemsStore;
            this.zoneController = zoneController;
            this.userData       = userData;

            this.ShowHeartQuests = true;
            this.ShowHeroPoints  = true;
            this.ShowPOIs        = true;
            this.ShowVistas      = true;
            this.ShowWaypoints   = true;
            this.ShowDungeons    = true;

            ((INotifyPropertyChanged)this.zoneController).PropertyChanged += (o, e) =>
            {
                if (!this.userData.ShowEntireContinent && e.PropertyName.ToLower().Contains("map"))
                {
                    this.OnPropertyChanged(() => this.Waypoints);
                    this.OnPropertyChanged(() => this.POIs);
                    this.OnPropertyChanged(() => this.Vistas);
                    this.OnPropertyChanged(() => this.HeartQuests);
                    this.OnPropertyChanged(() => this.HeroPoints);
                    this.OnPropertyChanged(() => this.Dungeons);
                }
            };

            this.zoneItemsStore.DataLoaded += (o, e) =>
            {
                this.OnPropertyChanged(() => this.Waypoints);
                this.OnPropertyChanged(() => this.POIs);
                this.OnPropertyChanged(() => this.Vistas);
                this.OnPropertyChanged(() => this.HeartQuests);
                this.OnPropertyChanged(() => this.HeroPoints);
                this.OnPropertyChanged(() => this.Dungeons);
            };
        }
Exemplo n.º 13
0
    public static Role Create(MapUserData info)
    {
        var tbl    = table.TableAvatar.Where(info.profession, info.sexman);
        var avatar = Avatar.Create(tbl);

#if UNITY_EDITOR
        avatar.name = "Role." + info.charname;
#endif
        avatar.transform.localScale = new Vector3(5, 5, 5);

        var role = avatar.AddComponent <Role>();
        role.entity = avatar.AddComponent <Entity>();
        role.move   = avatar.AddComponent <Move>();
        avatar.AddComponent <HpRole>();
        role.move.speed = sender => role.ServerInfo.movespeed * 0.01f;
        role.animator   = avatar.GetComponent <Animator>();
        role.animator.SetInteger("profession", (int)info.profession);
        role.ServerInfo = info;
        avatar.AddComponent <Entry>();

        CreateHeadTip(role);

        return(role);
    }
Exemplo n.º 14
0
        /// <summary>
        /// Constructs a new CharacterPointerViewModel
        /// </summary>
        public CharacterPointerViewModel(IZoneCompletionController zoneController, MapUserData userData)
        {
            this.zoneController = zoneController;
            this.userData = userData;

            this.PlayerTrail = new ObservableCollection<Location>();
            this.CanDisplayCharacterPointer = this.zoneController.ValidMapID;
            this.RefreshCharacterLocation();
            this.RefreshCharacterDirection();

            string validMapProp = ReflectionUtility.GetPropertyName(() => this.zoneController.ValidMapID);
            string activeMapProp = ReflectionUtility.GetPropertyName(() => this.zoneController.ActiveMap);
            string charPosProp = ReflectionUtility.GetPropertyName(() => this.zoneController.CharacterPosition);
            string camDirProp = ReflectionUtility.GetPropertyName(() => this.zoneController.CameraDirection);
            ((INotifyPropertyChanged)this.zoneController).PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == validMapProp)
                {
                    this.CanDisplayCharacterPointer = this.zoneController.ValidMapID;
                }
                else if (e.PropertyName == activeMapProp)
                {
                    this.RefreshCharacterLocation();
                    this.RefreshCharacterDirection();
                }
                else if (e.PropertyName == charPosProp)
                {
                    this.RefreshCharacterLocation();
                }
                else if (e.PropertyName == camDirProp)
                {
                    this.RefreshCharacterDirection();
                }
            };

            this.PlayerTrailColorOptions = new List<string>()
            {
                "#FFFFFF",
                "#000000",
                "#DD2C00",
                "#6200EA",
                "#2962FF",
                "#00C853",
                "#FFEA00",
                "#FF6D00"
            };
        }
Exemplo n.º 15
0
        public MapViewModel(IZoneCompletionController zoneController, IZoneService zoneService, IPlayerService playerService,
            ZoneItemsStore zoneItemsStore, MapUserData userData)
        {
            this.zoneController = zoneController;
            this.zoneService = zoneService;
            this.userData = userData;

            this.CharacterPointer = new CharacterPointerViewModel(zoneController, userData);
            this.CharacterPointer.PropertyChanged += CharacterPointer_PropertyChanged;

            this.MapMarkers = new MarkersViewModel(userData);
            this.ZoneItems = new ZoneItemsViewModel(zoneItemsStore);

            if (playerService.HasValidMapId)
                this.ContinentData = this.zoneService.GetContinentByMap(playerService.MapId);
            else
                this.ContinentData = this.zoneService.GetContinent(DEFAULT_CONTINENT_ID);

            this.FloorId = 1;

            ((INotifyPropertyChanged)this.zoneController).PropertyChanged += ZoneControllerPropertyChanged;
            this.zoneController.Start();
        }
Exemplo n.º 16
0
        public PlayerMarkersViewModel(TaskTrackerViewModel taskTrackerVm,
            MapUserData userData,
            PlayerTasksFactory playerTaskFactory,
            IPlayerTasksController tasksController,
            IZoneService zoneService,
            IPlayerService playerService)
        {
            this.taskTrackerVm = taskTrackerVm;
            this.playerTaskFactory = playerTaskFactory;
            this.tasksController = tasksController;
            this.zoneService = zoneService;
            this.playerService = playerService;
            this.userData = userData;

            this.PlayerMarkers = new ObservableCollection<PlayerMarkerViewModel>();

            this.playerTasksCollection = (ObservableCollection<PlayerTaskViewModel>)this.taskTrackerVm.PlayerTasks.Source;
            foreach (var task in this.playerTasksCollection)
            {
                task.PropertyChanged += Task_PropertyChanged;
                if (task.HasContinentLocation)
                    this.PlayerMarkers.Add(new PlayerMarkerViewModel(task, this.zoneService, this.playerService));
            }
            this.playerTasksCollection.CollectionChanged += PlayerTasksCollection_CollectionChanged;

            this.InitializeTemplates();
            this.PlayerMarkers.CollectionChanged += PlayerMarkers_CollectionChanged;
        }
Exemplo n.º 17
0
        public ZoneItemsViewModel(ZoneItemsStore zoneItemsStore, IZoneCompletionController zoneController, MapUserData userData)
        {
            this.zoneItemsStore = zoneItemsStore;
            this.zoneController = zoneController;
            this.userData = userData;

            this.ShowHeartQuests = true;
            this.ShowHeroPoints = true;
            this.ShowPOIs = true;
            this.ShowVistas = true;
            this.ShowWaypoints = true;
            this.ShowDungeons = true;

            ((INotifyPropertyChanged)this.zoneController).PropertyChanged += (o, e) =>
            {
                if (!this.userData.ShowEntireContinent && e.PropertyName.ToLower().Contains("map"))
                {
                    this.OnPropertyChanged(() => this.Waypoints);
                    this.OnPropertyChanged(() => this.POIs);
                    this.OnPropertyChanged(() => this.Vistas);
                    this.OnPropertyChanged(() => this.HeartQuests);
                    this.OnPropertyChanged(() => this.HeroPoints);
                    this.OnPropertyChanged(() => this.Dungeons);
                }
            };

            this.zoneItemsStore.DataLoaded += (o, e) =>
            {
                this.OnPropertyChanged(() => this.Waypoints);
                this.OnPropertyChanged(() => this.POIs);
                this.OnPropertyChanged(() => this.Vistas);
                this.OnPropertyChanged(() => this.HeartQuests);
                this.OnPropertyChanged(() => this.HeroPoints);
                this.OnPropertyChanged(() => this.Dungeons);
            };
        }
        /// <summary>
        /// Constructs a new CharacterPointerViewModel
        /// </summary>
        public CharacterPointerViewModel(IZoneCompletionController zoneController, MapUserData userData)
        {
            this.zoneController = zoneController;
            this.userData = userData;

            this.PlayerTrail = new ObservableCollection<Location>();

            this.DisplayCharacterPointer = true;
            this.SnapToCharacter = false;
            this.ShowPlayerTrail = true;
            this.PlayerTrailLength = 100;
            this.CanDisplayCharacterPointer = this.zoneController.ValidMapID;

            ((INotifyPropertyChanged)this.zoneController).PropertyChanged += ZoneControllerPropertyChanged;
        }