Esempio n. 1
0
    public void EnterChild(IVIStar child)
    {
        Assert.IsTrue(CurrentStar.Children.Contains(child),
                      "`" + CurrentStar.Entry.FullPath + "' isn't an immediate child of `"
                      + child.Entry.FullPath + "' as expected!"
                      );
        Assert.IsTrue(child.Entry is IVIDirectory, "Entering a file!");

        NextCurrentStar = child;
        OnEnterStart();
        EnteringChild = true;

        NextCurrentStar.DoRecursively(Depth, (s, depth) => s.GenerateNextLevel(depth, this, EnterFadeInList));
        NextCurrentStar.DoRecursively(Depth, (s, depth) => s.DoIf(s_ => depth < 1, s_ => EnterFadeInList.Add(s_)));

        EnterFadeOutList.Add(NextCurrentStar);
        EnterFadeOutList.Add(CurrentStar);
        EnterDestroyList.Add(CurrentStar);
        foreach (IVIStar star in CurrentStar.Children)
        {
            if (star != NextCurrentStar)
            {
                star.DoRecursively(s => EnterFadeOutList.Add(s));
                star.DoRecursively(s => EnterDestroyList.Add(s));
            }
        }
    }
Esempio n. 2
0
    void Start()
    {
        GameObject go = Instantiate(StarPrefab, transform);

        CurrentStar       = go.GetComponent <IVIStar> ();
        CurrentStar.Scale = L0_Scale;
        if (InitialPath == null || InitialPath.Length <= 0)
        {
            InitialPath = Application.dataPath;
        }
        try {
            CurrentStar.Entry = InitialDir != null ? InitialDir : new IVIDirectory(InitialPath, Depth);
        } catch (System.Exception e) {
            Debug.Log("Failed to initialize StarSystem: " + e);
            if (FatalMessageBoxPrefab == null)
            {
                //UnityEditor.EditorApplication.isPlaying = false;
                Application.Quit();
            }
            else
            {
                Instantiate(FatalMessageBoxPrefab);
            }
        }
        CurrentStar.DoRecursively(Depth, (s, depth) => s.RegenerateChildren(depth, transform));
        CurrentStar.DoRecursively(s => s.PlaceChildrenAround());
        CurrentStar.DoRecursively(Depth, (s, depth) => s.ResetDistanceAndScale(level: Depth - depth, sys: this));
        CurrentStar.DoRecursively(s => s.SetMaterial());
        CurrentStar.DoRecursively(s => s.SetLight());
        CurrentStar.DoRecursively(s => s.SetName());
        ApplyVisualDepth();
    }
Esempio n. 3
0
 void OnEnterFinished()
 {
     CurrentStar = NextCurrentStar;
     foreach (IVIStar star in EnterDestroyList)
     {
         star.Children.ForEach(child => child.Parent = null);
         if (star.Parent != null)
         {
             star.Parent.Children.Remove(star);
         }
         Destroy(star.gameObject);
     }
     CurrentStar.Parent = null;
     CurrentStar.DoRecursively(s => s.SetName());
     ApplyVisualDepth();
     EnterDestroyList.Clear();
     EnterFadeInList.Clear();
     EnterFadeOutList.Clear();
 }
Esempio n. 4
0
    public void EnterParent()
    {
        IVIDirectory curDir   = CurrentStar.Entry as IVIDirectory;
        GameObject   parentGo = Instantiate(StarPrefab, transform);

        NextCurrentStar       = parentGo.GetComponent <IVIStar> ();
        NextCurrentStar.Entry = new IVIDirectory(curDir.Systemdirectory.Parent.FullName, Depth);
        // XXX This is done in too many places, should be compressed into a function.
        NextCurrentStar.DoRecursively(Depth, (s, depth) => s.RegenerateChildren(depth, transform));
        NextCurrentStar.DoRecursively(s => s.PlaceChildrenAround());
        NextCurrentStar.DoRecursively(Depth, (s, depth) => s.ResetDistanceAndScale(level: Depth - depth, sys: this));
        NextCurrentStar.DoRecursively(s => s.SetMaterial());
        NextCurrentStar.DoRecursively(s => s.SetLight());

        foreach (IVIStar child in NextCurrentStar.Children)
        {
            if (CurrentStar.Entry.FullPath == child.Entry.FullPath)
            {
                child.Children.ForEach(s_ => s_.DoRecursively_ChildrenFirst(s => Destroy(s.gameObject)));
                child.Children = CurrentStar.Children;
                child.Children.ForEach(s => s.Parent = child);
                Destroy(CurrentStar.gameObject);
                CurrentStar = child;
                EnterFadeInList.Add(CurrentStar);
            }
            else
            {
                child.DoRecursively(s => EnterFadeInList.Add(s));
            }

            child.DoRecursively(Depth, (s_, depth) => s_.DoIf(s => depth < 1, s => EnterFadeOutList.Add(s)));
            child.DoRecursively(Depth, (s_, depth) => s_.DoIf(s => depth < 1, s => EnterDestroyList.Add(s)));
        }
        NextCurrentStar.DoRecursively(s => s.SetName());
        NextCurrentStar.gameObject.SetActive(false);

        OnEnterStart();
        EnteringChild = false;
    }
Esempio n. 5
0
 void ApplyVisualDepth()
 {
     CurrentStar.DoRecursively(Depth, (s, depth) => s.gameObject.SetActive(false));
     CurrentStar.DoRecursively(VisualDepth, (s, depth) => s.gameObject.SetActive(true));
     CurrentStar.gameObject.SetActive(false);
 }