Пример #1
0
        public TaeEditAnimList(TaeEditorScreen mainScreen)
        {
            MainScreen = mainScreen;

            //if (MainScreen.FileContainer.StandardTAE != null)
            //{
            //    foreach (var kvp in MainScreen.FileContainer.StandardTAE)
            //    {
            //        var taeSection = new TaeEditAnimListTaeSection();
            //        taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections;
            //        taeSection.Tae = kvp.Value;
            //        taeSection.SectionName = System.IO.Path.GetFileName(kvp.Value.FilePath ?? kvp.Value.VirtualUri);
            //        foreach (var anim in kvp.Value.Animations)
            //        {
            //            var animID_Lower = anim.ID % 10000;
            //            var animID_Upper = anim.ID / 10000;
            //            var info = new TaeEditAnimInfo()
            //            {
            //                GetName = () => $"a{(kvp.Key + animID_Upper):D2}_{animID_Lower:D4}",
            //                Ref = anim,
            //                VerticalOffset = taeSection.HeightOfAllAnims,
            //                TaePrefix = kvp.Key,
            //            };

            //            taeSection.InfoMap.Add(anim, info);
            //            taeSection.HeightOfAllAnims += AnimHeight;
            //        }
            //        AnimTaeSections.Add(taeSection);
            //    }
            //}

            //if (MainScreen.FileContainer.PlayerTAE != null)
            //{
            //    foreach (var kvp in MainScreen.FileContainer.PlayerTAE)
            //    {
            //        var taeSection = new TaeEditAnimListTaeSection();
            //        taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections;
            //        taeSection.Tae = kvp.Value;
            //        taeSection.SectionName = System.IO.Path.GetFileName(kvp.Value.FilePath ?? kvp.Value.VirtualUri);
            //        foreach (var anim in kvp.Value.Animations)
            //        {
            //            var animID_Lower = anim.ID % 10000;
            //            var animID_Upper = anim.ID / 10000;
            //            var info = new TaeEditAnimInfo()
            //            {
            //                GetName = () => $"a{(kvp.Key + animID_Upper):D2}_{animID_Lower:D4}",
            //                Ref = anim,
            //                VerticalOffset = taeSection.HeightOfAllAnims,
            //                TaePrefix = kvp.Key,
            //            };

            //            taeSection.InfoMap.Add(anim, info);
            //            taeSection.HeightOfAllAnims += AnimHeight;
            //        }
            //        AnimTaeSections.Add(taeSection);
            //    }
            //}

            foreach (var kvp in MainScreen.FileContainer.AllTAEDict)
            {
                var tae        = kvp.Value;
                var taeSection = new TaeEditAnimListTaeSection();
                taeSection.Collapsed   = MainScreen.Config.AutoCollapseAllTaeSections;
                taeSection.Tae         = tae;
                taeSection.SectionName = System.IO.Path.GetFileName(kvp.Key);
                foreach (var anim in tae.Animations)
                {
                    var animID_Lower = GameDataManager.GameTypeHasLongAnimIDs
                        ? (anim.ID % 1_000000) : (anim.ID % 1_0000);

                    var animID_Upper = taeSection.SectionName.StartsWith("a") ?
                                       long.Parse(Utils.GetFileNameWithoutAnyExtensions(taeSection.SectionName).Substring(1))
                        : ((GameDataManager.GameTypeHasLongAnimIDs
                            ? (anim.ID / 1_000000) : (anim.ID / 1_0000)));

                    var info = new TaeEditAnimInfo()
                    {
                        GetName = () => (GameDataManager.GameTypeHasLongAnimIDs
                          ? $"a{(animID_Upper):D3}_{animID_Lower:D6}" : $"a{(animID_Upper):D2}_{animID_Lower:D4}"),
                        Ref            = anim,
                        VerticalOffset = taeSection.HeightOfAllAnims,
                        TaePrefix      = animID_Upper,
                        IsLargeID      = GameDataManager.GameTypeHasLongAnimIDs
                    };

                    taeSection.InfoMap.Add(anim, info);
                    taeSection.HeightOfAllAnims += AnimHeight;
                }
                AnimTaeSections.Add(taeSection);
            }

            ScrollViewer = new TaeScrollViewer();

            UpdateScrollViewerRect();
        }
Пример #2
0
        public TaeEditAnimList(TaeEditorScreen mainScreen)
        {
            MainScreen = mainScreen;

            //if (MainScreen.FileContainer.StandardTAE != null)
            //{
            //    foreach (var kvp in MainScreen.FileContainer.StandardTAE)
            //    {
            //        var taeSection = new TaeEditAnimListTaeSection();
            //        taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections;
            //        taeSection.Tae = kvp.Value;
            //        taeSection.SectionName = System.IO.Path.GetFileName(kvp.Value.FilePath ?? kvp.Value.VirtualUri);
            //        foreach (var anim in kvp.Value.Animations)
            //        {
            //            var animID_Lower = anim.ID % 10000;
            //            var animID_Upper = anim.ID / 10000;
            //            var info = new TaeEditAnimInfo()
            //            {
            //                GetName = () => $"a{(kvp.Key + animID_Upper):D2}_{animID_Lower:D4}",
            //                Ref = anim,
            //                VerticalOffset = taeSection.HeightOfAllAnims,
            //                TaePrefix = kvp.Key,
            //            };

            //            taeSection.InfoMap.Add(anim, info);
            //            taeSection.HeightOfAllAnims += AnimHeight;
            //        }
            //        AnimTaeSections.Add(taeSection);
            //    }
            //}

            //if (MainScreen.FileContainer.PlayerTAE != null)
            //{
            //    foreach (var kvp in MainScreen.FileContainer.PlayerTAE)
            //    {
            //        var taeSection = new TaeEditAnimListTaeSection();
            //        taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections;
            //        taeSection.Tae = kvp.Value;
            //        taeSection.SectionName = System.IO.Path.GetFileName(kvp.Value.FilePath ?? kvp.Value.VirtualUri);
            //        foreach (var anim in kvp.Value.Animations)
            //        {
            //            var animID_Lower = anim.ID % 10000;
            //            var animID_Upper = anim.ID / 10000;
            //            var info = new TaeEditAnimInfo()
            //            {
            //                GetName = () => $"a{(kvp.Key + animID_Upper):D2}_{animID_Lower:D4}",
            //                Ref = anim,
            //                VerticalOffset = taeSection.HeightOfAllAnims,
            //                TaePrefix = kvp.Key,
            //            };

            //            taeSection.InfoMap.Add(anim, info);
            //            taeSection.HeightOfAllAnims += AnimHeight;
            //        }
            //        AnimTaeSections.Add(taeSection);
            //    }
            //}

            bool isMultiSectionTae = MainScreen.FileContainer.AllTAEDict.Count > 1;

            foreach (var kvp in MainScreen.FileContainer.AllTAEDict)
            {
                var tae        = kvp.Value;
                var taeSection = new TaeEditAnimListTaeSection();
                taeSection.Collapsed   = MainScreen.Config.AutoCollapseAllTaeSections;
                taeSection.Tae         = tae;
                taeSection.SectionName = System.IO.Path.GetFileName(kvp.Key);
                foreach (var anim in tae.Animations)
                {
                    var animID_Lower = isMultiSectionTae ? anim.ID : GameDataManager.GameTypeHasLongAnimIDs
                        ? (anim.ID % 1_000000) : (anim.ID % 1_0000);

                    var animID_Upper = taeSection.SectionName.StartsWith("a") ?
                                       long.Parse(Utils.GetFileNameWithoutAnyExtensions(taeSection.SectionName).Substring(1))
                        : ((GameDataManager.GameTypeHasLongAnimIDs
                            ? (anim.ID / 1_000000) : (anim.ID / 1_0000)));

                    var info = new TaeEditAnimInfo()
                    {
                        GetName = () =>
                        {
                            if (MainScreen?.Graph?.ViewportInteractor?.EntityType == TaeViewportInteractor.TaeEntityType.REMO)
                            {
                                return(anim.ID < 1_0000 ? $"cut{anim.ID:D4}" : $"[Entry {anim.ID}]");
                            }
                            else if (GameDataManager.GameTypeHasLongAnimIDs)
                            {
                                bool   ds2Meme = GameDataManager.CurrentAnimIDFormatType == GameDataManager.AnimIDFormattingType.aXX_YY_ZZZZ;
                                string res     = ds2Meme ? $"a{(animID_Upper):D2}_{animID_Lower:D6}" :
                                                 $"a{(animID_Upper):D3}_{animID_Lower:D6}";
                                if (ds2Meme)
                                {
                                    res = res.Insert(res.Length - 4, "_");
                                }
                                return(res);
                            }
                            else
                            {
                                return($"a{(animID_Upper):D2}_{animID_Lower:D4}");
                            }
                            //  (GameDataManager.GameTypeHasLongAnimIDs
                            //? $"a{(animID_Upper):D3}_{animID_Lower:D6}" : $"a{(animID_Upper):D2}_{animID_Lower:D4}"),
                        },
                        Ref              = anim,
                        VerticalOffset   = taeSection.HeightOfAllAnims,
                        TaePrefix        = MainScreen.FileContainer.AllTAEDict.Count == 1 ? 0 : animID_Upper,
                        IsLargeID        = GameDataManager.GameTypeHasLongAnimIDs,
                        IsRedErrorPrefix = isMultiSectionTae && ((anim.ID > (GameDataManager.GameTypeHasLongAnimIDs ? 999999 : 9999) || anim.ID < 0))
                    };



                    taeSection.InfoMap.Add(anim, info);
                    taeSection.HeightOfAllAnims += AnimHeight;
                }
                int taeKey = taeSection.SectionName.StartsWith("a") ?
                             int.Parse(Utils.GetFileNameWithoutAnyExtensions(taeSection.SectionName).Substring(1)) : 0;
                AnimTaeSections.Add(taeKey, taeSection);
            }

            ScrollViewer = new TaeScrollViewer();

            UpdateScrollViewerRect();
        }