public TankNodeVM(NationNodeVM parent, Tank tank, LocalGameClient client)
     : base(parent, tank.Name, LoadChildenStrategy.LazyStatic)
 {
     _client = client;
     _tank   = tank;
     _unikey = new TankUnikey(_client, _tank);
 }
示例#2
0
 public VehiclesFolderVM(LocalGameClientNodeVM parent, LocalGameClient client)
     : base(parent,
            Localization.Instance.L("game_client_explorer", "tanks_folder"),
            LoadChildenStrategy.LazyStatic)
 {
     _client = client;
 }
示例#3
0
 public NationNodeVM(ExplorerTreeNodeVM parent, LocalGameClient client, string nation)
     : base(parent, client.Localization.GetLocalizedNationName(nation), LoadChildenStrategy.LazyDynamicAsync)
 {
     _client     = client;
     this.Nation = nation;
     _unikey     = new NationUnikey(client, nation);
 }
示例#4
0
        private static BitmapSource CreateCamouflagePreview(LocalGameClient client, Camouflage camouflage, WpfColor baseColor)
        {
            if (!PackageStream.IsFileExisted(client.PackageIndexer, camouflage.Texture))
            {
                return(null);
            }

            var image = new Image();

            image.Width  = 64;
            image.Height = 64;

            using (var stream = new PackageStream(client.PackageIndexer, camouflage.Texture))
            {
                image.Source = (new DDSImage(stream)).BitmapSource(0);
            }

            var colors = camouflage.GetColors();

            image.Effect = new CamouflageEffect()
            {
                BaseColor = baseColor,
                Color1    = colors[0],
                Color2    = colors[1],
                Color3    = colors[2],
                Color4    = colors[3],
            };

            image.MeasureAndArrange();
            var imageSource = image.RenderToBitmap();

            imageSource.Freeze();
            return(imageSource);
        }
        public LocalGameClientNationalTechTreeVM(LocalGameClient client, string nationKey)
        {
            _client        = client;
            this.NationKey = nationKey;

            _layout = client.TechTreeLayoutDatabase.Query("layout[@nation='{0}']", nationKey);

            this.Name      = _client.Localization.GetLocalizedNationName(NationKey);
            this.SmallIcon = _client.PackageImages.GetNationSmallIcon(NationKey);
        }
示例#6
0
        public DataFolderVM(LocalGameClientNodeVM parent, LocalGameClient client)
            : base(parent,
                   Localization.Instance.L("game_client_explorer", "data_folder"),
                   LoadChildenStrategy.Manual)
        {
            var tanksXmlNode = new XmlNodeVM(this,
                                             this.L("game_client_explorer", "tanks_data_node"),
                                             "tanks",
                                             this.GameClientRoot.Model.ID,
                                             this.GameClientRoot.Model.TankDatabase.Xml,
                                             this.L("game_client_explorer", "Unified Tank XML Data of {0}", this.GameClientRoot.Model.RootPath));

            this.InternalChildren.Add(tanksXmlNode);

            var equipmentsXmlNode = new XmlNodeVM(this,
                                                  this.L("game_client_explorer", "equipment_data_node"),
                                                  "equipments",
                                                  this.GameClientRoot.Model.ID,
                                                  this.GameClientRoot.Model.EquipmentDatabase.Xml,
                                                  this.L("game_client_explorer", "Equipments XML Data of {0}", this.GameClientRoot.Model.RootPath));

            this.InternalChildren.Add(equipmentsXmlNode);

            var consumablesXmlNode = new XmlNodeVM(this,
                                                   this.L("game_client_explorer", "consumables_data_node"),
                                                   "consumables",
                                                   this.GameClientRoot.Model.ID,
                                                   this.GameClientRoot.Model.ConsumableDatabase.Xml,
                                                   this.L("game_client_explorer", "Consumables XML Data of {0}", this.GameClientRoot.Model.RootPath));

            this.InternalChildren.Add(consumablesXmlNode);


            var crewsXmlNode = new XmlNodeVM(this,
                                             this.L("game_client_explorer", "crews_data_node"),
                                             "crews",
                                             this.GameClientRoot.Model.ID,
                                             this.GameClientRoot.Model.CrewDatabase.Xml,
                                             this.L("game_client_explorer", "Crews XML Data of {0}", this.GameClientRoot.Model.RootPath));

            this.InternalChildren.Add(crewsXmlNode);

            var techTreeLayoutXmlNode = new XmlNodeVM(this,
                                                      this.L("game_client_explorer", "tech_tree_layouts_data_node"),
                                                      "layouts",
                                                      this.GameClientRoot.Model.ID,
                                                      this.GameClientRoot.Model.TechTreeLayoutDatabase.Xml,
                                                      this.L("game_client_explorer", "Tech Tree Layouts XML Data of {0}", this.GameClientRoot.Model.RootPath));

            this.InternalChildren.Add(techTreeLayoutXmlNode);
        }
        public RepositoryVM(IRepository repository, RepositoryConfiguration config)
        {
            this.Repository    = repository;
            this.Configuration = config;

            _client = repository as LocalGameClient;
            if (_client != null)
            {
                this.ClientPaths = new ViewModelMap <string, PathVM>(_client.ClientPaths,
                                                                     p => new PathVM(p, _client));

                this.SetAsModDirectoryCommand = new RelayCommand <PathVM>(this.SetAsModDirectory, this.CanSetAsModDirectory);
                this.AddClientPathCommand     = new RelayCommand(this.AddClientPath);
                this.RemoveClientPathsCommand = new RelayCommand <IList>(this.RemoveClientPaths, this.CanRemoveClientPaths);
            }
        }
示例#8
0
        public LocalGameClientNodeVM(GameClientExplorerVM owner, LocalGameClient client)
            : base(null, client.Name, LoadChildenStrategy.Manual)
        {
            this.Configuration = RepositoryManager.Instance.GetConfiguration(client);
            this.Name          = this.Configuration.Alias;
            this.Configuration.PropertyChanged += Configuration_PropertyChanged;

            this.FileExplorer = owner;
            this.Model        = client;

            this.VehiclesNode = new VehiclesFolderVM(this, this.Model);
            this.InternalChildren.Add(this.VehiclesNode);

            this.DataNode = new DataFolderVM(this, this.Model);
            this.InternalChildren.Add(this.DataNode);

            this.FilesNode = new RootFolderVM(this, this.Model);
            this.InternalChildren.Add(this.FilesNode);

            this.ShowPropertiesCommand = new RelayCommand(this.ShowProperties);
        }
示例#9
0
 internal LocalGameManager()
 {
     gameClient = new LocalGameClient();
     myturn     = true;
 }
示例#10
0
 public RootFolderVM(LocalGameClientNodeVM parent, LocalGameClient client)
     : base(parent,
            client.RootPath,
            Localization.Instance.L("game_client_explorer", "files_folder"))
 {
 }
示例#11
0
 public PathVM(string path, LocalGameClient _client)
 {
     this.Path           = path;
     this.IsModDirectory = PathEx.Equals(_client.ModDirectory, path);
     this.DisplayPath    = PathEx.NormalizeDirectorySeparators(PathEx.Relativize(this.Path, _client.RootPath));
 }