示例#1
0
        public LocaleNodeFileData(LocaleTabGroup parent, ResourceFormat resourceFormat,
                                  Resource res, string sourcePath, string name = "") : base(parent, name)
        {
            Source            = res;
            SourcePath        = sourcePath;
            Format            = resourceFormat;
            CanCreateFileLink = true;

            ExportFormat = Format;

            if (res != null)
            {
                RootRegion = res.Regions.Values.FirstOrDefault();

                if (Format == ResourceFormat.LSF)
                {
                    CanRename = false;

                    if (RootRegion.Children.TryGetValue("GameObjects", out var nodes))
                    {
                        if (nodes.FirstOrDefault().Attributes.TryGetValue("Name", out var nameAtt))
                        {
                            Name = (string)nameAtt.Value;
                        }
                    }
                }
                else if (Format == ResourceFormat.LSX)
                {
                    if (!RootRegion.Name.Contains("Quest"))
                    {
                        ExportFormat = ResourceFormat.LSB;
                    }
                    //TraceRegion();
                }
            }

            if (Path.GetFileNameWithoutExtension(SourcePath).IndexOf("Override", StringComparison.OrdinalIgnoreCase) > -1)
            {
                CanOverride = true;
            }
        }
        public BaseLocaleFileData(LocaleTabGroup parent, string name = "")
        {
            Name   = name;
            Parent = parent;

            this.WhenAnyValue(x => x.Name, x => x.ChangesUnsaved).Subscribe((obs) =>
            {
                RenameText = obs.Item1;
                UpdateDisplayName();
            });

            this.WhenAnyValue(x => x.FileLinkData.ReadFrom, (f) => !string.IsNullOrEmpty(f)).ToProperty(this, x => x.HasFileLink);

            var entryChangeSet = Entries.ToObservableChangeSet();
            //Setting ChangesUnsaved to true when any item in entries is unsaved
            var anyChanged = entryChangeSet.AutoRefresh(x => x.ChangesUnsaved).ToCollection();

            anyChanged.Any(x => x.Any(y => y.ChangesUnsaved == true)).ToProperty(this, x => x.ChangesUnsaved);
            entryChangeSet.AutoRefresh(x => x.Visible).Filter(x => x.Visible == true).ObserveOn(RxApp.MainThreadScheduler).Bind(out visibleEntries).Subscribe();

            this.WhenAnyValue(x => x.VisibleEntries.Count, x => x.Selected, (x, y) => x > 0 && y).
            ObserveOn(RxApp.MainThreadScheduler).Subscribe((x) =>
            {
                if (Selected && VisibleEntries.Count > 0)
                {
                    int index = 1;
                    for (var i = 0; i < VisibleEntries.Count; i++)
                    {
                        var item = VisibleEntries[i];
                        //System.Diagnostics.Trace.WriteLine($"{name}({Selected}) | items({i}) = {item.EntryKey}");
                        item.Index = index;
                        index++;
                    }
                }
            });
        }
 public CombinedLocaleVirtualFileData(LocaleTabGroup parent, string name = "") : base(parent, name)
 {
 }
 public LocaleCustomFileData(LocaleTabGroup parent, string name = "") : base(parent, name)
 {
     CanRename         = CanClose = true;
     CanCreateFileLink = false;
 }
		public LocaleTestFileData(LocaleTabGroup parent, string name = "") : base(parent, name)
		{

		}