示例#1
0
    public override void OnTabSelected()
    {
        base.OnTabSelected();

        SubscribeKeyInput();

        GameContext.Window.LogTabButton.OwnerNote = null;

        List <string> filepathList = new List <string>(EditedLogTreeDict.Keys);

        foreach (string filepath in filepathList)
        {
            string  filename = Path.GetFileName(filepath);
            LogTree logTree  = logTrees_.Find((LogTree lt) => lt.File.Name == filename);
            if (logTree != null)
            {
                logTree.ReloadFile();
                EditedLogTreeDict.Remove(logTree.File.FullName);
            }
            else
            {
                LogTitleText titleText = titleTextlist_.Find((LogTitleText tt) => tt.name == filename);
                if (titleText != null)
                {
                    logTree = InsertLogTree(titleText, titleText.GetComponentInParent <DateUI>().Date, filepath);
                    titleText.OnLoad(logTree);
                    EditedLogTreeDict.Remove(titleText.FilePath);
                }
            }
        }
    }
示例#2
0
    public override void ReloadNote()
    {
        DateTime       date           = DateTime.Now;
        List <LogTree> cachedLogTrees = new List <LogTree>(logTrees_);

        logTrees_.Clear();
        foreach (DateUI dateUI in dateUIlist_)
        {
            Transform parent = dateUI.GetComponentInChildren <VerticalLayoutGroup>().transform;
            foreach (TreeNote treeNote in GameContext.Window.MainTabGroup.TreeNotes)
            {
                string filename = ToFileName(treeNote, date);
                if (File.Exists(filename))
                {
                    LogTree existTree = cachedLogTrees.Find((LogTree lt) => lt.File.Name == Path.GetFileName(filename));
                    if (existTree != null)
                    {
                        existTree.ReloadFile();
                        logTrees_.Add(existTree);
                    }
                    else
                    {
                        Transform titleObj = parent.Find(Path.GetFileName(filename));
                        if (titleObj != null)
                        {
                            LogTree logTree = LoadLogTree(parent, date, filename);
                            logTree.gameObject.transform.SetSiblingIndex(titleObj.GetSiblingIndex() + 1);
                            logTrees_.Add(logTree);
                            titleObj.GetComponent <LogTitleText>().OnLoad(logTree);
                        }
                    }
                }
            }
        }
        UpdateLayoutElement();
    }